summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-31 19:51:22 +0000
committerChris Lattner <sabre@nondot.org>2003-08-31 19:51:22 +0000
commit94d1092c6a385ff077fb28773d9ba3ad15cb9a8d (patch)
tree7a32c6709f25765798c6dfc0fd3cf316939d297b
parentfe8d8806f7cb3ddba1f4f77c53f728abd22eadc7 (diff)
downloadllvm-94d1092c6a385ff077fb28773d9ba3ad15cb9a8d.tar.gz
llvm-94d1092c6a385ff077fb28773d9ba3ad15cb9a8d.tar.bz2
llvm-94d1092c6a385ff077fb28773d9ba3ad15cb9a8d.tar.xz
Move the HasLoop method from the SCC class to the iterator class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8268 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/Support/SCCIterator.h25
-rw-r--r--include/llvm/ADT/SCCIterator.h25
2 files changed, 26 insertions, 24 deletions
diff --git a/include/Support/SCCIterator.h b/include/Support/SCCIterator.h
index bb78fb21c1..753dd55343 100644
--- a/include/Support/SCCIterator.h
+++ b/include/Support/SCCIterator.h
@@ -35,18 +35,6 @@ struct SCC : public std::vector<typename GT::NodeType*> {
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;
- }
};
//--------------------------------------------------------------------------
@@ -192,6 +180,19 @@ public:
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;
+ }
};
diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h
index bb78fb21c1..753dd55343 100644
--- a/include/llvm/ADT/SCCIterator.h
+++ b/include/llvm/ADT/SCCIterator.h
@@ -35,18 +35,6 @@ struct SCC : public std::vector<typename GT::NodeType*> {
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;
- }
};
//--------------------------------------------------------------------------
@@ -192,6 +180,19 @@ public:
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;
+ }
};