summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/microinstruction.h
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-03-08 18:31:53 -0300
committerGravatar ameerj2021-07-22 21:51:23 -0400
commitab463712474de5f99eec137a9c6233e55fe184f0 (patch)
tree30d79ac64dd03d5cfafd07c0c42c2baadc82de98 /src/shader_recompiler/frontend/ir/microinstruction.h
parentshader: Implement R2P (diff)
downloadyuzu-ab463712474de5f99eec137a9c6233e55fe184f0.tar.gz
yuzu-ab463712474de5f99eec137a9c6233e55fe184f0.tar.xz
yuzu-ab463712474de5f99eec137a9c6233e55fe184f0.zip
shader: Initial support for textures and TEX
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.h')
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.h22
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
23class Block; 23class Block;
24 24
25constexpr size_t MAX_ARG_COUNT = 4; 25struct AssociatedInsts;
26 26
27class Inst : public boost::intrusive::list_base_hook<> { 27class Inst : public boost::intrusive::list_base_hook<> {
28public: 28public:
@@ -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};
133static_assert(sizeof(Inst) <= 128, "Inst size unintentionally increased");
134
135struct 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};
133static_assert(sizeof(Inst) <= 128, "Inst size unintentionally increased its size");
134 144
135} // namespace Shader::IR 145} // namespace Shader::IR