mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
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>
This commit is contained in:
parent
16c8c354d0
commit
1f297471a0
2 changed files with 13 additions and 6 deletions
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue