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_dst_tag(compiler_context *ctx, unsigned old, unsigned new, unsigned tag);
void mir_rewrite_index_src_single(midgard_instruction *ins, unsigned old, unsigned new);
void mir_rewrite_index_src_tag(compiler_context *ctx, unsigned old, unsigned new, unsigned tag);
bool mir_single_use(compiler_context *ctx, unsigned value);
}
}
+void
+mir_rewrite_index_dst_tag(compiler_context *ctx, unsigned old, unsigned new, unsigned tag)
+{
+ mir_foreach_instr_global(ctx, ins) {
+ if (ins->type != tag)
+ continue;
+
+ if (ins->ssa_args.dest == old)
+ ins->ssa_args.dest = new;
+ }
+}
+
+
+
void
mir_rewrite_index(compiler_context *ctx, unsigned old, unsigned new)
{