@@ -25,7 +25,6 @@ void ssa::optimize(const std::unique_ptr<furlang::ir::function>& func) {
|
|||||||
block_map_t successors;
|
block_map_t successors;
|
||||||
|
|
||||||
std::unordered_map<furlang::ir::register_t, std::unordered_set<furlang::ir::block_index>> regSites;
|
std::unordered_map<furlang::ir::register_t, std::unordered_set<furlang::ir::block_index>> regSites;
|
||||||
std::unordered_map<furlang::ir::block_index, std::unordered_set<furlang::ir::register_t>> regUses;
|
|
||||||
|
|
||||||
std::unordered_map<furlang::ir::block_index, furlang::ir::block_index> idoms;
|
std::unordered_map<furlang::ir::block_index, furlang::ir::block_index> idoms;
|
||||||
|
|
||||||
@@ -42,11 +41,6 @@ void ssa::optimize(const std::unique_ptr<furlang::ir::function>& func) {
|
|||||||
regSites[instr->destination().reg()].insert(i);
|
regSites[instr->destination().reg()].insert(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const furlang::ir::operand* src : instr->sources()) {
|
|
||||||
if (src->type() != furlang::ir::operand_t::Register) continue;
|
|
||||||
regUses[i].insert(src->reg());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& exit = block->exit();
|
const auto& exit = block->exit();
|
||||||
@@ -161,8 +155,6 @@ void ssa::optimize(const std::unique_ptr<furlang::ir::function>& func) {
|
|||||||
const auto& preds = predecessors[i];
|
const auto& preds = predecessors[i];
|
||||||
|
|
||||||
for (auto reg : phis[i]) {
|
for (auto reg : phis[i]) {
|
||||||
if (regUses[i].find(reg) == regUses[i].end()) continue;
|
|
||||||
|
|
||||||
auto phiInstr = std::make_unique<furlang::ir::phi_instruction>(reg);
|
auto phiInstr = std::make_unique<furlang::ir::phi_instruction>(reg);
|
||||||
for (auto pred : preds) {
|
for (auto pred : preds) {
|
||||||
phiInstr->labels().emplace_back(furlang::ir::operand::new_reg(reg), pred);
|
phiInstr->labels().emplace_back(furlang::ir::operand::new_reg(reg), pred);
|
||||||
|
|||||||
Reference in New Issue
Block a user