[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h PostDominators.h

Devang Patel dpatel at apple.com
Sun Jun 3 17:32:44 PDT 2007



Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.84 -> 1.85
PostDominators.h updated: 1.22 -> 1.23
---
Log message:

s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g


---
Diffs of the changes:  (+57 -53)

 Dominators.h     |  106 ++++++++++++++++++++++++++++---------------------------
 PostDominators.h |    4 +-
 2 files changed, 57 insertions(+), 53 deletions(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.84 llvm/include/llvm/Analysis/Dominators.h:1.85
--- llvm/include/llvm/Analysis/Dominators.h:1.84	Sun Jun  3 01:26:14 2007
+++ llvm/include/llvm/Analysis/Dominators.h	Sun Jun  3 19:32:21 2007
@@ -56,12 +56,61 @@
   bool isPostDominator() const { return IsPostDominators; }
 };
 
+
+//===----------------------------------------------------------------------===//
+// DomTreeNode - Dominator Tree Node
+
+class DomTreeNode {
+  friend class DominatorTree;
+  friend struct PostDominatorTree;
+  friend class DominatorTreeBase;
+  BasicBlock *TheBB;
+  DomTreeNode *IDom;
+  std::vector<DomTreeNode*> Children;
+public:
+  typedef std::vector<DomTreeNode*>::iterator iterator;
+  typedef std::vector<DomTreeNode*>::const_iterator const_iterator;
+  
+  iterator begin()             { return Children.begin(); }
+  iterator end()               { return Children.end(); }
+  const_iterator begin() const { return Children.begin(); }
+  const_iterator end()   const { return Children.end(); }
+  
+  inline BasicBlock *getBlock() const { return TheBB; }
+  inline DomTreeNode *getIDom() const { return IDom; }
+  inline const std::vector<DomTreeNode*> &getChildren() const { return Children; }
+  
+  /// properlyDominates - Returns true iff this dominates N and this != N.
+  /// Note that this is not a constant time operation!
+  ///
+  bool properlyDominates(const DomTreeNode *N) const {
+    const DomTreeNode *IDom;
+    if (this == 0 || N == 0) return false;
+    while ((IDom = N->getIDom()) != 0 && IDom != this)
+      N = IDom;   // Walk up the tree
+    return IDom != 0;
+  }
+  
+  /// dominates - Returns true iff this dominates N.  Note that this is not a
+  /// constant time operation!
+  ///
+  inline bool dominates(const DomTreeNode *N) const {
+    if (N == this) return true;  // A node trivially dominates itself.
+    return properlyDominates(N);
+  }
+  
+private:
+  inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {}
+  inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; }
+
+  void setIDom(DomTreeNode *NewIDom);
+};
+
 //===----------------------------------------------------------------------===//
 /// DominatorTree - Calculate the immediate dominator tree for a function.
 ///
 class DominatorTreeBase : public DominatorBase {
 public:
-  class DomTreeNode;
 protected:
   std::map<BasicBlock*, DomTreeNode*> DomTreeNodes;
   void reset();
@@ -88,52 +137,6 @@
   std::map<BasicBlock*, InfoRec> Info;
 
 public:
-  class DomTreeNode {
-    friend class DominatorTree;
-    friend struct PostDominatorTree;
-    friend class DominatorTreeBase;
-    BasicBlock *TheBB;
-    DomTreeNode *IDom;
-    std::vector<DomTreeNode*> Children;
-  public:
-    typedef std::vector<DomTreeNode*>::iterator iterator;
-    typedef std::vector<DomTreeNode*>::const_iterator const_iterator;
-
-    iterator begin()             { return Children.begin(); }
-    iterator end()               { return Children.end(); }
-    const_iterator begin() const { return Children.begin(); }
-    const_iterator end()   const { return Children.end(); }
-
-    inline BasicBlock *getBlock() const { return TheBB; }
-    inline DomTreeNode *getIDom() const { return IDom; }
-    inline const std::vector<DomTreeNode*> &getChildren() const { return Children; }
-
-    /// properlyDominates - Returns true iff this dominates N and this != N.
-    /// Note that this is not a constant time operation!
-    ///
-    bool properlyDominates(const DomTreeNode *N) const {
-      const DomTreeNode *IDom;
-      if (this == 0 || N == 0) return false;
-      while ((IDom = N->getIDom()) != 0 && IDom != this)
-        N = IDom;   // Walk up the tree
-      return IDom != 0;
-    }
-
-    /// dominates - Returns true iff this dominates N.  Note that this is not a
-    /// constant time operation!
-    ///
-    inline bool dominates(const DomTreeNode *N) const {
-      if (N == this) return true;  // A node trivially dominates itself.
-      return properlyDominates(N);
-    }
-    
-  private:
-    inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {}
-    inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; }
-
-    void setIDom(DomTreeNode *NewIDom);
-  };
-
 public:
   DominatorTreeBase(intptr_t ID, bool isPostDom) 
     : DominatorBase(ID, isPostDom) {}
@@ -238,8 +241,8 @@
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.
 ///
-template <> struct GraphTraits<DominatorTree::DomTreeNode*> {
-  typedef DominatorTree::DomTreeNode NodeType;
+template <> struct GraphTraits<DomTreeNode*> {
+  typedef DomTreeNode NodeType;
   typedef NodeType::iterator  ChildIteratorType;
   
   static NodeType *getEntryNode(NodeType *N) {
@@ -254,7 +257,7 @@
 };
 
 template <> struct GraphTraits<DominatorTree*>
-  : public GraphTraits<DominatorTree::DomTreeNode*> {
+  : public GraphTraits<DomTreeNode*> {
   static NodeType *getEntryNode(DominatorTree *DT) {
     return DT->getRootNode();
   }
@@ -501,9 +504,10 @@
     AU.setPreservesAll();
     AU.addRequired<DominatorTree>();
   }
+
 private:
   const DomSetType &calculate(const DominatorTree &DT,
-                              const DominatorTree::DomTreeNode *Node);
+                              const DomTreeNode *Node);
 };
 
 


Index: llvm/include/llvm/Analysis/PostDominators.h
diff -u llvm/include/llvm/Analysis/PostDominators.h:1.22 llvm/include/llvm/Analysis/PostDominators.h:1.23
--- llvm/include/llvm/Analysis/PostDominators.h:1.22	Sun Jun  3 01:26:14 2007
+++ llvm/include/llvm/Analysis/PostDominators.h	Sun Jun  3 19:32:21 2007
@@ -87,7 +87,7 @@
     Frontiers.clear();
     PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
     Roots = DT.getRoots();
-    if (const DominatorTree::DomTreeNode *Root = DT.getRootNode())
+    if (const DomTreeNode *Root = DT.getRootNode())
       calculate(DT, Root);
     return false;
   }
@@ -99,7 +99,7 @@
 
 private:
   const DomSetType &calculate(const PostDominatorTree &DT,
-                              const DominatorTree::DomTreeNode *Node);
+                              const DomTreeNode *Node);
 };
 
 } // End llvm namespace






More information about the llvm-commits mailing list