[llvm-commits] [llvm] r43321 - in /llvm/trunk/include/llvm/Analysis: DominatorInternals.h Dominators.h

Owen Anderson resistor at mac.com
Wed Oct 24 17:16:57 PDT 2007


Author: resistor
Date: Wed Oct 24 19:16:57 2007
New Revision: 43321

URL: http://llvm.org/viewvc/llvm-project?rev=43321&view=rev
Log:
Make it possible for DomTreeBase to be constructed from MachineFunction's as well as just Function's.

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

Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=43321&r1=43320&r2=43321&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Wed Oct 24 19:16:57 2007
@@ -216,8 +216,11 @@
 #endif
 }
 
-template<class NodeT, class GraphT>
-void Calculate(DominatorTreeBase<typename GraphT::NodeType>& DT, Function& F) {
+template<class FuncT, class NodeT>
+void Calculate(DominatorTreeBase<typename GraphTraits<NodeT>::NodeType>& DT,
+               FuncT& F) {
+  typedef GraphTraits<NodeT> GraphT;
+  
   // Step #1: Number blocks in depth-first order and initialize variables used
   // in later stages of the algorithm.
   unsigned N = 0;

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

==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Wed Oct 24 19:16:57 2007
@@ -162,9 +162,9 @@
 /// DominatorTree - Calculate the immediate dominator tree for a function.
 ///
 
-template<class N, class GraphT>
-void Calculate(DominatorTreeBase<typename GraphT::NodeType>& DT,
-               Function& F);
+template<class FuncT, class N>
+void Calculate(DominatorTreeBase<typename GraphTraits<N>::NodeType>& DT,
+               FuncT& F);
 
 template<class NodeT>
 class DominatorTreeBase : public DominatorBase<NodeT> {
@@ -545,9 +545,9 @@
                           typename GraphT::NodeType* V,
                           unsigned N);
   
-  template<class N, class GraphT>
-  friend void Calculate(DominatorTreeBase<typename GraphT::NodeType>& DT,
-                        Function& F);
+  template<class FuncT, class N>
+  friend void Calculate(DominatorTreeBase<typename GraphTraits<N>::NodeType>& DT,
+                        FuncT& F);
   
   /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking
   /// dominator tree in dfs order.
@@ -609,7 +609,8 @@
   
 public:
   /// recalculate - compute a dominator tree for the given function
-  void recalculate(Function& F) {
+  template<class FT>
+  void recalculate(FT& F) {
     if (!this->IsPostDominators) {
       reset();
       
@@ -619,7 +620,7 @@
       this->DomTreeNodes[&F.getEntryBlock()] = 0;
       this->Vertex.push_back(0);
       
-      Calculate<NodeT*, GraphTraits<NodeT*> >(*this, F);
+      Calculate<FT, NodeT*>(*this, F);
       
       updateDFSNumbers();
     } else {
@@ -641,7 +642,7 @@
 
       this->Vertex.push_back(0);
       
-      Calculate<Inverse<NodeT*>, GraphTraits<Inverse<NodeT*> > >(*this, F);
+      Calculate<FT, Inverse<NodeT*> >(*this, F);
     }
   }
 };





More information about the llvm-commits mailing list