mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
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
This commit is contained in:
parent
fe2a012338
commit
4d6d5783d8
@ -216,8 +216,11 @@ void Link(DominatorTreeBase<typename GraphT::NodeType>& DT,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class NodeT, class GraphT>
|
template<class FuncT, class NodeT>
|
||||||
void Calculate(DominatorTreeBase<typename GraphT::NodeType>& DT, Function& F) {
|
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
|
// Step #1: Number blocks in depth-first order and initialize variables used
|
||||||
// in later stages of the algorithm.
|
// in later stages of the algorithm.
|
||||||
unsigned N = 0;
|
unsigned N = 0;
|
||||||
|
@ -162,9 +162,9 @@ typedef DomTreeNodeBase<MachineBasicBlock> MachineDomTreeNode;
|
|||||||
/// DominatorTree - Calculate the immediate dominator tree for a function.
|
/// DominatorTree - Calculate the immediate dominator tree for a function.
|
||||||
///
|
///
|
||||||
|
|
||||||
template<class N, class GraphT>
|
template<class FuncT, class N>
|
||||||
void Calculate(DominatorTreeBase<typename GraphT::NodeType>& DT,
|
void Calculate(DominatorTreeBase<typename GraphTraits<N>::NodeType>& DT,
|
||||||
Function& F);
|
FuncT& F);
|
||||||
|
|
||||||
template<class NodeT>
|
template<class NodeT>
|
||||||
class DominatorTreeBase : public DominatorBase<NodeT> {
|
class DominatorTreeBase : public DominatorBase<NodeT> {
|
||||||
@ -545,9 +545,9 @@ protected:
|
|||||||
typename GraphT::NodeType* V,
|
typename GraphT::NodeType* V,
|
||||||
unsigned N);
|
unsigned N);
|
||||||
|
|
||||||
template<class N, class GraphT>
|
template<class FuncT, class N>
|
||||||
friend void Calculate(DominatorTreeBase<typename GraphT::NodeType>& DT,
|
friend void Calculate(DominatorTreeBase<typename GraphTraits<N>::NodeType>& DT,
|
||||||
Function& F);
|
FuncT& F);
|
||||||
|
|
||||||
/// updateDFSNumbers - Assign In and Out numbers to the nodes while walking
|
/// updateDFSNumbers - Assign In and Out numbers to the nodes while walking
|
||||||
/// dominator tree in dfs order.
|
/// dominator tree in dfs order.
|
||||||
@ -609,7 +609,8 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// recalculate - compute a dominator tree for the given function
|
/// recalculate - compute a dominator tree for the given function
|
||||||
void recalculate(Function& F) {
|
template<class FT>
|
||||||
|
void recalculate(FT& F) {
|
||||||
if (!this->IsPostDominators) {
|
if (!this->IsPostDominators) {
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
@ -619,7 +620,7 @@ public:
|
|||||||
this->DomTreeNodes[&F.getEntryBlock()] = 0;
|
this->DomTreeNodes[&F.getEntryBlock()] = 0;
|
||||||
this->Vertex.push_back(0);
|
this->Vertex.push_back(0);
|
||||||
|
|
||||||
Calculate<NodeT*, GraphTraits<NodeT*> >(*this, F);
|
Calculate<FT, NodeT*>(*this, F);
|
||||||
|
|
||||||
updateDFSNumbers();
|
updateDFSNumbers();
|
||||||
} else {
|
} else {
|
||||||
@ -641,7 +642,7 @@ public:
|
|||||||
|
|
||||||
this->Vertex.push_back(0);
|
this->Vertex.push_back(0);
|
||||||
|
|
||||||
Calculate<Inverse<NodeT*>, GraphTraits<Inverse<NodeT*> > >(*this, F);
|
Calculate<FT, Inverse<NodeT*> >(*this, F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user