diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-02-25 02:31:15 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:22 +0200 |
commit | 8810c88b7e3de2766bf47e07e941fb2c58c6b4b0 (patch) | |
tree | 73619b1563eefc7103687de8e78bcf3f750812f7 /src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp | |
parent | spirv: Move phi arguments emit to a separate function (diff) | |
download | yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.gz yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.bz2 yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.lz yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.xz yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.zst yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.zip |
Diffstat (limited to 'src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp')
-rw-r--r-- | src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp b/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp index 13f9c914a..19d35b1f8 100644 --- a/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp +++ b/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp @@ -109,11 +109,13 @@ IR::Opcode UndefOpcode(const FlagTag&) noexcept { class Pass { public: - void WriteVariable(auto variable, IR::Block* block, const IR::Value& value) { + template <typename Type> + void WriteVariable(Type variable, IR::Block* block, const IR::Value& value) { current_def[variable].insert_or_assign(block, value); } - IR::Value ReadVariable(auto variable, IR::Block* block) { + template <typename Type> + IR::Value ReadVariable(Type variable, IR::Block* block) { const ValueMap& def{current_def[variable]}; if (const auto it{def.find(block)}; it != def.end()) { return it->second; @@ -132,7 +134,8 @@ public: } private: - IR::Value ReadVariableRecursive(auto variable, IR::Block* block) { + template <typename Type> + IR::Value ReadVariableRecursive(Type variable, IR::Block* block) { IR::Value val; if (!sealed_blocks.contains(block)) { // Incomplete CFG @@ -154,7 +157,8 @@ private: return val; } - IR::Value AddPhiOperands(auto variable, IR::Inst& phi, IR::Block* block) { + template <typename Type> + IR::Value AddPhiOperands(Type variable, IR::Inst& phi, IR::Block* block) { for (IR::Block* const imm_pred : block->ImmediatePredecessors()) { phi.AddPhiOperand(imm_pred, ReadVariable(variable, imm_pred)); } |