aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-05 16:44:49 -0500
committerMarge Bot <[email protected]>2020-03-07 00:37:39 +0000
commit55dab92073f14a9b9c42175af9ddc210277bca5e (patch)
treea18327784797c372ddbe97838f156de61edc872e
parent7fd22c3bbd781ce497304c1270f367b1cd5fd14c (diff)
pan/bi: Add instruction emit/remove helpers
As we start descending into code generation these will be of interest. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4097>
-rw-r--r--src/panfrost/bifrost/compiler.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 2b390c19add..d57bdc2c9cc 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -324,10 +324,26 @@ typedef struct {
/* During NIR->BIR */
bi_block *current_block;
unsigned block_name_count;
+ bi_block *after_block;
/* Stats for shader-db */
unsigned instruction_count;
-} bi_context;
+} bi_context;
+
+static inline bi_instruction *
+bi_emit(bi_context *ctx, bi_instruction ins)
+{
+ bi_instruction *u = rzalloc(ctx, bi_instruction);
+ memcpy(u, &ins, sizeof(ins));
+ list_addtail(&u->link, &ctx->current_block->instructions);
+ return u;
+}
+
+static inline void
+bi_remove_instruction(bi_instruction *ins)
+{
+ list_del(&ins->link);
+}
/* So we can distinguish between SSA/reg/sentinel quickly */
#define BIR_NO_ARG (0)