Add GraphTraits specializations for machine dominators.
llvm-svn: 45333
This commit is contained in:
parent
6f1b274976
commit
ef41b910e5
|
@ -21,6 +21,7 @@
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Analysis/DominatorInternals.h"
|
#include "llvm/Analysis/DominatorInternals.h"
|
||||||
|
#include "llvm/ADT/GraphTraits.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
@ -182,6 +183,32 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//===-------------------------------------
|
||||||
|
/// DominatorTree GraphTraits specialization so the DominatorTree can be
|
||||||
|
/// iterable by generic graph iterators.
|
||||||
|
///
|
||||||
|
template <> struct GraphTraits<MachineDomTreeNode *> {
|
||||||
|
typedef MachineDomTreeNode NodeType;
|
||||||
|
typedef NodeType::iterator ChildIteratorType;
|
||||||
|
|
||||||
|
static NodeType *getEntryNode(NodeType *N) {
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
static inline ChildIteratorType child_begin(NodeType* N) {
|
||||||
|
return N->begin();
|
||||||
|
}
|
||||||
|
static inline ChildIteratorType child_end(NodeType* N) {
|
||||||
|
return N->end();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct GraphTraits<MachineDominatorTree*>
|
||||||
|
: public GraphTraits<MachineDomTreeNode *> {
|
||||||
|
static NodeType *getEntryNode(MachineDominatorTree *DT) {
|
||||||
|
return DT->getRootNode();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue