summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-10-03 21:51:05 -0400
committerAlyssa Rosenzweig <[email protected]>2019-10-03 22:29:50 -0400
commit76a76de7af0bc0631a2705fedf17e743c6d73842 (patch)
treeaed3778ab8812ec8d2407cd9e1709624f546aaf2
parentc59fae0fef4a4977811384c515ce35319c145708 (diff)
pan/midgard: Add mir_calculate_temp_count helper
This allows us to fill in ctx->temp_count explicitly, even if we haven't squished down the MIR. Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/panfrost/midgard/compiler.h1
-rw-r--r--src/panfrost/midgard/mir.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index a338557a7a0..66cb34f9db5 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -525,6 +525,7 @@ bool mir_nontrivial_outmod(midgard_instruction *ins);
void mir_insert_instruction_before_scheduled(compiler_context *ctx, midgard_block *block, midgard_instruction *tag, midgard_instruction ins);
void mir_insert_instruction_after_scheduled(compiler_context *ctx, midgard_block *block, midgard_instruction *tag, midgard_instruction ins);
void mir_flip(midgard_instruction *ins);
+void mir_compute_temp_count(compiler_context *ctx);
/* MIR goodies */
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index f02527ff219..e19ed4f98a6 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -544,3 +544,21 @@ mir_flip(midgard_instruction *ins)
ins->alu.src1 = ins->alu.src2;
ins->alu.src2 = temp;
}
+
+/* Before squashing, calculate ctx->temp_count just by observing the MIR */
+
+void
+mir_compute_temp_count(compiler_context *ctx)
+{
+ if (ctx->temp_count)
+ return;
+
+ unsigned max_dest = 0;
+
+ mir_foreach_instr_global(ctx, ins) {
+ if (ins->dest < SSA_FIXED_MINIMUM)
+ max_dest = MAX2(max_dest, ins->dest);
+ }
+
+ ctx->temp_count = max_dest;
+}