From a17866894a766bdb700581990237b1043694e3ae Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 13 Feb 2003 19:09:00 +0000 Subject: 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 llvm-svn: 5552 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp') diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index 80586de2f14..f2817623d22 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/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 //===----------------------------------------------------------------------===// -- cgit v1.2.3