[llvm-commits] CVS: llvm/include/llvm/Analysis/LoopInfo.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 27 21:06:01 PST 2003
Changes in directory llvm/include/llvm/Analysis:
LoopInfo.h updated: 1.23 -> 1.24
---
Log message:
Add graph traits specializations for loop nesting information...
---
Diffs of the changes:
Index: llvm/include/llvm/Analysis/LoopInfo.h
diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.23 llvm/include/llvm/Analysis/LoopInfo.h:1.24
--- llvm/include/llvm/Analysis/LoopInfo.h:1.23 Thu Feb 27 16:48:28 2003
+++ llvm/include/llvm/Analysis/LoopInfo.h Thu Feb 27 21:05:15 2003
@@ -19,6 +19,7 @@
#define LLVM_ANALYSIS_LOOP_INFO_H
#include "llvm/Pass.h"
+#include "Support/GraphTraits.h"
#include <set>
class DominatorSet;
@@ -185,5 +186,32 @@
// Make sure that any clients of this file link in LoopInfo.cpp
static IncludeFile
LOOP_INFO_INCLUDE_FILE((void*)&LoopInfo::stub);
+
+// Allow clients to walk the list of nested loops...
+template <> struct GraphTraits<const Loop*> {
+ typedef const Loop NodeType;
+ typedef std::vector<Loop*>::const_iterator ChildIteratorType;
+
+ static NodeType *getEntryNode(const Loop *L) { return L; }
+ static inline ChildIteratorType child_begin(NodeType *N) {
+ return N->getSubLoops().begin();
+ }
+ static inline ChildIteratorType child_end(NodeType *N) {
+ return N->getSubLoops().end();
+ }
+};
+
+template <> struct GraphTraits<Loop*> {
+ typedef Loop NodeType;
+ typedef std::vector<Loop*>::const_iterator ChildIteratorType;
+
+ static NodeType *getEntryNode(Loop *L) { return L; }
+ static inline ChildIteratorType child_begin(NodeType *N) {
+ return N->getSubLoops().begin();
+ }
+ static inline ChildIteratorType child_end(NodeType *N) {
+ return N->getSubLoops().end();
+ }
+};
#endif
More information about the llvm-commits
mailing list