mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Add support for a top-down propagation pass:
-- Save a copy of the original call nodes in DSGraph before inlining bottom-up. -- Also, save a list of the callers of each function in DSGraph. llvm-svn: 2966
This commit is contained in:
parent
a6647796e3
commit
9841c396cf
@ -89,6 +89,9 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
|
|||||||
// Copy the local version into DSInfo...
|
// Copy the local version into DSInfo...
|
||||||
Graph = new DSGraph(getAnalysis<LocalDataStructures>().getDSGraph(F));
|
Graph = new DSGraph(getAnalysis<LocalDataStructures>().getDSGraph(F));
|
||||||
|
|
||||||
|
// Save a copy of the original call nodes for the top-down pass
|
||||||
|
Graph->saveOrigFunctionCalls();
|
||||||
|
|
||||||
// Start resolving calls...
|
// Start resolving calls...
|
||||||
std::vector<std::vector<DSNodeHandle> > &FCs = Graph->getFunctionCalls();
|
std::vector<std::vector<DSNodeHandle> > &FCs = Graph->getFunctionCalls();
|
||||||
|
|
||||||
@ -129,7 +132,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
|
|||||||
} else if (!FI.isExternal()) {
|
} else if (!FI.isExternal()) {
|
||||||
DEBUG(std::cerr << "In " << F.getName() << " inlining: "
|
DEBUG(std::cerr << "In " << F.getName() << " inlining: "
|
||||||
<< FI.getName() << "\n");
|
<< FI.getName() << "\n");
|
||||||
|
|
||||||
// Get the data structure graph for the called function, closing it
|
// Get the data structure graph for the called function, closing it
|
||||||
// if possible (which is only impossible in the case of mutual
|
// if possible (which is only impossible in the case of mutual
|
||||||
// recursion...
|
// recursion...
|
||||||
@ -139,15 +142,19 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
|
|||||||
DEBUG(cerr << "Got graph for " << FI.getName() << " in: "
|
DEBUG(cerr << "Got graph for " << FI.getName() << " in: "
|
||||||
<< F.getName() << "\n");
|
<< F.getName() << "\n");
|
||||||
|
|
||||||
|
// Remember the callers for each callee for use in the top-down
|
||||||
|
// pass so we don't have to compute this again
|
||||||
|
GI.addCaller(F);
|
||||||
|
|
||||||
|
// Clone the callee's graph into the current graph, keeping
|
||||||
// Clone the called function's graph into the current graph, keeping
|
// track of where scalars in the old graph _used_ to point
|
||||||
// track of where scalars in the old graph _used_ to point...
|
// and of the new nodes matching nodes of the old graph ...
|
||||||
map<Value*, DSNodeHandle> OldValMap;
|
std::map<Value*, DSNodeHandle> OldValMap;
|
||||||
|
std::map<const DSNode*, DSNode*> OldNodeMap; // unused
|
||||||
|
|
||||||
// The clone call may invalidate any of the vectors in the data
|
// The clone call may invalidate any of the vectors in the data
|
||||||
// structure graph.
|
// structure graph.
|
||||||
DSNode *RetVal = Graph->cloneInto(GI, OldValMap);
|
DSNode *RetVal = Graph->cloneInto(GI, OldValMap, OldNodeMap);
|
||||||
|
|
||||||
ResolveArguments(Call, FI, OldValMap);
|
ResolveArguments(Call, FI, OldValMap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user