aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-30 03:15:25 +0000
committerChris Lattner <sabre@nondot.org>2003-06-30 03:15:25 +0000
commit5a540633036ccd7482bd8e83913304a4ed3fc11c (patch)
treeb33e418ba8a67500feedda5e0e8dec2bcf7d299c /lib/Analysis/DataStructure/Local.cpp
parenta321b04d60e41d76d4d53a0e7afd4c2ea5c159ad (diff)
Revamp DSGraphs so that they can support multiple functions in the same
DSGraph at one time git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index a7751f23f7..2b81d1423c 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -62,25 +62,26 @@ namespace {
/// graph by performing a single pass over the function in question.
///
class GraphBuilder : InstVisitor<GraphBuilder> {
+ Function &F;
DSGraph &G;
std::vector<DSNode*> &Nodes;
DSNodeHandle &RetNode; // Node that gets returned...
- hash_map<Value*, DSNodeHandle> &ScalarMap;
+ DSGraph::ScalarMapTy &ScalarMap;
std::vector<DSCallSite> &FunctionCalls;
public:
- GraphBuilder(DSGraph &g, std::vector<DSNode*> &nodes, DSNodeHandle &retNode,
- hash_map<Value*, DSNodeHandle> &SM,
+ GraphBuilder(Function &f, DSGraph &g, std::vector<DSNode*> &nodes,
+ DSNodeHandle &retNode, DSGraph::ScalarMapTy &SM,
std::vector<DSCallSite> &fc)
- : G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM), FunctionCalls(fc) {
+ : F(f), G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM),
+ FunctionCalls(fc) {
// Create scalar nodes for all pointer arguments...
- for (Function::aiterator I = G.getFunction().abegin(),
- E = G.getFunction().aend(); I != E; ++I)
+ for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I)
if (isPointerType(I->getType()))
getValueDest(*I);
- visit(G.getFunction()); // Single pass over the function
+ visit(F); // Single pass over the function
}
private:
@@ -139,10 +140,10 @@ namespace {
//===----------------------------------------------------------------------===//
// DSGraph constructor - Simply use the GraphBuilder to construct the local
// graph.
-DSGraph::DSGraph(Function &F, DSGraph *GG) : Func(&F), GlobalsGraph(GG) {
+DSGraph::DSGraph(Function &F, DSGraph *GG) : GlobalsGraph(GG) {
PrintAuxCalls = false;
// Use the graph builder to construct the local version of the graph
- GraphBuilder B(*this, Nodes, RetNode, ScalarMap, FunctionCalls);
+ GraphBuilder B(F, *this, Nodes, ReturnNodes[&F], ScalarMap, FunctionCalls);
#ifndef NDEBUG
Timer::addPeakMemoryMeasurement();
#endif