[llvm-commits] CVS: llvm/include/Support/TarjanSCCIterator.h

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 31 14:52:15 PDT 2003


Changes in directory llvm/include/Support:

TarjanSCCIterator.h updated: 1.12 -> 1.13

---
Log message:

Move the HasLoop method from the SCC class to the iterator class


---
Diffs of the changes:

Index: llvm/include/Support/TarjanSCCIterator.h
diff -u llvm/include/Support/TarjanSCCIterator.h:1.12 llvm/include/Support/TarjanSCCIterator.h:1.13
--- llvm/include/Support/TarjanSCCIterator.h:1.12	Sun Aug 31 14:34:27 2003
+++ llvm/include/Support/TarjanSCCIterator.h	Sun Aug 31 14:51:22 2003
@@ -35,18 +35,6 @@
   typedef typename super::const_iterator         const_iterator;
   typedef typename super::reverse_iterator       reverse_iterator;
   typedef typename super::const_reverse_iterator const_reverse_iterator;
-
-  // HasLoop() -- Test if this SCC has a loop.  If it has more than one
-  // node, this is trivially true.  If not, it may still contain a loop
-  // if the node has an edge back to itself.
-  bool HasLoop() const {
-    if (size() > 1) return true;
-    NodeType* N = front();
-    for (ChildItTy CI = GT::child_begin(N), CE=GT::child_end(N); CI != CE; ++CI)
-      if (*CI == N)
-        return true;
-    return false;
-  }
 };
 
 //--------------------------------------------------------------------------
@@ -191,6 +179,19 @@
   inline SccTy &operator*() { 
     assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
     return CurrentSCC;
+  }
+
+  // hasLoop() -- Test if the current SCC has a loop.  If it has more than one
+  // node, this is trivially true.  If not, it may still contain a loop if the
+  // node has an edge back to itself.
+  bool hasLoop() const {
+    assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
+    if (CurrentSCC.size() > 1) return true;
+    NodeType *N = CurrentSCC.front();
+    for (ChildItTy CI = GT::child_begin(N), CE=GT::child_end(N); CI != CE; ++CI)
+      if (*CI == N)
+        return true;
+    return false;
   }
 };
 





More information about the llvm-commits mailing list