[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp

Owen Anderson resistor at mac.com
Sun Apr 8 14:30:33 PDT 2007



Changes in directory llvm/lib/VMCore:

Dominators.cpp updated: 1.88 -> 1.89
---
Log message:

Remove DomSet completely.  This concludes work on PR1171: http://llvm.org/PR1171 .


---
Diffs of the changes:  (+0 -96)

 Dominators.cpp |   96 ---------------------------------------------------------
 1 files changed, 96 deletions(-)


Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.88 llvm/lib/VMCore/Dominators.cpp:1.89
--- llvm/lib/VMCore/Dominators.cpp:1.88	Sat Apr  7 20:02:12 2007
+++ llvm/lib/VMCore/Dominators.cpp	Sun Apr  8 16:30:05 2007
@@ -251,89 +251,6 @@
   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 @@
 }
 }
 
-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 @@
   }
   o << "\n";
 }
-
-DEFINING_FILE_FOR(DominatorSet)






More information about the llvm-commits mailing list