mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 22:06:59 +01:00
Reuse SSA read traversal storage within each pass
This commit is contained in:
@@ -165,7 +165,6 @@ Value InitialValue(M0Tag) {
|
|||||||
|
|
||||||
enum class ReadStep { Start, SetValue, PushPhiArgument };
|
enum class ReadStep { Start, SetValue, PushPhiArgument };
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct ReadState {
|
struct ReadState {
|
||||||
Block* block = nullptr;
|
Block* block = nullptr;
|
||||||
Value result;
|
Value result;
|
||||||
@@ -183,7 +182,7 @@ public:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Value Read(T variable, Block* root) {
|
Value Read(T variable, Block* root) {
|
||||||
std::vector<ReadState<T>> stack {{}, {.block = root}};
|
stack.assign({{}, {.block = root}});
|
||||||
const auto prepare_phi = [&]() {
|
const auto prepare_phi = [&]() {
|
||||||
auto& state = stack.back();
|
auto& state = stack.back();
|
||||||
const auto predecessors = state.block->ImmPredecessors();
|
const auto predecessors = state.block->ImmPredecessors();
|
||||||
@@ -290,6 +289,7 @@ private:
|
|||||||
|
|
||||||
std::unordered_map<Block*, std::map<Variable, Inst*>> incomplete_phis;
|
std::unordered_map<Block*, std::map<Variable, Inst*>> incomplete_phis;
|
||||||
DefTable definitions;
|
DefTable definitions;
|
||||||
|
std::vector<ReadState> stack;
|
||||||
};
|
};
|
||||||
|
|
||||||
void VisitInstruction(Pass& pass, Block* block, Inst& inst) {
|
void VisitInstruction(Pass& pass, Block* block, Inst& inst) {
|
||||||
|
|||||||
Reference in New Issue
Block a user