From: Alyssa Rosenzweig Date: Wed, 11 Mar 2020 18:48:55 +0000 (-0400) Subject: pan/bi: Add bi_next/prev_op helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e0479a6a88656205a1907c8987666f415a7c4a5;p=mesa.git pan/bi: Add bi_next/prev_op helpers From Midgard. These are surprisingly helpful. Signed-off-by: Alyssa Rosenzweig Part-of: --- 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);