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 | ef41b910e52fe2386bcf3bec181c53e30f61bf59 (patch) | |
| tree | 7591ab5f7d5167189cf9147b038eeb5f8b1fef9d | |
| parent | 6f1b2749760d2374172c3d24730f2f3a630cb9ef (diff) | |
| download | bcm5719-llvm-ef41b910e52fe2386bcf3bec181c53e30f61bf59.tar.gz bcm5719-llvm-ef41b910e52fe2386bcf3bec181c53e30f61bf59.zip | |
Add GraphTraits specializations for machine dominators.
llvm-svn: 45333
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineDominators.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineDominators.h b/llvm/include/llvm/CodeGen/MachineDominators.h index bddc5c27969..44bbaa0fbe6 100644 --- a/llvm/include/llvm/CodeGen/MachineDominators.h +++ b/llvm/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 |

