diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-23 14:19:52 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-23 14:19:52 +0000 | 
| commit | 4a142eb28942073eb27a112b5ca1cca3f01beb9c (patch) | |
| tree | 22cc59e4b240d84c3a5a60531119c4eca914a256 /include/llvm/Analysis/Dominators.h | |
| parent | 5cd822fa9bbb9622241e3bf4d7674ed49ccde5b9 (diff) | |
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
| -rw-r--r-- | include/llvm/Analysis/Dominators.h | 27 | 
1 files changed, 23 insertions, 4 deletions
| diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index f63e31c36bab..59ce6e74b586 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -25,6 +25,7 @@  #include "llvm/Function.h"  #include "llvm/Instructions.h"  #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DepthFirstIterator.h"  #include "llvm/ADT/GraphTraits.h"  #include "llvm/ADT/SmallPtrSet.h"  #include "llvm/ADT/SmallVector.h" @@ -824,26 +825,44 @@ public:  /// DominatorTree GraphTraits specialization so the DominatorTree can be  /// iterable by generic graph iterators.  /// -template <> struct GraphTraits<DomTreeNode *> { +template <> struct GraphTraits<DomTreeNode*> {    typedef DomTreeNode NodeType;    typedef NodeType::iterator  ChildIteratorType;    static NodeType *getEntryNode(NodeType *N) {      return N;    } -  static inline ChildIteratorType child_begin(NodeType* N) { +  static inline ChildIteratorType child_begin(NodeType *N) {      return N->begin();    } -  static inline ChildIteratorType child_end(NodeType* N) { +  static inline ChildIteratorType child_end(NodeType *N) {      return N->end();    } + +  typedef df_iterator<DomTreeNode*> nodes_iterator; + +  static nodes_iterator nodes_begin(DomTreeNode *N) { +    return df_begin(getEntryNode(N)); +  } + +  static nodes_iterator nodes_end(DomTreeNode *N) { +    return df_end(getEntryNode(N)); +  }  };  template <> struct GraphTraits<DominatorTree*> -  : public GraphTraits<DomTreeNode *> { +  : public GraphTraits<DomTreeNode*> {    static NodeType *getEntryNode(DominatorTree *DT) {      return DT->getRootNode();    } + +  static nodes_iterator nodes_begin(DominatorTree *N) { +    return df_begin(getEntryNode(N)); +  } + +  static nodes_iterator nodes_end(DominatorTree *N) { +    return df_end(getEntryNode(N)); +  }  }; | 
