summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/ir/microinstruction.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-02-15 02:46:40 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:22 +0200
commit1b0cf2309c760c1cb97a230a1572f8e87f84444a (patch)
tree6316825f65565b4c764b7851d061be0776a89974 /src/shader_recompiler/frontend/ir/microinstruction.h
parentshader: Support SSA loops on IR (diff)
downloadyuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.tar
yuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.tar.gz
yuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.tar.bz2
yuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.tar.lz
yuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.tar.xz
yuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.tar.zst
yuzu-1b0cf2309c760c1cb97a230a1572f8e87f84444a.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h
index ddf0f90a9..5b244fa0b 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.h
+++ b/src/shader_recompiler/frontend/ir/microinstruction.h
@@ -12,6 +12,7 @@
#include <boost/intrusive/list.hpp>
+#include "common/bit_cast.h"
#include "common/common_types.h"
#include "shader_recompiler/frontend/ir/opcodes.h"
#include "shader_recompiler/frontend/ir/type.h"
@@ -25,7 +26,7 @@ constexpr size_t MAX_ARG_COUNT = 4;
class Inst : public boost::intrusive::list_base_hook<> {
public:
- explicit Inst(Opcode op_, u64 flags_) noexcept;
+ explicit Inst(Opcode op_, u32 flags_) noexcept;
~Inst();
Inst& operator=(const Inst&) = delete;
@@ -86,13 +87,25 @@ public:
void ReplaceUsesWith(Value replacement);
template <typename FlagsType>
- requires(sizeof(FlagsType) <= sizeof(u64) && std::is_trivially_copyable_v<FlagsType>)
+ requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>)
[[nodiscard]] FlagsType Flags() const noexcept {
FlagsType ret;
std::memcpy(&ret, &flags, sizeof(ret));
return ret;
}
+ /// 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);
+ }
+
private:
struct NonTriviallyDummy {
NonTriviallyDummy() noexcept {}
@@ -103,7 +116,8 @@ private:
IR::Opcode op{};
int use_count{};
- u64 flags{};
+ u32 flags{};
+ u32 definition{};
union {
NonTriviallyDummy dummy{};
std::array<Value, MAX_ARG_COUNT> args;