From: Chris Lattner Date: Tue, 9 Mar 2004 19:37:06 +0000 (+0000) Subject: implement new method X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=85fb1be62f89ee28941a8078b91681f01bd9159d;p=oota-llvm.git implement new method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12264 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 242185456fb..34c8089710c 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -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 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