summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/ir/basic_block.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-02-06 06:38:22 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:21 +0200
commitda8096e6e35af250dcc56a1af76b8a211df63a90 (patch)
tree5bac3a389afddd1ba23a9fb2ea410c077c28f3b8 /src/shader_recompiler/frontend/ir/basic_block.cpp
parentshader: Add pools and rename files (diff)
downloadyuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.gz
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.bz2
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.lz
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.xz
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.tar.zst
yuzu-da8096e6e35af250dcc56a1af76b8a211df63a90.zip
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>&
} else {
ret += fmt::format(" {}", op); // '%00000 = ' -> 1 + 5 + 3 = 9 spaces
}
- if (op == Opcode::Phi) {
- size_t val_index{0};
- for (const auto& [phi_block, phi_val] : inst.PhiOperands()) {
- ret += val_index != 0 ? ", " : " ";
- ret += fmt::format("[ {}, {} ]", ArgToIndex(block_to_index, inst_to_index, phi_val),
- BlockToIndex(block_to_index, phi_block));
- ++val_index;
+ const size_t arg_count{NumArgsOf(op)};
+ for (size_t arg_index = 0; arg_index < arg_count; ++arg_index) {
+ const Value arg{inst.Arg(arg_index)};
+ const std::string arg_str{ArgToIndex(block_to_index, inst_to_index, arg)};
+ ret += arg_index != 0 ? ", " : " ";
+ if (op == Opcode::Phi) {
+ ret += fmt::format("[ {}, {} ]", arg_index,
+ BlockToIndex(block_to_index, inst.PhiBlock(arg_index)));
+ } else {
+ ret += arg_str;
}
- } else {
- const size_t arg_count{NumArgsOf(op)};
- for (size_t arg_index = 0; arg_index < arg_count; ++arg_index) {
- const Value arg{inst.Arg(arg_index)};
- ret += arg_index != 0 ? ", " : " ";
- ret += ArgToIndex(block_to_index, inst_to_index, arg);
-
- const Type actual_type{arg.Type()};
- const Type expected_type{ArgTypeOf(op, arg_index)};
- if (!AreTypesCompatible(actual_type, expected_type)) {
- ret += fmt::format("<type error: {} != {}>", actual_type, expected_type);
- }
+ const Type actual_type{arg.Type()};
+ const Type expected_type{ArgTypeOf(op, arg_index)};
+ if (!AreTypesCompatible(actual_type, expected_type)) {
+ ret += fmt::format("<type error: {} != {}>", actual_type, expected_type);
}
}
if (TypeOf(op) != Type::Void) {