aboutsummaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/basic_block.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-02-16 04:10:22 -0300
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-22 21:51:22 -0400
commitb5d7279d878211654b4abb165d94af763a365f47 (patch)
tree9b3a7b6e9d7d2b8945fe87d27ff75f1712ef06aa /src/shader_recompiler/frontend/ir/basic_block.h
parentd5d468cf2cbe235ee149dbd37951389d2a7e61da (diff)
spirv: Initial bindings support
Diffstat (limited to 'src/shader_recompiler/frontend/ir/basic_block.h')
-rw-r--r--src/shader_recompiler/frontend/ir/basic_block.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/basic_block.h b/src/shader_recompiler/frontend/ir/basic_block.h
index 778b32e432..b14a35ec53 100644
--- a/src/shader_recompiler/frontend/ir/basic_block.h
+++ b/src/shader_recompiler/frontend/ir/basic_block.h
@@ -11,6 +11,7 @@
#include <boost/intrusive/list.hpp>
+#include "common/bit_cast.h"
#include "shader_recompiler/frontend/ir/condition.h"
#include "shader_recompiler/frontend/ir/microinstruction.h"
#include "shader_recompiler/frontend/ir/value.h"
@@ -68,6 +69,18 @@ public:
/// Gets an immutable span to the immediate predecessors.
[[nodiscard]] std::span<Block* const> ImmediatePredecessors() const noexcept;
+ /// Intrusively store the host definition of this instruction.
+ template <typename DefinitionType>
+ void SetDefinition(DefinitionType def) {
+ definition = Common::BitCast<u32>(def);
+ }
+
+ /// Return the intrusively stored host definition of this instruction.
+ template <typename DefinitionType>
+ [[nodiscard]] DefinitionType Definition() const noexcept {
+ return Common::BitCast<DefinitionType>(definition);
+ }
+
[[nodiscard]] Condition BranchCondition() const noexcept {
return branch_cond;
}
@@ -161,6 +174,9 @@ private:
Block* branch_false{nullptr};
/// Block immediate predecessors
std::vector<Block*> imm_predecessors;
+
+ /// Intrusively stored host definition of this block.
+ u32 definition{};
};
using BlockList = std::vector<Block*>;