[llvm-commits] [poolalloc] r126708 - /poolalloc/trunk/lib/DSA/DataStructureStats.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Mon Feb 28 15:01:09 PST 2011
Author: aggarwa4
Date: Mon Feb 28 17:01:09 2011
New Revision: 126708
URL: http://llvm.org/viewvc/llvm-project?rev=126708&view=rev
Log:
Use DSCall graph to count the callees. Also,
accomated functions, that are aliases of other
internal functions, as direct calls.
Modified:
poolalloc/trunk/lib/DSA/DataStructureStats.cpp
Modified: poolalloc/trunk/lib/DSA/DataStructureStats.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructureStats.cpp?rev=126708&r1=126707&r2=126708&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructureStats.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructureStats.cpp Mon Feb 28 17:01:09 2011
@@ -52,6 +52,7 @@
class DSGraphStats : public FunctionPass, public InstVisitor<DSGraphStats> {
void countCallees(const Function &F);
+ const TDDataStructures *DS;
const DSGraph *TDGraph;
DSNodeHandle getNodeHandleForValue(Value *V);
@@ -96,12 +97,17 @@
if (CE->isCast())
return isIndirectCallee(CE->getOperand(0));
+ if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
+ GA->dump();
+ return isIndirectCallee(GA->getAliasee());
+ }
+
return true;
}
void DSGraphStats::countCallees(const Function& F) {
- //FIXME:Use callgraph
+ const DSCallGraph callgraph = DS->getCallGraph();
unsigned numIndirectCalls = 0, totalNumCallees = 0;
for (DSGraph::fc_iterator I = TDGraph->fc_begin(), E = TDGraph->fc_end();
@@ -109,7 +115,7 @@
if (isIndirectCallee(I->getCallSite().getCalledValue())) {
// This is an indirect function call
std::vector<const Function*> Callees;
- I->getCalleeNode()->addFullFunctionList(Callees);
+ callgraph.addFullFunctionList(I->getCallSite(), Callees);
if (Callees.size() > 0) {
totalNumCallees += Callees.size();
@@ -209,7 +215,8 @@
bool DSGraphStats::runOnFunction(Function& F) {
- TDGraph = getAnalysis<TDDataStructures>().getDSGraph(F);
+ DS = &getAnalysis<TDDataStructures>();
+ TDGraph = DS->getDSGraph(F);
countCallees(F);
visit(F);
return true;
More information about the llvm-commits
mailing list