[llvm-commits] [poolalloc] r124964 - in /poolalloc/trunk: include/dsa/CallTargets.h lib/DSA/CallTargets.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Sat Feb 5 10:41:25 PST 2011
Author: aggarwa4
Date: Sat Feb 5 12:41:25 2011
New Revision: 124964
URL: http://llvm.org/viewvc/llvm-project?rev=124964&view=rev
Log:
Better handling of what is an indirect call. Ignore
cases which have a casted function being called.
Treat External nodes, as Incomplete nodes.
Modified:
poolalloc/trunk/include/dsa/CallTargets.h
poolalloc/trunk/lib/DSA/CallTargets.cpp
Modified: poolalloc/trunk/include/dsa/CallTargets.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/CallTargets.h?rev=124964&r1=124963&r2=124964&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/CallTargets.h (original)
+++ poolalloc/trunk/include/dsa/CallTargets.h Sat Feb 5 12:41:25 2011
@@ -43,6 +43,7 @@
// Given a CallSite, get an iterator of callees
std::vector<const Function*>::iterator begin(CallSite cs);
std::vector<const Function*>::iterator end(CallSite cs);
+ unsigned size(CallSite cs);
// Iterate over CallSites in program
std::list<CallSite>::iterator cs_begin();
Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=124964&r1=124963&r2=124964&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/CallTargets.cpp (original)
+++ poolalloc/trunk/lib/DSA/CallTargets.cpp Sat Feb 5 12:41:25 2011
@@ -63,8 +63,8 @@
if (!CF)
CF = dyn_cast<Function>(cs.getCalledValue()->stripPointerCasts());
- Value * calledValue = cs.getCalledValue()->stripPointerCasts();
if (!CF) {
+ Value * calledValue = cs.getCalledValue()->stripPointerCasts();
if (isa<ConstantPointerNull>(calledValue)) {
++DirCall;
CompleteSites.insert(cs);
@@ -101,14 +101,14 @@
->getNodeForValue(cs.getCalledValue()).getNode();
assert (N && "CallTarget: findIndTargets: No DSNode!\n");
- if (N->isCompleteNode() && IndMap[cs].size()) {
+ if (!N->isIncompleteNode() && !N->isExternalNode() && IndMap[cs].size()) {
CompleteSites.insert(cs);
++CompleteInd;
}
- if (N->isCompleteNode() && !IndMap[cs].size()) {
+ if (!N->isIncompleteNode() && !N->isExternalNode() && !IndMap[cs].size()) {
++CompleteEmpty;
DEBUG(errs() << "Call site empty: '"
- << cs.getInstruction()->getName()
+ << cs.getInstruction()->getName()
<< "' In '"
<< cs.getInstruction()->getParent()->getParent()->getName()
<< "'\n");
@@ -116,7 +116,7 @@
}
} else {
++DirCall;
- IndMap[cs].push_back(cs.getCalledFunction());
+ IndMap[cs].push_back(CF);
CompleteSites.insert(cs);
}
}
@@ -128,7 +128,11 @@
for (std::map<CallSite, std::vector<const Function*> >::const_iterator ii =
IndMap.begin(),
ee = IndMap.end(); ii != ee; ++ii) {
- if (!ii->first.getCalledFunction()) { //only print indirect
+
+ if (ii->first.getCalledFunction()) //only print indirect
+ continue;
+ if(isa<Function>(ii->first.getCalledValue()->stripPointerCasts()))
+ continue;
if (!isComplete(ii->first)) {
O << "* ";
CallSite cs = ii->first;
@@ -142,7 +146,6 @@
O << " " << (*i)->getNameStr();
}
O << "\n";
- }
}
}
@@ -163,6 +166,9 @@
std::vector<const Function*>::iterator CallTargetFinder::end(CallSite cs) {
return IndMap[cs].end();
}
+unsigned CallTargetFinder::size(CallSite cs) {
+ return IndMap[cs].size();
+}
bool CallTargetFinder::isComplete(CallSite cs) const {
return CompleteSites.find(cs) != CompleteSites.end();
More information about the llvm-commits
mailing list