mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Eliminate self-recursion as a special case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19979 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -313,17 +313,10 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
|
|||||||
if (CalledFuncs.empty()) {
|
if (CalledFuncs.empty()) {
|
||||||
// Remember that we could not resolve this yet!
|
// Remember that we could not resolve this yet!
|
||||||
AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin());
|
AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin());
|
||||||
|
continue;
|
||||||
} else if (CalledFuncs.size() == 1) {
|
} else if (CalledFuncs.size() == 1) {
|
||||||
Function *Callee = *CalledFuncs.begin();
|
Function *Callee = *CalledFuncs.begin();
|
||||||
|
|
||||||
if (ReturnNodes.count(Callee)) {
|
|
||||||
// Self recursion... simply link up the formal arguments with the
|
|
||||||
// actual arguments.
|
|
||||||
DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n");
|
|
||||||
|
|
||||||
// Handle self recursion by resolving the arguments and return value
|
|
||||||
Graph.mergeInGraph(CS, *Callee, Graph, 0);
|
|
||||||
} else {
|
|
||||||
ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
|
ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
|
||||||
Callee));
|
Callee));
|
||||||
|
|
||||||
@ -345,9 +338,6 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
|
|||||||
Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
|
Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
|
||||||
Callee->getName());
|
Callee->getName());
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
TempFCs.erase(TempFCs.begin());
|
|
||||||
} else {
|
} else {
|
||||||
if (!Printed)
|
if (!Printed)
|
||||||
std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
|
std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
|
||||||
@ -366,14 +356,6 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
|
|||||||
for (std::set<Function*>::iterator I = CalledFuncs.begin(),
|
for (std::set<Function*>::iterator I = CalledFuncs.begin(),
|
||||||
E = CalledFuncs.end(); I != E; ++I) {
|
E = CalledFuncs.end(); I != E; ++I) {
|
||||||
Function *Callee = *I;
|
Function *Callee = *I;
|
||||||
if (ReturnNodes.count(Callee)) {
|
|
||||||
// Self recursion... simply link up the formal arguments with the
|
|
||||||
// actual arguments.
|
|
||||||
DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n");
|
|
||||||
|
|
||||||
// Handle self recursion by resolving the arguments and return value
|
|
||||||
Graph.mergeInGraph(CS, *Callee, Graph, 0);
|
|
||||||
} else {
|
|
||||||
ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
|
ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(),
|
||||||
Callee));
|
Callee));
|
||||||
|
|
||||||
@ -399,7 +381,6 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
|
|||||||
}
|
}
|
||||||
TempFCs.erase(TempFCs.begin());
|
TempFCs.erase(TempFCs.begin());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Recompute the Incomplete markers
|
// Recompute the Incomplete markers
|
||||||
assert(Graph.getInlinedGlobals().empty());
|
assert(Graph.getInlinedGlobals().empty());
|
||||||
|
Reference in New Issue
Block a user