From 693271c0a875fa6bdaede6449816022cb960055d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 16 Dec 2020 12:50:07 -0500 Subject: [PATCH] pan/bi: Add builder initialization helper When going out of NIR, it's useful to start inserting instructions at the end of the current block. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 9640e2dca96..769bbd905a2 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -36,6 +36,7 @@ #include "compiler.h" #include "bi_quirks.h" #include "bi_print.h" +#include "bi_builder.h" static const struct debug_named_value debug_options[] = { {"msgs", BIFROST_DBG_MSGS, "Print debug messages"}, @@ -57,6 +58,15 @@ int bifrost_debug = 0; fprintf(stderr, "%s:%d: "fmt, \ __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0) +static inline bi_builder +bi_init_builder(bi_context *ctx) +{ + return (bi_builder) { + .shader = ctx, + .cursor = bi_after_block(ctx->current_block) + }; +} + static bi_block *emit_cf_list(bi_context *ctx, struct exec_list *list); static bi_instruction *bi_emit_branch(bi_context *ctx);