forked from OSchip/llvm-project
parent
6662cbc510
commit
e396e9bbae
|
@ -109,6 +109,7 @@ public:
|
||||||
//
|
//
|
||||||
bool BUDataStructures::run(Module &M) {
|
bool BUDataStructures::run(Module &M) {
|
||||||
GlobalsGraph = new DSGraph();
|
GlobalsGraph = new DSGraph();
|
||||||
|
GlobalsGraph->setPrintAuxCalls();
|
||||||
|
|
||||||
Function *MainFunc = M.getMainFunction();
|
Function *MainFunc = M.getMainFunction();
|
||||||
if (MainFunc)
|
if (MainFunc)
|
||||||
|
@ -336,9 +337,10 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
|
||||||
DSGraph &GI = getDSGraph(*Callee); // Graph to inline
|
DSGraph &GI = getDSGraph(*Callee); // Graph to inline
|
||||||
|
|
||||||
DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
|
DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
|
||||||
<< " in: " << F.getName() << "[" << GI.getGraphSize() << "+"
|
<< "[" << GI.getGraphSize() << "+"
|
||||||
<< GI.getAuxFunctionCalls().size() << "]\n");
|
<< GI.getAuxFunctionCalls().size() << "] into: " << F.getName()
|
||||||
|
<< "[" << Graph.getGraphSize() << "+"
|
||||||
|
<< Graph.getAuxFunctionCalls().size() << "]\n");
|
||||||
#if 0
|
#if 0
|
||||||
Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_before_" +
|
Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_before_" +
|
||||||
Callee->getName());
|
Callee->getName());
|
||||||
|
@ -366,6 +368,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
|
||||||
// now that are complete, we must loop!
|
// now that are complete, we must loop!
|
||||||
Graph.maskIncompleteMarkers();
|
Graph.maskIncompleteMarkers();
|
||||||
Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
|
Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
|
||||||
|
// FIXME: materialize nodes from the globals graph as neccesary...
|
||||||
Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
|
Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
|
||||||
|
|
||||||
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
|
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
|
||||||
|
@ -422,8 +425,10 @@ DSGraph &BUDataStructures::inlineNonSCCGraphs(Function &F,
|
||||||
DSGraph &GI = getDSGraph(*Callee); // Graph to inline
|
DSGraph &GI = getDSGraph(*Callee); // Graph to inline
|
||||||
|
|
||||||
DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
|
DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
|
||||||
<< " in: " << F.getName() << "[" << GI.getGraphSize() << "+"
|
<< "[" << GI.getGraphSize() << "+"
|
||||||
<< GI.getAuxFunctionCalls().size() << "]\n");
|
<< GI.getAuxFunctionCalls().size() << "] into: " << F.getName()
|
||||||
|
<< "[" << Graph.getGraphSize() << "+"
|
||||||
|
<< Graph.getAuxFunctionCalls().size() << "]\n");
|
||||||
|
|
||||||
// Handle self recursion by resolving the arguments and return value
|
// Handle self recursion by resolving the arguments and return value
|
||||||
Graph.mergeInGraph(CS, GI,
|
Graph.mergeInGraph(CS, GI,
|
||||||
|
@ -447,7 +452,7 @@ DSGraph &BUDataStructures::inlineNonSCCGraphs(Function &F,
|
||||||
DEBUG(std::cerr << " [BU] Done Non-SCC inlining: " << F.getName() << " ["
|
DEBUG(std::cerr << " [BU] Done Non-SCC inlining: " << F.getName() << " ["
|
||||||
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
|
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
|
||||||
<< "]\n");
|
<< "]\n");
|
||||||
|
//Graph.writeGraphToFile(std::cerr, "nscc_" + F.getName());
|
||||||
return Graph;
|
return Graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,10 +510,11 @@ DSGraph &BUDataStructures::calculateSCCGraph(Function &F,
|
||||||
// Get the data structure graph for the called function.
|
// Get the data structure graph for the called function.
|
||||||
//
|
//
|
||||||
DSGraph &GI = getDSGraph(*Callee); // Graph to inline
|
DSGraph &GI = getDSGraph(*Callee); // Graph to inline
|
||||||
|
|
||||||
DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
|
DEBUG(std::cerr << " Inlining graph for " << Callee->getName()
|
||||||
<< " in: " << F.getName() << "[" << GI.getGraphSize() << "+"
|
<< "[" << GI.getGraphSize() << "+"
|
||||||
<< GI.getAuxFunctionCalls().size() << "]\n");
|
<< GI.getAuxFunctionCalls().size() << "] into: " << F.getName()
|
||||||
|
<< "[" << Graph.getGraphSize() << "+"
|
||||||
|
<< Graph.getAuxFunctionCalls().size() << "]\n");
|
||||||
|
|
||||||
// Handle self recursion by resolving the arguments and return value
|
// Handle self recursion by resolving the arguments and return value
|
||||||
Graph.mergeInGraph(CS, GI,
|
Graph.mergeInGraph(CS, GI,
|
||||||
|
@ -537,12 +543,14 @@ DSGraph &BUDataStructures::calculateSCCGraph(Function &F,
|
||||||
// now that are complete, we must loop!
|
// now that are complete, we must loop!
|
||||||
Graph.maskIncompleteMarkers();
|
Graph.maskIncompleteMarkers();
|
||||||
Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
|
Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
|
||||||
|
|
||||||
|
// FIXME: materialize nodes from the globals graph as neccesary...
|
||||||
|
|
||||||
Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
|
Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
|
||||||
|
|
||||||
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
|
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
|
||||||
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
|
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
|
||||||
<< "]\n");
|
<< "]\n");
|
||||||
//Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());
|
//Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());
|
||||||
|
|
||||||
return Graph;
|
return Graph;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue