summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/basic_block.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-02-06 02:38:22 -0300
committerGravatar ameerj2021-07-22 21:51:21 -0400
commitda8096e6e35af250dcc56a1af76b8a211df63a90 (patch)
tree5bac3a389afddd1ba23a9fb2ea410c077c28f3b8 /src/shader_recompiler/frontend/ir/basic_block.cpp
parentshader: Add pools and rename files (diff)
downloadyuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.gz
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.xz
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.zip
shader: Properly store phi on Inst
Diffstat (limited to 'src/shader_recompiler/frontend/ir/basic_block.cpp')
-rw-r--r--src/shader_recompiler/frontend/ir/basic_block.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/shader_recompiler/frontend/ir/basic_block.cpp b/src/shader_recompiler/frontend/ir/basic_block.cpp
index 1a5d82135..50c6a83cd 100644
--- a/src/shader_recompiler/frontend/ir/basic_block.cpp
+++ b/src/shader_recompiler/frontend/ir/basic_block.cpp
@@ -129,26 +129,21 @@ std::string DumpBlock(const Block& block, const std::map<const Block*, size_t>&
129 } else { 129 } else {
130 ret += fmt::format(" {}", op); // '%00000 = ' -> 1 + 5 + 3 = 9 spaces 130 ret += fmt::format(" {}", op); // '%00000 = ' -> 1 + 5 + 3 = 9 spaces
131 } 131 }
132 if (op == Opcode::Phi) { 132 const size_t arg_count{NumArgsOf(op)};
133 size_t val_index{0}; 133 for (size_t arg_index = 0; arg_index < arg_count; ++arg_index) {
134 for (const auto& [phi_block, phi_val] : inst.PhiOperands()) { 134 const Value arg{inst.Arg(arg_index)};
135 ret += val_index != 0 ? ", " : " "; 135 const std::string arg_str{ArgToIndex(block_to_index, inst_to_index, arg)};
136 ret += fmt::format("[ {}, {} ]", ArgToIndex(block_to_index, inst_to_index, phi_val), 136 ret += arg_index != 0 ? ", " : " ";
137 BlockToIndex(block_to_index, phi_block)); 137 if (op == Opcode::Phi) {
138 ++val_index; 138 ret += fmt::format("[ {}, {} ]", arg_index,
139 BlockToIndex(block_to_index, inst.PhiBlock(arg_index)));
140 } else {
141 ret += arg_str;
139 } 142 }
140 } else { 143 const Type actual_type{arg.Type()};
141 const size_t arg_count{NumArgsOf(op)}; 144 const Type expected_type{ArgTypeOf(op, arg_index)};
142 for (size_t arg_index = 0; arg_index < arg_count; ++arg_index) { 145 if (!AreTypesCompatible(actual_type, expected_type)) {
143 const Value arg{inst.Arg(arg_index)}; 146 ret += fmt::format("<type error: {} != {}>", actual_type, expected_type);
144 ret += arg_index != 0 ? ", " : " ";
145 ret += ArgToIndex(block_to_index, inst_to_index, arg);
146
147 const Type actual_type{arg.Type()};
148 const Type expected_type{ArgTypeOf(op, arg_index)};
149 if (!AreTypesCompatible(actual_type, expected_type)) {
150 ret += fmt::format("<type error: {} != {}>", actual_type, expected_type);
151 }
152 } 147 }
153 } 148 }
154 if (TypeOf(op) != Type::Void) { 149 if (TypeOf(op) != Type::Void) {