summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-19 10:50:34 -0700
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-22 08:20:34 -0700
commit1f297471a0bec68c1410e96e64c686537cd60860 (patch)
tree903fb94644f6f33bcc0ace6dc53600709d7ebe08 /src
parent16c8c354d0c9452011bd41e160ba9c42afa5387c (diff)
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>
Diffstat (limited to 'src')
-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 2af902dbe71..294831c352e 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 6adc1350c0a..c606cb3ddf7 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);
}
}