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 <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
This commit is contained in:
Alyssa Rosenzweig
2020-12-16 12:50:07 -05:00
committed by Marge Bot
parent 226dfa9490
commit 693271c0a8
+10
View File
@@ -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);