From: Alyssa Rosenzweig Date: Wed, 24 Jul 2019 19:51:51 +0000 (-0700) Subject: pan/midgard: Add mir_rewrite_index_src_tag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eedd6c1dd0040c0a3573000003730a8a3f2e4b78;p=mesa.git pan/midgard: Add mir_rewrite_index_src_tag Specialized version of a rewrite that only rewrites a certain type of instruction. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 8266c547843..7b231bf85ea 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -373,6 +373,7 @@ 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); +void mir_rewrite_index_src_tag(compiler_context *ctx, unsigned old, unsigned new, unsigned tag); bool mir_single_use(compiler_context *ctx, unsigned value); /* MIR printing */ diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c index 03a47f44acb..93262f4b13f 100644 --- a/src/panfrost/midgard/mir.c +++ b/src/panfrost/midgard/mir.c @@ -43,6 +43,19 @@ mir_rewrite_index_src(compiler_context *ctx, unsigned old, unsigned new) } } +void +mir_rewrite_index_src_tag(compiler_context *ctx, unsigned old, unsigned new, unsigned tag) +{ + mir_foreach_instr_global(ctx, ins) { + if (ins->type != tag) + continue; + + mir_rewrite_index_src_single(ins, old, new); + } +} + + + void mir_rewrite_index_dst(compiler_context *ctx, unsigned old, unsigned new) {