[llvm-commits] CVS: llvm/include/llvm/Analysis/Interval.h

Chris Lattner lattner at cs.uiuc.edu
Wed Oct 1 17:29:08 PDT 2003


Changes in directory llvm/include/llvm/Analysis:

Interval.h updated: 1.13 -> 1.14

---
Log message:

Add graph traits specializations for intervals


---
Diffs of the changes:

Index: llvm/include/llvm/Analysis/Interval.h
diff -u llvm/include/llvm/Analysis/Interval.h:1.13 llvm/include/llvm/Analysis/Interval.h:1.14
--- llvm/include/llvm/Analysis/Interval.h:1.13	Tue Sep 30 13:37:40 2003
+++ llvm/include/llvm/Analysis/Interval.h	Wed Oct  1 17:27:36 2003
@@ -13,6 +13,7 @@
 #ifndef LLVM_INTERVAL_H
 #define LLVM_INTERVAL_H
 
+#include "Support/GraphTraits.h"
 #include <vector>
 #include <iosfwd>
 
@@ -110,5 +111,32 @@
 inline Interval::pred_iterator pred_end(Interval *I)   {
   return I->Predecessors.end();
 }
+
+template <> struct GraphTraits<Interval*> {
+  typedef Interval NodeType;
+  typedef Interval::succ_iterator ChildIteratorType;
+
+  static NodeType *getEntryNode(Interval *I) { return I; }
+
+  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
+  static inline ChildIteratorType child_begin(NodeType *N) { 
+    return succ_begin(N);
+  }
+  static inline ChildIteratorType child_end(NodeType *N) { 
+    return succ_end(N);
+  }
+};
+
+template <> struct GraphTraits<Inverse<Interval*> > {
+  typedef Interval NodeType;
+  typedef Interval::pred_iterator ChildIteratorType;
+  static NodeType *getEntryNode(Inverse<Interval *> G) { return G.Graph; }
+  static inline ChildIteratorType child_begin(NodeType *N) { 
+    return pred_begin(N);
+  }
+  static inline ChildIteratorType child_end(NodeType *N) { 
+    return pred_end(N);
+  }
+};
 
 #endif





More information about the llvm-commits mailing list