summaryrefslogtreecommitdiff
path: root/lib/VMCore/Dominators.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-04-08 21:30:05 +0000
committerOwen Anderson <resistor@mac.com>2007-04-08 21:30:05 +0000
commitcd4abb7e6da68510be8a843013fe15176f91ec49 (patch)
tree12d9222fee6c08d3875a31c038e8a474b2c03dec /lib/VMCore/Dominators.cpp
parent3a37b6b19c300658dd72a53667f3b46e1f3d99f2 (diff)
downloadllvm-cd4abb7e6da68510be8a843013fe15176f91ec49.tar.gz
llvm-cd4abb7e6da68510be8a843013fe15176f91ec49.tar.bz2
llvm-cd4abb7e6da68510be8a843013fe15176f91ec49.tar.xz
Remove DomSet completely. This concludes work on PR1171.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35775 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Dominators.cpp')
-rw-r--r--lib/VMCore/Dominators.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index b3e18e8e3e..3206ba2e51 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -251,89 +251,6 @@ void ImmediateDominatorsBase::print(std::ostream &o, const Module* ) const {
o << "\n";
}
-
-
-//===----------------------------------------------------------------------===//
-// DominatorSet Implementation
-//===----------------------------------------------------------------------===//
-
-static RegisterPass<DominatorSet>
-B("domset", "Dominator Set Construction", true);
-
-// dominates - Return true if A dominates B. This performs the special checks
-// necessary if A and B are in the same basic block.
-//
-bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const {
- BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
- if (BBA != BBB) return dominates(BBA, BBB);
-
- // It is not possible to determine dominance between two PHI nodes
- // based on their ordering.
- if (isa<PHINode>(A) && isa<PHINode>(B))
- return false;
-
- // Loop through the basic block until we find A or B.
- BasicBlock::iterator I = BBA->begin();
- for (; &*I != A && &*I != B; ++I) /*empty*/;
-
- if(!IsPostDominators) {
- // A dominates B if it is found first in the basic block.
- return &*I == A;
- } else {
- // A post-dominates B if B is found first in the basic block.
- return &*I == B;
- }
-}
-
-
-// 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>();
- Doms.clear();
- if (Roots.empty()) return false;
-
- // Root nodes only dominate themselves.
- for (unsigned i = 0, e = Roots.size(); i != e; ++i)
- Doms[Roots[i]].insert(Roots[i]);
-
- // Loop over all of the blocks in the function, calculating dominator sets for
- // each function.
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
- if (BasicBlock *IDom = ID[I]) { // Get idom if block is reachable
- DomSetType &DS = Doms[I];
- assert(DS.empty() && "Domset already filled in for this block?");
- DS.insert(I); // Blocks always dominate themselves
-
- // Insert all dominators into the set...
- while (IDom) {
- // If we have already computed the dominator sets for our immediate
- // dominator, just use it instead of walking all the way up to the root.
- DomSetType &IDS = Doms[IDom];
- if (!IDS.empty()) {
- DS.insert(IDS.begin(), IDS.end());
- break;
- } else {
- DS.insert(IDom);
- IDom = ID[IDom];
- }
- }
- } else {
- // Ensure that every basic block has at least an empty set of nodes. This
- // is important for the case when there is unreachable blocks.
- Doms[I];
- }
-
- return false;
-}
-
namespace llvm {
static std::ostream &operator<<(std::ostream &o,
const std::set<BasicBlock*> &BBs) {
@@ -347,17 +264,6 @@ static std::ostream &operator<<(std::ostream &o,
}
}
-void DominatorSetBase::print(std::ostream &o, const Module* ) const {
- for (const_iterator I = begin(), E = end(); I != E; ++I) {
- o << " DomSet For BB: ";
- if (I->first)
- WriteAsOperand(o, I->first, false);
- else
- o << " <<exit node>>";
- o << " is:\t" << I->second << "\n";
- }
-}
-
//===----------------------------------------------------------------------===//
// DominatorTree Implementation
//===----------------------------------------------------------------------===//
@@ -1072,5 +978,3 @@ void ETForestBase::print(std::ostream &o, const Module *) const {
}
o << "\n";
}
-
-DEFINING_FILE_FOR(DominatorSet)