mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-18 06:38:41 +00:00
* Because of optimization, the shadow nodes between arguments might get
removed. Check to see if they are there. * Repeat optimizations while changing git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1997 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
26f8a40b51
commit
df8af1ca89
@ -218,12 +218,14 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) {
|
|||||||
if (CN->getNumArgs()) {
|
if (CN->getNumArgs()) {
|
||||||
// The ArgNodes of the incorporated graph should be the nodes starting at
|
// The ArgNodes of the incorporated graph should be the nodes starting at
|
||||||
// StartNode, ordered the same way as the call arguments. The arg nodes
|
// StartNode, ordered the same way as the call arguments. The arg nodes
|
||||||
// are seperated by a single shadow node, so we need to be sure to step
|
// are seperated by a single shadow node, but that shadow node might get
|
||||||
// over them.
|
// eliminated in the process of optimization.
|
||||||
//
|
//
|
||||||
unsigned ArgOffset = StartNode;
|
unsigned ArgOffset = StartNode;
|
||||||
for (unsigned i = 0, e = CN->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = CN->getNumArgs(); i != e; ++i) {
|
||||||
// Get the arg node of the incorporated method...
|
// Get the arg node of the incorporated method...
|
||||||
|
while (!isa<ArgDSNode>(Nodes[ArgOffset])) // Scan for next arg node
|
||||||
|
ArgOffset++;
|
||||||
ArgDSNode *ArgNode = cast<ArgDSNode>(Nodes[ArgOffset]);
|
ArgDSNode *ArgNode = cast<ArgDSNode>(Nodes[ArgOffset]);
|
||||||
|
|
||||||
// Now we make all of the nodes inside of the incorporated method point
|
// Now we make all of the nodes inside of the incorporated method point
|
||||||
@ -232,16 +234,12 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) {
|
|||||||
//
|
//
|
||||||
ResolveNodeTo(ArgNode, CN->getArgValues(i));
|
ResolveNodeTo(ArgNode, CN->getArgValues(i));
|
||||||
|
|
||||||
if (StartNode == 0) { // Self recursion?
|
if (StartNode) { // Not Self recursion?
|
||||||
ArgOffset += 2; // Skip over the argument & the shadow node...
|
|
||||||
} else {
|
|
||||||
// Remove the argnode from the set of nodes in this method...
|
// Remove the argnode from the set of nodes in this method...
|
||||||
Nodes.erase(Nodes.begin()+ArgOffset);
|
Nodes.erase(Nodes.begin()+ArgOffset);
|
||||||
|
|
||||||
// ArgNode is no longer useful, delete now!
|
// ArgNode is no longer useful, delete now!
|
||||||
delete ArgNode;
|
delete ArgNode;
|
||||||
|
|
||||||
ArgOffset++; // Skip over the shadow node for the argument
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,13 +247,16 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) {
|
|||||||
// Now the call node is completely destructable. Eliminate it now.
|
// Now the call node is completely destructable. Eliminate it now.
|
||||||
delete CN;
|
delete CN;
|
||||||
|
|
||||||
// Eliminate shadow nodes that are not distinguishable from some other
|
bool Changed = true;
|
||||||
// node in the graph...
|
while (Changed) {
|
||||||
//
|
// Eliminate shadow nodes that are not distinguishable from some other
|
||||||
UnlinkUndistinguishableShadowNodes();
|
// node in the graph...
|
||||||
|
//
|
||||||
|
Changed = UnlinkUndistinguishableShadowNodes();
|
||||||
|
|
||||||
// Eliminate shadow nodes that are now extraneous due to linking...
|
// Eliminate shadow nodes that are now extraneous due to linking...
|
||||||
RemoveUnreachableShadowNodes();
|
Changed |= RemoveUnreachableShadowNodes();
|
||||||
|
}
|
||||||
|
|
||||||
//if (F == Func) return; // Only do one self inlining
|
//if (F == Func) return; // Only do one self inlining
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user