mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-23 12:26:56 +02:00
Inline common IR operands and share storage with Phi pairs
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "graphics/shader/recompiler/ir/Reg.h"
|
||||
#include "graphics/shader/recompiler/ir/opcodes/ValueOpcodes.h"
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
@@ -133,7 +134,6 @@ public:
|
||||
void SetArg(size_t index, Value value);
|
||||
void AddPhiOperand(Block* predecessor, Value value);
|
||||
void ReplaceUsesWith(Value replacement, bool preserve = true);
|
||||
void ReplaceOpcode(ValueOpcode opcode);
|
||||
void Invalidate();
|
||||
|
||||
template <typename T>
|
||||
@@ -156,13 +156,22 @@ private:
|
||||
void RemoveUse(Inst* used, size_t operand);
|
||||
void ClearArgs();
|
||||
|
||||
static constexpr uint8_t InlineArity = 4;
|
||||
static constexpr uint8_t PhiArity = UINT8_MAX;
|
||||
|
||||
ValueOpcode opcode;
|
||||
uint8_t num_args;
|
||||
mutable uint32_t evaluation_index = UINT32_MAX;
|
||||
uint64_t flags;
|
||||
Block* parent = nullptr;
|
||||
std::vector<Value> args;
|
||||
std::vector<Block*> phi_blocks;
|
||||
union {
|
||||
std::array<Value, InlineArity> fixed_args {};
|
||||
std::vector<Value> large_args;
|
||||
std::vector<std::pair<Block*, Value>> phi_args;
|
||||
};
|
||||
std::vector<Use> uses;
|
||||
};
|
||||
|
||||
static_assert(sizeof(Inst) <= 112, "Inst operand storage unintentionally increased");
|
||||
|
||||
} // namespace Libs::Graphics::ShaderRecompiler::IR
|
||||
|
||||
Reference in New Issue
Block a user