From 0c7f12627748aa56fc051154e77e9ecfb3ed2d70 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 11 May 2022 15:39:38 -0400 Subject: [PATCH] pan/bi: Add bi_before_block cursor Useful for preloading. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/compiler.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 85b055a..6aab2c4 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -1203,6 +1203,15 @@ bi_before_nonempty_block(bi_block *block) return bi_before_instr(I); } +static inline bi_cursor +bi_before_block(bi_block *block) +{ + if (list_is_empty(&block->instructions)) + return bi_after_block(block); + else + return bi_before_nonempty_block(block); +} + /* 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 */ -- 2.7.4