aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-13 19:09:00 +0000
committerChris Lattner <sabre@nondot.org>2003-02-13 19:09:00 +0000
commit731b2d7df57d4ca97e15b1136594f23055c083f7 (patch)
tree2afcbe0e1d25d37b1446eb40d9b5eabe4d318dae /lib/Analysis/DataStructure/DataStructure.cpp
parent1d1e5b598e760a8fefb1e484cbd052ab73076c59 (diff)
Move node forwarding code from being inlined to being out-of-line.
This brings a 11.6% speedup to steens, and a 3.6 overall speedup to ds-aa git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 80586de2f1..f2817623d2 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -24,6 +24,27 @@ namespace DS { // TODO: FIXME
}
using namespace DS;
+DSNode *DSNodeHandle::HandleForwarding() const {
+ assert(!N->ForwardNH.isNull() && "Can only be invoked if forwarding!");
+
+ // Handle node forwarding here!
+ DSNode *Next = N->ForwardNH.getNode(); // Cause recursive shrinkage
+ Offset += N->ForwardNH.getOffset();
+
+ if (--N->NumReferrers == 0) {
+ // Removing the last referrer to the node, sever the forwarding link
+ N->stopForwarding();
+ }
+
+ N = Next;
+ N->NumReferrers++;
+ if (N->Size <= Offset) {
+ assert(N->Size <= 1 && "Forwarded to shrunk but not collapsed node?");
+ Offset = 0;
+ }
+ return N;
+}
+
//===----------------------------------------------------------------------===//
// DSNode Implementation
//===----------------------------------------------------------------------===//