diff options
author | Chris Lattner <sabre@nondot.org> | 2002-11-02 00:13:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-11-02 00:13:20 +0000 |
commit | 92673296e61a535bd3b1a88afdb4cb8fe05085f0 (patch) | |
tree | d44b83a91b8938d08554c82cc7804123eeb1e5f2 /lib/Analysis/DataStructure/BottomUpClosure.cpp | |
parent | 332043264ee52b171b9164ae9c454b9ebe9e9f04 (diff) |
Stop representing scalars as explicit nodes in the graph. Now the only
nodes in the graph are memory objects, which is very nice. This also greatly
reduces the size and memory footprint for DSGraphs. For example, the local
DSGraph for llu went from 65 to 13 nodes with this change. As a side bonus,
dot seems to lay out the graphs slightly better too. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/BottomUpClosure.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index defd80e308..08c86c5e12 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -16,8 +16,7 @@ using std::map; static RegisterAnalysis<BUDataStructures> X("budatastructure", "Bottom-up Data Structure Analysis Closure"); -// TODO: FIXME -namespace DataStructureAnalysis { +namespace DataStructureAnalysis { // TODO: FIXME: Eliminate // isPointerType - Return true if this first class type is big enough to hold // a pointer. // @@ -60,14 +59,12 @@ static void ResolveArguments(DSCallSite &Call, Function &F, map<Value*, DSNodeHandle> &ValueMap) { // Resolve all of the function arguments... Function::aiterator AI = F.abegin(); - for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i) { + for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i, ++AI) { // Advance the argument iterator to the first pointer argument... while (!isPointerType(AI->getType())) ++AI; // Add the link from the argument scalar to the provided value - DSNodeHandle &NN = ValueMap[AI]; - NN.addEdgeTo(Call.getPtrArg(i)); - ++AI; + ValueMap[AI].mergeWith(Call.getPtrArg(i)); } } @@ -118,8 +115,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { DEBUG(std::cerr << "\t[BU] Self Inlining: " << F.getName() << "\n"); // Handle the return value if present... - if (Call.getRetVal().getNode()) - Graph->getRetNode().mergeWith(Call.getRetVal()); + Graph->getRetNode().mergeWith(Call.getRetVal()); // Resolve the arguments in the call to the actual values... ResolveArguments(Call, F, Graph->getValueMap()); @@ -143,11 +139,12 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { // Record that the original DSCallSite was a call site of FI. // This may or may not have been known when the DSCallSite was // originally created. +#if 1 /// FIXME: Reenable std::vector<DSCallSite> &CallSitesForFunc = CallSites[&FI]; CallSitesForFunc.push_back(Call); CallSitesForFunc.back().setResolvingCaller(&F); CallSitesForFunc.back().setCallee(0); - +#endif // 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. @@ -163,8 +160,8 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { // Resolve the arguments in the call to the actual values... ResolveArguments(Call, FI, OldValMap); - if (Call.getRetVal().getNode())// Handle the return value if present - RetVal.mergeWith(Call.getRetVal()); + // Handle the return value if present... + RetVal.mergeWith(Call.getRetVal()); // Erase the entry in the Callees vector Callees.erase(Callees.begin()+c--); @@ -172,9 +169,10 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { } else if (FI.getName() == "printf" || FI.getName() == "sscanf" || FI.getName() == "fprintf" || FI.getName() == "open" || FI.getName() == "sprintf") { - // FIXME: These special cases should go away when we can define - // functions that take a variable number of arguments. + // FIXME: These special cases (eg printf) should go away when we can + // define functions that take a variable number of arguments. + // FIXME: at the very least, this should update mod/ref info // Erase the entry in the globals vector Callees.erase(Callees.begin()+c--); } |