diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.h')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h index dc9f683fe..ea55fc29c 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.h +++ b/src/shader_recompiler/frontend/ir/microinstruction.h | |||
| @@ -73,10 +73,19 @@ public: | |||
| 73 | [[nodiscard]] IR::Type Type() const; | 73 | [[nodiscard]] IR::Type Type() const; |
| 74 | 74 | ||
| 75 | /// Get the number of arguments this instruction has. | 75 | /// Get the number of arguments this instruction has. |
| 76 | [[nodiscard]] size_t NumArgs() const; | 76 | [[nodiscard]] size_t NumArgs() const { |
| 77 | return op == Opcode::Phi ? phi_args.size() : NumArgsOf(op); | ||
| 78 | } | ||
| 77 | 79 | ||
| 78 | /// Get the value of a given argument index. | 80 | /// Get the value of a given argument index. |
| 79 | [[nodiscard]] Value Arg(size_t index) const; | 81 | [[nodiscard]] Value Arg(size_t index) const noexcept { |
| 82 | if (op == Opcode::Phi) { | ||
| 83 | return phi_args[index].second; | ||
| 84 | } else { | ||
| 85 | return args[index]; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 80 | /// Set the value of a given argument index. | 89 | /// Set the value of a given argument index. |
| 81 | void SetArg(size_t index, Value value); | 90 | void SetArg(size_t index, Value value); |
| 82 | 91 | ||