mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-18 13:34:04 +00:00
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
This commit is contained in:
parent
1d1e5b598e
commit
731b2d7df5
@ -276,22 +276,7 @@ inline DSNode *DSNodeHandle::getNode() const {
|
||||
if (!N || N->ForwardNH.isNull())
|
||||
return N;
|
||||
|
||||
// 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;
|
||||
return HandleForwarding();
|
||||
}
|
||||
|
||||
inline void DSNodeHandle::setNode(DSNode *n) {
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
inline DSNodeHandle &getLink(unsigned Num);
|
||||
|
||||
inline void setLink(unsigned Num, const DSNodeHandle &NH);
|
||||
private:
|
||||
DSNode *HandleForwarding() const;
|
||||
};
|
||||
|
||||
namespace std {
|
||||
|
@ -276,22 +276,7 @@ inline DSNode *DSNodeHandle::getNode() const {
|
||||
if (!N || N->ForwardNH.isNull())
|
||||
return N;
|
||||
|
||||
// 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;
|
||||
return HandleForwarding();
|
||||
}
|
||||
|
||||
inline void DSNodeHandle::setNode(DSNode *n) {
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
inline DSNodeHandle &getLink(unsigned Num);
|
||||
|
||||
inline void setLink(unsigned Num, const DSNodeHandle &NH);
|
||||
private:
|
||||
DSNode *HandleForwarding() const;
|
||||
};
|
||||
|
||||
namespace std {
|
||||
|
@ -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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
x
Reference in New Issue
Block a user