implement new method
authorChris Lattner <sabre@nondot.org>
Tue, 9 Mar 2004 19:37:06 +0000 (19:37 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Mar 2004 19:37:06 +0000 (19:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12264 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructure.cpp

index 242185456fb73d78c0a8a1284ef3f81f82c6efa8..34c8089710ca141b93df7713c0e17e91f051acca 100644 (file)
@@ -1375,6 +1375,30 @@ DSCallSite DSGraph::getCallSiteForArguments(Function &F) const {
   return DSCallSite(CallSite(), getReturnNodeFor(F), &F, Args);
 }
 
+/// getDSCallSiteForCallSite - Given an LLVM CallSite object that is live in
+/// the context of this graph, return the DSCallSite for it.
+DSCallSite DSGraph::getDSCallSiteForCallSite(CallSite CS) const {
+  DSNodeHandle RetVal;
+  Instruction *I = CS.getInstruction();
+  if (isPointerType(I->getType()))
+    RetVal = getNodeForValue(I);
+
+  std::vector<DSNodeHandle> Args;
+  Args.reserve(CS.arg_end()-CS.arg_begin());
+
+  // Calculate the arguments vector...
+  for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I)
+    if (isPointerType((*I)->getType()))
+      Args.push_back(getNodeForValue(*I));
+
+  // Add a new function call entry...
+  if (Function *F = CS.getCalledFunction())
+    return DSCallSite(CS, RetVal, F, Args);
+  else
+    return DSCallSite(CS, RetVal,
+                      getNodeForValue(CS.getCalledValue()).getNode(), Args);
+}
+
 
 
 // markIncompleteNodes - Mark the specified node as having contents that are not