aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-09 03:20:43 +0000
committerChris Lattner <sabre@nondot.org>2005-02-09 03:20:43 +0000
commit6be079491f87c368b013cc9b76ad85bef9fe0694 (patch)
tree4baad6dde5a93150ef9f1bb7b22cbbef0c2ef8e1 /lib/Analysis/DataStructure/DataStructure.cpp
parent748ca4de2ca282be05cf99828fd6803cac422a20 (diff)
Use new edge iterators to simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 5c03b5ebe4..df5530c15d 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -1432,8 +1432,8 @@ static void markIncompleteNode(DSNode *N) {
N->setIncompleteMarker();
// Recursively process children...
- for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize)
- if (DSNode *DSN = N->getLink(i).getNode())
+ for (DSNode::edge_iterator I = N->edge_begin(),E = N->edge_end(); I != E; ++I)
+ if (DSNode *DSN = I->getNode())
markIncompleteNode(DSN);
}
@@ -1729,8 +1729,9 @@ void DSNode::markReachableNodes(hash_set<const DSNode*> &ReachableNodes) const {
if (this == 0) return;
assert(getForwardNode() == 0 && "Cannot mark a forwarded node!");
if (ReachableNodes.insert(this).second) // Is newly reachable?
- for (unsigned i = 0, e = getSize(); i < e; i += DS::PointerSize)
- getLink(i).getNode()->markReachableNodes(ReachableNodes);
+ for (DSNode::const_edge_iterator I = edge_begin(), E = edge_end();
+ I != E; ++I)
+ I->getNode()->markReachableNodes(ReachableNodes);
}
void DSCallSite::markReachableNodes(hash_set<const DSNode*> &Nodes) const {
@@ -1764,9 +1765,8 @@ static bool CanReachAliveNodes(DSNode *N, hash_set<const DSNode*> &Alive,
if (Visited.count(N)) return false; // Found a cycle
Visited.insert(N); // No recursion, insert into Visited...
- for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize)
- if (CanReachAliveNodes(N->getLink(i).getNode(), Alive, Visited,
- IgnoreGlobals)) {
+ for (DSNode::edge_iterator I = N->edge_begin(),E = N->edge_end(); I != E; ++I)
+ if (CanReachAliveNodes(I->getNode(), Alive, Visited, IgnoreGlobals)) {
N->markReachableNodes(Alive);
return true;
}