mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Add GraphTraits specializations for machine dominators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45333 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
74f4dedefb
commit
96fa396039
@ -21,6 +21,7 @@
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Analysis/DominatorInternals.h"
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user