[llvm-commits] [llvm] r43263 - in /llvm/trunk/include/llvm/Analysis: Dominators.h PostDominators.h

Owen Anderson resistor at mac.com
Tue Oct 23 14:42:49 PDT 2007


Author: resistor
Date: Tue Oct 23 16:42:49 2007
New Revision: 43263

URL: http://llvm.org/viewvc/llvm-project?rev=43263&view=rev
Log:
Make DomTreeBase not a FunctionPass.

Modified:
    llvm/trunk/include/llvm/Analysis/Dominators.h
    llvm/trunk/include/llvm/Analysis/PostDominators.h

Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43263&r1=43262&r2=43263&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Oct 23 16:42:49 2007
@@ -43,12 +43,12 @@
 /// inherit from.
 ///
 template <class NodeT>
-class DominatorBase : public FunctionPass {
+class DominatorBase {
 protected:
   std::vector<NodeT*> Roots;
   const bool IsPostDominators;
-  inline DominatorBase(intptr_t ID, bool isPostDom) : 
-    FunctionPass(ID), Roots(), IsPostDominators(isPostDom) {}
+  inline DominatorBase(bool isPostDom) : 
+    Roots(), IsPostDominators(isPostDom) {}
 public:
 
   /// getRoots -  Return the root blocks of the current CFG.  This may include
@@ -293,9 +293,9 @@
   }
 
 public:
-  DominatorTreeBase(intptr_t ID, bool isPostDom) 
-    : DominatorBase<NodeT>(ID, isPostDom), DFSInfoValid(false), SlowQueries(0) {}
-  ~DominatorTreeBase() { reset(); }
+  DominatorTreeBase(bool isPostDom) 
+    : DominatorBase<NodeT>(isPostDom), DFSInfoValid(false), SlowQueries(0) {}
+  virtual ~DominatorTreeBase() { reset(); }
 
   // FIXME: Should remove this
   virtual bool runOnFunction(Function &F) { return false; }
@@ -658,7 +658,7 @@
   DominatorTreeBase<BasicBlock>* DT;
   
   DominatorTree() : FunctionPass(intptr_t(&ID)) {
-    DT = new DominatorTreeBase<BasicBlock>(intptr_t(&ID), false);
+    DT = new DominatorTreeBase<BasicBlock>(false);
   }
   
   ~DominatorTree() {
@@ -817,15 +817,28 @@
 /// DominanceFrontierBase - Common base class for computing forward and inverse
 /// dominance frontiers for a function.
 ///
-class DominanceFrontierBase : public DominatorBase<BasicBlock> {
+class DominanceFrontierBase : public FunctionPass {
 public:
   typedef std::set<BasicBlock*>             DomSetType;    // Dom set for a bb
   typedef std::map<BasicBlock*, DomSetType> DomSetMapType; // Dom set map
 protected:
   DomSetMapType Frontiers;
+    std::vector<BasicBlock*> Roots;
+    const bool IsPostDominators;
+  
 public:
   DominanceFrontierBase(intptr_t ID, bool isPostDom) 
-    : DominatorBase<BasicBlock>(ID, isPostDom) {}
+    : FunctionPass(ID), IsPostDominators(isPostDom) {}
+
+  /// getRoots -  Return the root blocks of the current CFG.  This may include
+  /// multiple blocks if we are computing post dominators.  For forward
+  /// dominators, this will always be a single block (the entry node).
+  ///
+  inline const std::vector<BasicBlock*> &getRoots() const { return Roots; }
+  
+  /// isPostDominator - Returns true if analysis based of postdoms
+  ///
+  bool isPostDominator() const { return IsPostDominators; }
 
   virtual void releaseMemory() { Frontiers.clear(); }
 

Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=43263&r1=43262&r2=43263&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Tue Oct 23 16:42:49 2007
@@ -26,7 +26,7 @@
   DominatorTreeBase<BasicBlock>* DT;
 
   PostDominatorTree() : FunctionPass((intptr_t)&ID) {
-    DT = new DominatorTreeBase<BasicBlock>(intptr_t(&ID), true);
+    DT = new DominatorTreeBase<BasicBlock>(true);
   }
 
   virtual bool runOnFunction(Function &F);





More information about the llvm-commits mailing list