pan/midgard: Extract nir_ssa_index helper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 27 Feb 2020 14:35:12 +0000 (09:35 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 27 Feb 2020 21:02:35 +0000 (21:02 +0000)
In case we don't have a nir_src.

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

src/panfrost/midgard/compiler.h

index 994ebd3ed4ae9ef3654864ddda6c7e72b66d5fec..ca7d2c708cad3d3d1074bab5ad60b8ca960dd80e 100644 (file)
@@ -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;