diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-14 05:24:32 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:22 +0200 |
commit | 8af9297f0972d0aaa8306369c5d04926b886a89e (patch) | |
tree | 43bb3f50d694b615d2ae821eef84e417166d4890 /src/shader_recompiler/frontend/ir/microinstruction.cpp | |
parent | shader: Initial implementation of an AST (diff) | |
download | yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.tar yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.tar.gz yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.tar.bz2 yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.tar.lz yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.tar.xz yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.tar.zst yuzu-8af9297f0972d0aaa8306369c5d04926b886a89e.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.cpp')
-rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index b4ae371bd..9279b9692 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp @@ -143,19 +143,21 @@ Value Inst::Arg(size_t index) const { } void Inst::SetArg(size_t index, Value value) { - if (op == Opcode::Phi) { - throw LogicError("Setting argument on a phi instruction"); - } - if (index >= NumArgsOf(op)) { + if (index >= NumArgs()) { throw InvalidArgument("Out of bounds argument index {} in opcode {}", index, op); } - if (!args[index].IsImmediate()) { - UndoUse(args[index]); + const IR::Value arg{Arg(index)}; + if (!arg.IsImmediate()) { + UndoUse(arg); } if (!value.IsImmediate()) { Use(value); } - args[index] = value; + if (op == Opcode::Phi) { + phi_args[index].second = value; + } else { + args[index] = value; + } } Block* Inst::PhiBlock(size_t index) const { |