diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-03-17 05:30:23 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:23 +0200 |
commit | 8dd0acfaeba9396fb5c1e142a431a2a29f345855 (patch) | |
tree | de90d9ab871c892008267b33493d1d8c0e9e17d5 /src/shader_recompiler/frontend | |
parent | shader: Implement FSET and FSETP (diff) | |
download | yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.tar yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.tar.gz yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.tar.bz2 yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.tar.lz yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.tar.xz yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.tar.zst yuzu-8dd0acfaeba9396fb5c1e142a431a2a29f345855.zip |
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index 88e186f21..5946105d2 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp @@ -182,7 +182,7 @@ void Inst::AddPhiOperand(Block* predecessor, const Value& value) { void Inst::Invalidate() { ClearArgs(); - op = Opcode::Void; + ReplaceOpcode(Opcode::Void); } void Inst::ClearArgs() { @@ -206,20 +206,22 @@ void Inst::ClearArgs() { void Inst::ReplaceUsesWith(Value replacement) { Invalidate(); - - op = Opcode::Identity; - + ReplaceOpcode(Opcode::Identity); if (!replacement.IsImmediate()) { Use(replacement); } - if (op == Opcode::Phi) { - phi_args[0].second = replacement; - } else { - args[0] = replacement; - } + args[0] = replacement; } void Inst::ReplaceOpcode(IR::Opcode opcode) { + if (opcode == IR::Opcode::Phi) { + throw LogicError("Cannot transition into Phi"); + } + if (op == Opcode::Phi) { + // Transition out of phi arguments into non-phi + std::destroy_at(&phi_args); + std::construct_at(&args); + } op = opcode; } |