aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/TopDownClosure.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-10-20 21:41:02 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-10-20 21:41:02 +0000
commit26b98265b7edb493e220822e7967c0eb15d52fa6 (patch)
tree7c1d487f863f2b39b5883224dab372f3be53191c /lib/Analysis/DataStructure/TopDownClosure.cpp
parente80fe61a72b974c423f0754990d81eb607891c46 (diff)
Remove spurious caller pointer in DSCallSite.
Also add functions to access pointer argument nodes cleanly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/TopDownClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index 1ceaedbe60..f4b7017b2e 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -53,14 +53,14 @@ void TDDataStructures::ResolveCallSite(DSGraph &Graph,
Function &F = Graph.getFunction();
Function::aiterator AI = F.abegin();
- for (unsigned i = 2, e = CallSite.size(); i != e; ++i, ++AI) {
+ for (unsigned i = 0, e = CallSite.getNumPtrArgs(); i != e; ++i, ++AI) {
// Advance the argument iterator to the first pointer argument...
while (!DataStructureAnalysis::isPointerType(AI->getType())) ++AI;
// TD ...Merge the formal arg scalar with the actual arg node
DSNodeHandle &NodeForFormal = Graph.getNodeForValue(AI);
if (NodeForFormal.getNode())
- NodeForFormal.mergeWith(CallSite[i]);
+ NodeForFormal.mergeWith(CallSite.getPtrArgNode(i));
}
// Merge returned node in the caller with the "return" node in callee
@@ -68,6 +68,13 @@ void TDDataStructures::ResolveCallSite(DSGraph &Graph,
Graph.getRetNode().mergeWith(CallSite.getReturnValueNode());
}
+
+static DSNodeHandle copyHelper(const DSNodeHandle* fromNode,
+ std::map<const DSNode*, DSNode*> *NodeMap) {
+ return DSNodeHandle((*NodeMap)[fromNode->getNode()], fromNode->getOffset());
+}
+
+
DSGraph &TDDataStructures::calculateGraph(Function &F) {
// Make sure this graph has not already been calculated, or that we don't get
// into an infinite loop with mutually recursive functions.
@@ -128,12 +135,8 @@ DSGraph &TDDataStructures::calculateGraph(Function &F) {
// Make a temporary copy of the call site, and transform the argument node
// pointers.
- DSCallSite TmpCallSite = CallSite;
- for (unsigned i = 0, e = CallSite.size(); i != e; ++i) {
- const DSNode *OldNode = TmpCallSite[i].getNode();
- TmpCallSite[i].setNode(OldNodeMap[OldNode]);
- }
-
+ DSCallSite TmpCallSite(CallSite, std::bind2nd(std::ptr_fun(&copyHelper),
+ &OldNodeMap));
ResolveCallSite(*Graph, CallSite);
}
}