summaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/Dominators.h
diff options
context:
space:
mode:
authorJoel Stanley <jstanley@cs.uiuc.edu>2002-10-16 23:26:00 +0000
committerJoel Stanley <jstanley@cs.uiuc.edu>2002-10-16 23:26:00 +0000
commit61315bc3676f7d01f4fa82c716327457f565f831 (patch)
treeffdcae970a0e03368c080a571267166773159162 /include/llvm/Analysis/Dominators.h
parentbda5fe124cfc84bb3288da899dc7b5db28bc055f (diff)
downloadexternal_llvm-61315bc3676f7d01f4fa82c716327457f565f831.zip
external_llvm-61315bc3676f7d01f4fa82c716327457f565f831.tar.gz
external_llvm-61315bc3676f7d01f4fa82c716327457f565f831.tar.bz2
Added partial specialization of GraphTraits for the DominatorTree class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
-rw-r--r--include/llvm/Analysis/Dominators.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 815be7d..3304ad3 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -19,6 +19,7 @@
#define LLVM_ANALYSIS_DOMINATORS_H
#include "llvm/Pass.h"
+#include "Support/GraphTraits.h"
#include <set>
class Instruction;
@@ -341,6 +342,24 @@ private:
void calculate(const DominatorSet &DS);
};
+//===-------------------------------------
+// DominatorTree GraphTraits specialization so the DominatorTree can be
+// iterable by generic graph iterators.
+
+template <> struct GraphTraits<DominatorTree*> {
+ typedef DominatorTree::Node NodeType;
+ typedef NodeType::iterator ChildIteratorType;
+
+ static NodeType *getEntryNode(DominatorTree *DT) {
+ return DT->getNode(DT->getRoot());
+ }
+ static inline ChildIteratorType child_begin(NodeType* N) {
+ return N->begin();
+ }
+ static inline ChildIteratorType child_end(NodeType* N) {
+ return N->end();
+ }
+};
//===----------------------------------------------------------------------===//
//