diff options
author | Owen Anderson <resistor@mac.com> | 2007-12-23 15:16:46 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-12-23 15:16:46 +0000 |
commit | 96fa396039d12a0418f0e728e482ce64290bcb14 (patch) | |
tree | 47114f35c126f7b5cad2313bb93377835c75b039 /include/llvm/CodeGen/MachineDominators.h | |
parent | 74f4dedefb1cd19ecf3df5c65d6b6b36b0ec34f5 (diff) |
Add GraphTraits specializations for machine dominators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineDominators.h')
-rw-r--r-- | include/llvm/CodeGen/MachineDominators.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h index bddc5c2796..44bbaa0fbe 100644 --- a/include/llvm/CodeGen/MachineDominators.h +++ b/include/llvm/CodeGen/MachineDominators.h @@ -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 |