pan/bi: Add bi_next/prev_op helpers
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 11 Mar 2020 18:48:55 +0000 (14:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 11 Mar 2020 20:28:21 +0000 (20:28 +0000)
From Midgard. These are surprisingly helpful.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4150>

src/panfrost/bifrost/compiler.h

index 467735bcf0ae1f4ff31bd09bdb203d07d1c58431..93f8639c1d94d94de175bfd4c364fc9903f79102 100644 (file)
@@ -469,6 +469,18 @@ bir_dest_index(nir_dest *dst)
 #define bi_foreach_src(ins, v) \
         for (unsigned v = 0; v < ARRAY_SIZE(ins->src); ++v)
 
+static inline bi_instruction *
+bi_prev_op(bi_instruction *ins)
+{
+        return list_last_entry(&(ins->link), bi_instruction, link);
+}
+
+static inline bi_instruction *
+bi_next_op(bi_instruction *ins)
+{
+        return list_first_entry(&(ins->link), bi_instruction, link);
+}
+
 /* BIR manipulation */
 
 bool bi_has_outmod(bi_instruction *ins);