summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/microinstruction.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.h')
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h
index 7f1ed6710..61849695a 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.h
+++ b/src/shader_recompiler/frontend/ir/microinstruction.h
@@ -5,7 +5,9 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <cstring>
8#include <span> 9#include <span>
10#include <type_traits>
9#include <vector> 11#include <vector>
10 12
11#include <boost/intrusive/list.hpp> 13#include <boost/intrusive/list.hpp>
@@ -23,7 +25,7 @@ constexpr size_t MAX_ARG_COUNT = 4;
23 25
24class Inst : public boost::intrusive::list_base_hook<> { 26class Inst : public boost::intrusive::list_base_hook<> {
25public: 27public:
26 explicit Inst(Opcode op_) noexcept : op(op_) {} 28 explicit Inst(Opcode op_, u64 flags_) noexcept : op{op_}, flags{flags_} {}
27 29
28 /// Get the number of uses this instruction has. 30 /// Get the number of uses this instruction has.
29 [[nodiscard]] int UseCount() const noexcept { 31 [[nodiscard]] int UseCount() const noexcept {
@@ -73,6 +75,14 @@ public:
73 75
74 void ReplaceUsesWith(Value replacement); 76 void ReplaceUsesWith(Value replacement);
75 77
78 template <typename FlagsType>
79 requires(sizeof(FlagsType) <= sizeof(u64) && std::is_trivially_copyable_v<FlagsType>)
80 [[nodiscard]] FlagsType Flags() const noexcept {
81 FlagsType ret;
82 std::memcpy(&ret, &flags, sizeof(ret));
83 return ret;
84 }
85
76private: 86private:
77 void Use(const Value& value); 87 void Use(const Value& value);
78 void UndoUse(const Value& value); 88 void UndoUse(const Value& value);