panfrost/midgard: Add mir_has_arg helper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 19 Jul 2019 19:14:43 +0000 (12:14 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 22 Jul 2019 15:20:34 +0000 (08:20 -0700)
Helps scan the MIR for uses of an index.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/compiler.h

index 294831c352e2a90880e4b02b56bf5f49858640b5..3002a079deafe9ab607837a2a90b1e900e440cbb 100644 (file)
@@ -417,6 +417,18 @@ v_mov(unsigned src, midgard_vector_alu_src mod, unsigned dest)
         return ins;
 }
 
+static inline bool
+mir_has_arg(midgard_instruction *ins, unsigned arg)
+{
+        if (ins->ssa_args.src0 == arg)
+                return true;
+
+        if (ins->ssa_args.src1 == arg && !ins->ssa_args.inline_constant)
+                return true;
+
+        return false;
+}
+
 midgard_instruction
 v_load_store_scratch(unsigned srcdest, unsigned index, bool is_store);