aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/mir.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-26 09:20:52 -0700
committerAlyssa Rosenzweig <[email protected]>2019-07-26 09:20:52 -0700
commit481447cb00821fdc81d7ab328a8c70a02546cf78 (patch)
treebd2c664f279fcc1dd230dcf51051a3d0f9a08ff8 /src/panfrost/midgard/mir.c
parent95732cc9ef33f6b125cfaf26ae59bf2faab54e5b (diff)
pan/midgard: Add mir_is_written_before helper
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/mir.c')
-rw-r--r--src/panfrost/midgard/mir.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index d8e52982b68..61427e7c3d5 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -175,3 +175,22 @@ mir_special_index(compiler_context *ctx, unsigned idx)
return false;
}
+
+/* Is a node written before a given instruction? */
+
+bool
+mir_is_written_before(compiler_context *ctx, midgard_instruction *ins, unsigned node)
+{
+ if ((node < 0) || (node >= SSA_FIXED_MINIMUM))
+ return true;
+
+ mir_foreach_instr_global(ctx, q) {
+ if (q == ins)
+ break;
+
+ if (q->ssa_args.dest == node)
+ return true;
+ }
+
+ return false;
+}