aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-01 01:42:26 +0000
committerChris Lattner <sabre@nondot.org>2004-03-01 01:42:26 +0000
commit99df2579103c1a9f7f93cd8115d29f2294a9010d (patch)
tree9226d9b30ac8a990fcf6a04fdd2edc74a1bac61e
parent9148ad309946e4c7b9d03a0259cbedb76727f64b (diff)
Fix the "partial pool allocator" on em3d and others. The problem is that
DSNodes, unlike other GraphTraits nodes, can have null outgoing edges, and df_iterator doesn't take this into consideration. As a workaround, the successor iterator now handles null nodes and 'indicates' that null has no successors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12025 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DSGraphTraits.h12
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraphTraits.h12
2 files changed, 16 insertions, 8 deletions
diff --git a/include/llvm/Analysis/DSGraphTraits.h b/include/llvm/Analysis/DSGraphTraits.h
index 72541b8cd1..017d86f0b5 100644
--- a/include/llvm/Analysis/DSGraphTraits.h
+++ b/include/llvm/Analysis/DSGraphTraits.h
@@ -33,10 +33,14 @@ class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> {
DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator
DSNodeIterator(NodeTy *N, bool) : Node(N) { // Create end iterator
- Offset = N->getNumLinks() << DS::PointerShift;
- if (Offset == 0 && Node->getForwardNode() &&
- Node->isDeadNode()) // Model Forward link
- Offset += DS::PointerSize;
+ if (N != 0) {
+ Offset = N->getNumLinks() << DS::PointerShift;
+ if (Offset == 0 && Node->getForwardNode() &&
+ Node->isDeadNode()) // Model Forward link
+ Offset += DS::PointerSize;
+ } else {
+ Offset = 0;
+ }
}
public:
DSNodeIterator(const DSNodeHandle &NH)
diff --git a/include/llvm/Analysis/DataStructure/DSGraphTraits.h b/include/llvm/Analysis/DataStructure/DSGraphTraits.h
index 72541b8cd1..017d86f0b5 100644
--- a/include/llvm/Analysis/DataStructure/DSGraphTraits.h
+++ b/include/llvm/Analysis/DataStructure/DSGraphTraits.h
@@ -33,10 +33,14 @@ class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> {
DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator
DSNodeIterator(NodeTy *N, bool) : Node(N) { // Create end iterator
- Offset = N->getNumLinks() << DS::PointerShift;
- if (Offset == 0 && Node->getForwardNode() &&
- Node->isDeadNode()) // Model Forward link
- Offset += DS::PointerSize;
+ if (N != 0) {
+ Offset = N->getNumLinks() << DS::PointerShift;
+ if (Offset == 0 && Node->getForwardNode() &&
+ Node->isDeadNode()) // Model Forward link
+ Offset += DS::PointerSize;
+ } else {
+ Offset = 0;
+ }
}
public:
DSNodeIterator(const DSNodeHandle &NH)