pan/bi: Add bi_max_temp helper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 11 Mar 2020 18:51:57 +0000 (14:51 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 11 Mar 2020 20:28:21 +0000 (20:28 +0000)
Instead of trying to reindex all the times, just be okay with consistent
but sparse indices, then figuring out the max index is easy enough.

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 93f8639c1d94d94de175bfd4c364fc9903f79102..9c64a910f6f79a82a24eff706b4df89373be13cd 100644 (file)
@@ -377,6 +377,13 @@ bi_remove_instruction(bi_instruction *ins)
 #define BIR_SPECIAL        ((BIR_INDEX_REGISTER | BIR_INDEX_UNIFORM) | \
         (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO)
 
+static inline unsigned
+bi_max_temp(bi_context *ctx)
+{
+        unsigned alloc = MAX2(ctx->impl->reg_alloc, ctx->impl->ssa_alloc);
+        return ((alloc + 1 + ctx->temp_alloc) << 1) | BIR_IS_REG;
+}
+
 static inline unsigned
 bi_make_temp(bi_context *ctx)
 {