Mesa (master): pan/midgard: Extract nir_ssa_index helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 27 21:31:27 UTC 2020


Module: Mesa
Branch: master
Commit: 1a2bb78840face41e4329c3180c041ffef64a4e4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a2bb78840face41e4329c3180c041ffef64a4e4

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Feb 27 09:35:12 2020 -0500

pan/midgard: Extract nir_ssa_index helper

In case we don't have a nir_src.

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

---

 src/panfrost/midgard/compiler.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index 994ebd3ed4a..ca7d2c708ca 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -498,11 +498,17 @@ make_compiler_temp_reg(compiler_context *ctx)
         return ((ctx->func->impl->reg_alloc + ctx->temp_alloc++) << 1) | IS_REG;
 }
 
+static inline unsigned
+nir_ssa_index(nir_ssa_def *ssa)
+{
+        return (ssa->index << 1) | 0;
+}
+
 static inline unsigned
 nir_src_index(compiler_context *ctx, nir_src *src)
 {
         if (src->is_ssa)
-                return (src->ssa->index << 1) | 0;
+                return nir_ssa_index(src->ssa);
         else {
                 assert(!src->reg.indirect);
                 return (src->reg.reg->index << 1) | IS_REG;



More information about the mesa-commit mailing list