aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/bifrost/compiler.h
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-11 14:48:55 -0400
committerMarge Bot <[email protected]>2020-03-11 20:28:21 +0000
commit6e0479a6a88656205a1907c8987666f415a7c4a5 (patch)
tree59f0dec10be875ba43caa3cc48b7618af6f60237 /src/panfrost/bifrost/compiler.h
parente623007eb786ddc5fb06133f3d7c27f9a2eb18f9 (diff)
pan/bi: Add bi_next/prev_op helpers
From Midgard. These are surprisingly helpful. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4150>
Diffstat (limited to 'src/panfrost/bifrost/compiler.h')
-rw-r--r--src/panfrost/bifrost/compiler.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 467735bcf0a..93f8639c1d9 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -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);