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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Mon Jul 29 15:10:41 2019 -0700

pan/midgard: Move nir_*_src_index to compiler.h

These helpers are useful for code emission everywhere. Share the love!

Signed-off-by: Alyssa Rosenzweig <[email protected]>

---

 src/panfrost/midgard/compiler.h        | 30 ++++++++++++++++++++++++++++++
 src/panfrost/midgard/midgard_compile.c | 28 ----------------------------
 2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index a7698941f4e..7f5714d013c 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -387,6 +387,36 @@ make_compiler_temp(compiler_context *ctx)
         return (ctx->func->impl->ssa_alloc + ctx->temp_alloc++) << 1;
 }
 
+static inline unsigned
+nir_src_index(compiler_context *ctx, nir_src *src)
+{
+        if (src->is_ssa)
+                return (src->ssa->index << 1) | 0;
+        else {
+                assert(!src->reg.indirect);
+                return (src->reg.reg->index << 1) | IS_REG;
+        }
+}
+
+static inline unsigned
+nir_alu_src_index(compiler_context *ctx, nir_alu_src *src)
+{
+        return nir_src_index(ctx, &src->src);
+}
+
+static inline unsigned
+nir_dest_index(compiler_context *ctx, nir_dest *dst)
+{
+        if (dst->is_ssa)
+                return (dst->ssa.index << 1) | 0;
+        else {
+                assert(!dst->reg.indirect);
+                return (dst->reg.reg->index << 1) | IS_REG;
+        }
+}
+
+
+
 /* MIR manipulation */
 
 void mir_rewrite_index(compiler_context *ctx, unsigned old, unsigned new);
diff --git a/src/panfrost/midgard/midgard_compile.c 
b/src/panfrost/midgard/midgard_compile.c
index dbc5a338017..aa8fe9a68a5 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -293,17 +293,6 @@ midgard_nir_sysval_for_intrinsic(nir_intrinsic_instr 
*instr)
         }
 }
 
-static unsigned
-nir_dest_index(compiler_context *ctx, nir_dest *dst)
-{
-        if (dst->is_ssa)
-                return (dst->ssa.index << 1) | 0;
-        else {
-                assert(!dst->reg.indirect);
-                return (dst->reg.reg->index << 1) | IS_REG;
-        }
-}
-
 static int sysval_for_instr(compiler_context *ctx, nir_instr *instr,
                             unsigned *dest)
 {
@@ -547,23 +536,6 @@ emit_explicit_constant(compiler_context *ctx, unsigned 
node, unsigned to)
         }
 }
 
-static unsigned
-nir_src_index(compiler_context *ctx, nir_src *src)
-{
-        if (src->is_ssa)
-                return (src->ssa->index << 1) | 0;
-        else {
-                assert(!src->reg.indirect);
-                return (src->reg.reg->index << 1) | IS_REG;
-        }
-}
-
-static unsigned
-nir_alu_src_index(compiler_context *ctx, nir_alu_src *src)
-{
-        return nir_src_index(ctx, &src->src);
-}
-
 static bool
 nir_is_non_scalar_swizzle(nir_alu_src *src, unsigned nr_components)
 {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to