diff options
author | Owen Anderson <resistor@mac.com> | 2007-10-25 00:16:57 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-10-25 00:16:57 +0000 |
commit | 4d6d5783d8f803a9ae1ad64b16643f7ddeacbc1b (patch) | |
tree | e3facdec87f920e82f8298e46c0e5a2b7b8de14b /include | |
parent | fe2a0123389adf0f2f66c413570d2daabdb5539d (diff) | |
download | external_llvm-4d6d5783d8f803a9ae1ad64b16643f7ddeacbc1b.zip external_llvm-4d6d5783d8f803a9ae1ad64b16643f7ddeacbc1b.tar.gz external_llvm-4d6d5783d8f803a9ae1ad64b16643f7ddeacbc1b.tar.bz2 |
Make it possible for DomTreeBase to be constructed from MachineFunction's as well as just Function's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/DominatorInternals.h | 7 | ||||
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 19 |
2 files changed, 15 insertions, 11 deletions
diff --git a/include/llvm/Analysis/DominatorInternals.h b/include/llvm/Analysis/DominatorInternals.h index 3486b77..c3f81e6 100644 --- a/include/llvm/Analysis/DominatorInternals.h +++ b/include/llvm/Analysis/DominatorInternals.h @@ -216,8 +216,11 @@ void Link(DominatorTreeBase<typename GraphT::NodeType>& DT, #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; diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 7e7f1a7..40c733d 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -162,9 +162,9 @@ typedef DomTreeNodeBase<MachineBasicBlock> MachineDomTreeNode; /// 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 @@ protected: 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 @@ protected: 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 @@ public: 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 @@ public: this->Vertex.push_back(0); - Calculate<Inverse<NodeT*>, GraphTraits<Inverse<NodeT*> > >(*this, F); + Calculate<FT, Inverse<NodeT*> >(*this, F); } } }; |