summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/microinstruction.h
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-02-02 21:07:00 -0300
committerGravatar ameerj2021-07-22 21:51:21 -0400
commit6c4cc0cd062fbbba5349da1108d3c23cb330ca8a (patch)
tree544291931da8a85fafcea71964c77d9278ec7f29 /src/shader_recompiler/frontend/ir/microinstruction.h
parentshader: Initial recompiler work (diff)
downloadyuzu-6c4cc0cd062fbbba5349da1108d3c23cb330ca8a.tar.gz
yuzu-6c4cc0cd062fbbba5349da1108d3c23cb330ca8a.tar.xz
yuzu-6c4cc0cd062fbbba5349da1108d3c23cb330ca8a.zip
shader: SSA and dominance
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.h')
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h
index 43460b950..7f1ed6710 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.h
+++ b/src/shader_recompiler/frontend/ir/microinstruction.h
@@ -5,6 +5,8 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <span>
9#include <vector>
8 10
9#include <boost/intrusive/list.hpp> 11#include <boost/intrusive/list.hpp>
10 12
@@ -15,6 +17,8 @@
15 17
16namespace Shader::IR { 18namespace Shader::IR {
17 19
20class Block;
21
18constexpr size_t MAX_ARG_COUNT = 4; 22constexpr size_t MAX_ARG_COUNT = 4;
19 23
20class Inst : public boost::intrusive::list_base_hook<> { 24class Inst : public boost::intrusive::list_base_hook<> {
@@ -59,6 +63,11 @@ public:
59 /// Set the value of a given argument index. 63 /// Set the value of a given argument index.
60 void SetArg(size_t index, Value value); 64 void SetArg(size_t index, Value value);
61 65
66 /// Get an immutable span to the phi operands.
67 [[nodiscard]] std::span<const std::pair<Block*, Value>> PhiOperands() const noexcept;
68 /// Add phi operand to a phi instruction.
69 void AddPhiOperand(Block* predecessor, const Value& value);
70
62 void Invalidate(); 71 void Invalidate();
63 void ClearArgs(); 72 void ClearArgs();
64 73
@@ -76,6 +85,7 @@ private:
76 Inst* carry_inst{}; 85 Inst* carry_inst{};
77 Inst* overflow_inst{}; 86 Inst* overflow_inst{};
78 Inst* zsco_inst{}; 87 Inst* zsco_inst{};
88 std::vector<std::pair<Block*, Value>> phi_operands;
79 u64 flags{}; 89 u64 flags{};
80}; 90};
81 91