implement new method

llvm-svn: 12264
This commit is contained in:
Chris Lattner 2004-03-09 19:37:06 +00:00
parent f53977cd42
commit b26b6fe9a7
1 changed files with 24 additions and 0 deletions

View 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