mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
The recalclulate method was a nasty hack that was once used by the -cee pass,
which never worked itself. The cee pass still doesn't work, but it doesn't use this method anymore anyway, so eliminate the method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10302 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
16addf87bf
commit
eae45cf44b
@ -252,11 +252,6 @@ struct DominatorSet : public DominatorSetBase {
|
|||||||
|
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
/// recalculate - This method may be called by external passes that modify the
|
|
||||||
/// CFG and then need dominator information recalculated. This method is
|
|
||||||
/// obviously really slow, so it should be avoided if at all possible.
|
|
||||||
void recalculate();
|
|
||||||
|
|
||||||
BasicBlock *getRoot() const {
|
BasicBlock *getRoot() const {
|
||||||
assert(Roots.size() == 1 && "Should always have entry node!");
|
assert(Roots.size() == 1 && "Should always have entry node!");
|
||||||
return Roots[0];
|
return Roots[0];
|
||||||
|
@ -251,20 +251,27 @@ bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DominatorSet::recalculate() {
|
// runOnFunction - This method calculates the forward dominator sets for the
|
||||||
|
// specified function.
|
||||||
|
//
|
||||||
|
bool DominatorSet::runOnFunction(Function &F) {
|
||||||
|
BasicBlock *Root = &F.getEntryBlock();
|
||||||
|
Roots.clear();
|
||||||
|
Roots.push_back(Root);
|
||||||
|
assert(pred_begin(Root) == pred_end(Root) &&
|
||||||
|
"Root node has predecessors in function!");
|
||||||
|
|
||||||
ImmediateDominators &ID = getAnalysis<ImmediateDominators>();
|
ImmediateDominators &ID = getAnalysis<ImmediateDominators>();
|
||||||
Doms.clear();
|
Doms.clear();
|
||||||
if (Roots.empty()) return;
|
if (Roots.empty()) return false;
|
||||||
|
|
||||||
// Root nodes only dominate themselves.
|
// Root nodes only dominate themselves.
|
||||||
for (unsigned i = 0, e = Roots.size(); i != e; ++i)
|
for (unsigned i = 0, e = Roots.size(); i != e; ++i)
|
||||||
Doms[Roots[i]].insert(Roots[i]);
|
Doms[Roots[i]].insert(Roots[i]);
|
||||||
|
|
||||||
Function *F = Roots.back()->getParent();
|
|
||||||
|
|
||||||
// Loop over all of the blocks in the function, calculating dominator sets for
|
// Loop over all of the blocks in the function, calculating dominator sets for
|
||||||
// each function.
|
// each function.
|
||||||
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
|
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
||||||
if (BasicBlock *IDom = ID[I]) { // Get idom if block is reachable
|
if (BasicBlock *IDom = ID[I]) { // Get idom if block is reachable
|
||||||
DomSetType &DS = Doms[I];
|
DomSetType &DS = Doms[I];
|
||||||
assert(DS.empty() && "Domset already filled in for this block?");
|
assert(DS.empty() && "Domset already filled in for this block?");
|
||||||
@ -288,18 +295,7 @@ void DominatorSet::recalculate() {
|
|||||||
// is important for the case when there is unreachable blocks.
|
// is important for the case when there is unreachable blocks.
|
||||||
Doms[I];
|
Doms[I];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// runOnFunction - This method calculates the forward dominator sets for the
|
|
||||||
// specified function.
|
|
||||||
//
|
|
||||||
bool DominatorSet::runOnFunction(Function &F) {
|
|
||||||
BasicBlock *Root = &F.getEntryBlock();
|
|
||||||
Roots.clear();
|
|
||||||
Roots.push_back(Root);
|
|
||||||
assert(pred_begin(Root) == pred_end(Root) &&
|
|
||||||
"Root node has predecessors in function!");
|
|
||||||
recalculate();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user