diff options
Diffstat (limited to 'include/llvm/CodeGen/MachineDominators.h')
-rw-r--r-- | include/llvm/CodeGen/MachineDominators.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h index 735dd069cf7f..a69936f6e267 100644 --- a/include/llvm/CodeGen/MachineDominators.h +++ b/include/llvm/CodeGen/MachineDominators.h @@ -246,21 +246,29 @@ public: /// iterable by generic graph iterators. /// -template<class T> struct GraphTraits; +template <class Node, class ChildIterator> +struct MachineDomTreeGraphTraitsBase { + typedef Node NodeType; + typedef ChildIterator ChildIteratorType; -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) { + 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(); - } + static inline ChildIteratorType child_end(NodeType *N) { return N->end(); } +}; + +template <class T> struct GraphTraits; + +template <> +struct GraphTraits<MachineDomTreeNode *> + : public MachineDomTreeGraphTraitsBase<MachineDomTreeNode, + MachineDomTreeNode::iterator> {}; + +template <> +struct GraphTraits<const MachineDomTreeNode *> + : public MachineDomTreeGraphTraitsBase<const MachineDomTreeNode, + MachineDomTreeNode::const_iterator> { }; template <> struct GraphTraits<MachineDominatorTree*> |