aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-19 17:50:34 (GMT)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-22 15:20:34 (GMT)
commit1f297471a0bec68c1410e96e64c686537cd60860 (patch)
tree903fb94644f6f33bcc0ace6dc53600709d7ebe08
parent16c8c354d0c9452011bd41e160ba9c42afa5387c (diff)
downloadexternal_mesa3d-1f297471a0bec68c1410e96e64c686537cd60860.zip
external_mesa3d-1f297471a0bec68c1410e96e64c686537cd60860.tar.gz
external_mesa3d-1f297471a0bec68c1410e96e64c686537cd60860.tar.bz2
pan/midgard: Add mir_rewrite_index_src_single helper
Rather than rewriting an index away across the whole block, we expose finer (per-instruction) granularity for rewrites. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
-rw-r--r--src/panfrost/midgard/compiler.h1
-rw-r--r--src/panfrost/midgard/mir.c18
2 files changed, 13 insertions, 6 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index 2af902d..294831c 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -365,6 +365,7 @@ mir_is_alu_bundle(midgard_bundle *bundle)
void mir_rewrite_index(compiler_context *ctx, unsigned old, unsigned new);
void mir_rewrite_index_src(compiler_context *ctx, unsigned old, unsigned new);
void mir_rewrite_index_dst(compiler_context *ctx, unsigned old, unsigned new);
+void mir_rewrite_index_src_single(midgard_instruction *ins, unsigned old, unsigned new);
/* MIR printing */
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index 6adc135..c606cb3 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -23,16 +23,22 @@
#include "compiler.h"
+void mir_rewrite_index_src_single(midgard_instruction *ins, unsigned old, unsigned new)
+{
+ if (ins->ssa_args.src0 == old)
+ ins->ssa_args.src0 = new;
+
+ if (ins->ssa_args.src1 == old &&
+ !ins->ssa_args.inline_constant)
+ ins->ssa_args.src1 = new;
+}
+
+
void
mir_rewrite_index_src(compiler_context *ctx, unsigned old, unsigned new)
{
mir_foreach_instr_global(ctx, ins) {
- if (ins->ssa_args.src0 == old)
- ins->ssa_args.src0 = new;
-
- if (ins->ssa_args.src1 == old &&
- !ins->ssa_args.inline_constant)
- ins->ssa_args.src1 = new;
+ mir_rewrite_index_src_single(ins, old, new);
}
}