mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-25 17:40:06 +00:00
shader: Intrusively store in a block if it's sealed or not
This commit is contained in:
parent
eed6da55b8
commit
23182fa59c
@ -107,6 +107,13 @@ public:
|
|||||||
return ssa_reg_values[RegIndex(reg)];
|
return ssa_reg_values[RegIndex(reg)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SsaSeal() noexcept {
|
||||||
|
is_ssa_sealed = true;
|
||||||
|
}
|
||||||
|
[[nodiscard]] bool IsSsaSealed() const noexcept {
|
||||||
|
return is_ssa_sealed;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool empty() const {
|
[[nodiscard]] bool empty() const {
|
||||||
return instructions.empty();
|
return instructions.empty();
|
||||||
}
|
}
|
||||||
@ -190,6 +197,8 @@ private:
|
|||||||
|
|
||||||
/// Intrusively store the value of a register in the block.
|
/// Intrusively store the value of a register in the block.
|
||||||
std::array<Value, NUM_REGS> ssa_reg_values;
|
std::array<Value, NUM_REGS> ssa_reg_values;
|
||||||
|
/// Intrusively store if the block is sealed in the SSA pass.
|
||||||
|
bool is_ssa_sealed{false};
|
||||||
|
|
||||||
/// Intrusively stored host definition of this block.
|
/// Intrusively stored host definition of this block.
|
||||||
u32 definition{};
|
u32 definition{};
|
||||||
|
@ -195,7 +195,7 @@ public:
|
|||||||
case Status::Start: {
|
case Status::Start: {
|
||||||
if (const IR::Value& def = current_def.Def(block, variable); !def.IsEmpty()) {
|
if (const IR::Value& def = current_def.Def(block, variable); !def.IsEmpty()) {
|
||||||
stack.back().result = def;
|
stack.back().result = def;
|
||||||
} else if (!sealed_blocks.contains(block)) {
|
} else if (!block->IsSsaSealed()) {
|
||||||
// Incomplete CFG
|
// Incomplete CFG
|
||||||
IR::Inst* phi{&*block->PrependNewInst(block->begin(), IR::Opcode::Phi)};
|
IR::Inst* phi{&*block->PrependNewInst(block->begin(), IR::Opcode::Phi)};
|
||||||
phi->SetFlags(IR::TypeOf(UndefOpcode(variable)));
|
phi->SetFlags(IR::TypeOf(UndefOpcode(variable)));
|
||||||
@ -251,7 +251,7 @@ public:
|
|||||||
std::visit([&](auto& variable) { AddPhiOperands(variable, *phi, block); }, variant);
|
std::visit([&](auto& variable) { AddPhiOperands(variable, *phi, block); }, variant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sealed_blocks.insert(block);
|
block->SsaSeal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -297,7 +297,6 @@ private:
|
|||||||
return same;
|
return same;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::container::flat_set<IR::Block*> sealed_blocks;
|
|
||||||
boost::container::flat_map<IR::Block*, boost::container::flat_map<Variant, IR::Inst*>>
|
boost::container::flat_map<IR::Block*, boost::container::flat_map<Variant, IR::Inst*>>
|
||||||
incomplete_phis;
|
incomplete_phis;
|
||||||
DefTable current_def;
|
DefTable current_def;
|
||||||
|
Loading…
Reference in New Issue
Block a user