pan/bi: Add bi_before_nonempty_block helper
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 23 Feb 2022 18:47:08 +0000 (13:47 -0500)
committerAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 24 Feb 2022 17:51:04 +0000 (12:51 -0500)
To be used in the message preloading pass.

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

src/panfrost/bifrost/compiler.h

index cc37c66..664e25a 100644 (file)
@@ -1133,6 +1133,15 @@ bi_after_instr(bi_instr *instr)
     };
 }
 
+static inline bi_cursor
+bi_before_nonempty_block(bi_block *block)
+{
+        bi_instr *I = list_first_entry(&block->instructions, bi_instr, link);
+        assert(I != NULL);
+
+        return bi_before_instr(I);
+}
+
 /* Invariant: a tuple must be nonempty UNLESS it is the last tuple of a clause,
  * in which case there must exist a nonempty penultimate tuple */