diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.h')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h index 321393dd7..d5336c438 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.h +++ b/src/shader_recompiler/frontend/ir/microinstruction.h | |||
| @@ -22,7 +22,7 @@ namespace Shader::IR { | |||
| 22 | 22 | ||
| 23 | class Block; | 23 | class Block; |
| 24 | 24 | ||
| 25 | constexpr size_t MAX_ARG_COUNT = 4; | 25 | struct AssociatedInsts; |
| 26 | 26 | ||
| 27 | class Inst : public boost::intrusive::list_base_hook<> { | 27 | class Inst : public boost::intrusive::list_base_hook<> { |
| 28 | public: | 28 | public: |
| @@ -50,6 +50,11 @@ public: | |||
| 50 | return op; | 50 | return op; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /// Determines if there is a pseudo-operation associated with this instruction. | ||
| 54 | [[nodiscard]] bool HasAssociatedPseudoOperation() const noexcept { | ||
| 55 | return associated_insts != nullptr; | ||
| 56 | } | ||
| 57 | |||
| 53 | /// Determines whether or not this instruction may have side effects. | 58 | /// Determines whether or not this instruction may have side effects. |
| 54 | [[nodiscard]] bool MayHaveSideEffects() const noexcept; | 59 | [[nodiscard]] bool MayHaveSideEffects() const noexcept; |
| 55 | 60 | ||
| @@ -60,8 +65,6 @@ public: | |||
| 60 | /// Determines if all arguments of this instruction are immediates. | 65 | /// Determines if all arguments of this instruction are immediates. |
| 61 | [[nodiscard]] bool AreAllArgsImmediates() const; | 66 | [[nodiscard]] bool AreAllArgsImmediates() const; |
| 62 | 67 | ||
| 63 | /// Determines if there is a pseudo-operation associated with this instruction. | ||
| 64 | [[nodiscard]] bool HasAssociatedPseudoOperation() const noexcept; | ||
| 65 | /// Gets a pseudo-operation associated with this instruction | 68 | /// Gets a pseudo-operation associated with this instruction |
| 66 | [[nodiscard]] Inst* GetAssociatedPseudoOperation(IR::Opcode opcode); | 69 | [[nodiscard]] Inst* GetAssociatedPseudoOperation(IR::Opcode opcode); |
| 67 | 70 | ||
| @@ -122,14 +125,21 @@ private: | |||
| 122 | u32 definition{}; | 125 | u32 definition{}; |
| 123 | union { | 126 | union { |
| 124 | NonTriviallyDummy dummy{}; | 127 | NonTriviallyDummy dummy{}; |
| 125 | std::array<Value, MAX_ARG_COUNT> args; | ||
| 126 | std::vector<std::pair<Block*, Value>> phi_args; | 128 | std::vector<std::pair<Block*, Value>> phi_args; |
| 129 | std::array<Value, 5> args; | ||
| 130 | }; | ||
| 131 | std::unique_ptr<AssociatedInsts> associated_insts; | ||
| 132 | }; | ||
| 133 | static_assert(sizeof(Inst) <= 128, "Inst size unintentionally increased"); | ||
| 134 | |||
| 135 | struct AssociatedInsts { | ||
| 136 | union { | ||
| 137 | Inst* sparse_inst; | ||
| 138 | Inst* zero_inst{}; | ||
| 127 | }; | 139 | }; |
| 128 | Inst* zero_inst{}; | ||
| 129 | Inst* sign_inst{}; | 140 | Inst* sign_inst{}; |
| 130 | Inst* carry_inst{}; | 141 | Inst* carry_inst{}; |
| 131 | Inst* overflow_inst{}; | 142 | Inst* overflow_inst{}; |
| 132 | }; | 143 | }; |
| 133 | static_assert(sizeof(Inst) <= 128, "Inst size unintentionally increased its size"); | ||
| 134 | 144 | ||
| 135 | } // namespace Shader::IR | 145 | } // namespace Shader::IR |