From eedd6c1dd0040c0a3573000003730a8a3f2e4b78 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 24 Jul 2019 12:51:51 -0700 Subject: [PATCH] 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 --- src/panfrost/midgard/compiler.h | 1 + src/panfrost/midgard/mir.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) 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) { -- 2.30.2