aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-07-18 16:13:52 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-07-18 16:13:52 +0000
commitc44e9bfa5cbac3f56ebfc2e74d19c75bb36de8b6 (patch)
treed2798d6b40355cb77a445dc1a27685ce34a6033a /lib/Analysis/DataStructure/BottomUpClosure.cpp
parent6aa0d62cb9da446068bba1d65c894c970421b533 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index ed468e3143..841dd50f43 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -89,6 +89,9 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
// Copy the local version into DSInfo...
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...
std::vector<std::vector<DSNodeHandle> > &FCs = Graph->getFunctionCalls();
@@ -129,7 +132,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
} else if (!FI.isExternal()) {
DEBUG(std::cerr << "In " << F.getName() << " inlining: "
<< FI.getName() << "\n");
-
+
// Get the data structure graph for the called function, closing it
// if possible (which is only impossible in the case of mutual
// recursion...
@@ -139,15 +142,19 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
DEBUG(cerr << "Got graph for " << FI.getName() << " in: "
<< 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 called function's graph into the current graph, keeping
- // track of where scalars in the old graph _used_ to point...
- map<Value*, DSNodeHandle> OldValMap;
+ // Clone the callee's graph into the current graph, keeping
+ // track of where scalars in the old graph _used_ to point
+ // and of the new nodes matching nodes of the old graph ...
+ std::map<Value*, DSNodeHandle> OldValMap;
+ std::map<const DSNode*, DSNode*> OldNodeMap; // unused
// The clone call may invalidate any of the vectors in the data
// structure graph.
- DSNode *RetVal = Graph->cloneInto(GI, OldValMap);
+ DSNode *RetVal = Graph->cloneInto(GI, OldValMap, OldNodeMap);
ResolveArguments(Call, FI, OldValMap);