diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.cpp')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index 3dfa5a880..e563b4022 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | 7 | ||
| 8 | #include "shader_recompiler/exception.h" | 8 | #include "shader_recompiler/exception.h" |
| 9 | #include "shader_recompiler/frontend/ir/basic_block.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/type.h" | 10 | #include "shader_recompiler/frontend/ir/type.h" |
| 10 | #include "shader_recompiler/frontend/ir/value.h" | 11 | #include "shader_recompiler/frontend/ir/value.h" |
| 11 | 12 | ||
| @@ -291,6 +292,16 @@ void Inst::AddPhiOperand(Block* predecessor, const Value& value) { | |||
| 291 | phi_args.emplace_back(predecessor, value); | 292 | phi_args.emplace_back(predecessor, value); |
| 292 | } | 293 | } |
| 293 | 294 | ||
| 295 | void Inst::OrderPhiArgs() { | ||
| 296 | if (op != Opcode::Phi) { | ||
| 297 | throw LogicError("{} is not a Phi instruction", op); | ||
| 298 | } | ||
| 299 | std::sort(phi_args.begin(), phi_args.end(), | ||
| 300 | [](const std::pair<Block*, Value>& a, const std::pair<Block*, Value>& b) { | ||
| 301 | return a.first->GetOrder() < b.first->GetOrder(); | ||
| 302 | }); | ||
| 303 | } | ||
| 304 | |||
| 294 | void Inst::Invalidate() { | 305 | void Inst::Invalidate() { |
| 295 | ClearArgs(); | 306 | ClearArgs(); |
| 296 | ReplaceOpcode(Opcode::Void); | 307 | ReplaceOpcode(Opcode::Void); |