[llvm-commits] [poolalloc] r124336 - /poolalloc/trunk/lib/DSA/CallTargets.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Wed Jan 26 15:37:02 PST 2011
Author: aggarwa4
Date: Wed Jan 26 17:37:02 2011
New Revision: 124336
URL: http://llvm.org/viewvc/llvm-project?rev=124336&view=rev
Log:
Use DSCallGraph to get the call targets.
Modified:
poolalloc/trunk/lib/DSA/CallTargets.cpp
Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=124336&r1=124335&r2=124336&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/CallTargets.cpp (original)
+++ poolalloc/trunk/lib/DSA/CallTargets.cpp Wed Jan 26 17:37:02 2011
@@ -43,6 +43,9 @@
void CallTargetFinder::findIndTargets(Module &M)
{
EQTDDataStructures* T = &getAnalysis<EQTDDataStructures>();
+ const DSCallGraph & callgraph = T->getCallGraph();
+ DSGraph* G = T->getGlobalsGraph();
+ DSGraph::ScalarMapTy& SM = G->getScalarMap();
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isDeclaration())
for (Function::iterator F = I->begin(), FE = I->end(); F != FE; ++F)
@@ -67,10 +70,37 @@
CompleteSites.insert(cs);
} else {
IndCall++;
+
+ DSCallGraph::callee_iterator csi = callgraph.callee_begin(cs),
+ cse = callgraph.callee_end(cs);
+ while(csi != cse) {
+ const Function *F = *csi;
+ DSCallGraph::scc_iterator sccii = callgraph.scc_begin(F),
+ sccee = callgraph.scc_end(F);
+ for(;sccii != sccee; ++sccii) {
+ DSGraph::ScalarMapTy::const_iterator I = SM.find(SM.getLeaderForGlobal(*sccii));
+ if (I != SM.end()) {
+ IndMap[cs].push_back (*sccii);
+ }
+ }
+ ++csi;
+ }
+ const Function *F1 = (cs).getInstruction()->getParent()->getParent();
+ F1 = callgraph.sccLeader(&*F1);
+
+ DSCallGraph::scc_iterator sccii = callgraph.scc_begin(F1),
+ sccee = callgraph.scc_end(F1);
+ for(;sccii != sccee; ++sccii) {
+ DSGraph::ScalarMapTy::const_iterator I = SM.find(SM.getLeaderForGlobal(*sccii));
+ if (I != SM.end()) {
+ IndMap[cs].push_back (*sccii);
+ }
+ }
+
DSNode* N = T->getDSGraph(*cs.getCaller())
->getNodeForValue(cs.getCalledValue()).getNode();
assert (N && "CallTarget: findIndTargets: No DSNode!\n");
- N->addFullFunctionList(IndMap[cs]);
+
if (N->isCompleteNode() && IndMap[cs].size()) {
CompleteSites.insert(cs);
++CompleteInd;
More information about the llvm-commits
mailing list