Implement optimization for direct function call case. This dramatically

reduces the number of function nodes created and speeds up analysis by
about 10% overall.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5495 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2003-02-05 21:59:58 +00:00
parent bbe5ac1458
commit 923fc05b3a
13 changed files with 209 additions and 97 deletions
+14 -5
View File
@@ -123,18 +123,27 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
: G->getFunctionCalls();
for (unsigned i = 0, e = FCs.size(); i != e; ++i) {
const DSCallSite &Call = FCs[i];
GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2);
std::vector<std::string> EdgeSourceCaptions(Call.getNumPtrArgs()+2);
EdgeSourceCaptions[0] = "r";
if (Call.isDirectCall())
EdgeSourceCaptions[1] = Call.getCalleeFunc()->getName();
GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2,
&EdgeSourceCaptions);
if (DSNode *N = Call.getRetVal().getNode()) {
int EdgeDest = Call.getRetVal().getOffset() >> DS::PointerShift;
if (EdgeDest == 0) EdgeDest = -1;
GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63");
}
if (DSNode *N = Call.getCallee().getNode()) {
int EdgeDest = Call.getCallee().getOffset() >> DS::PointerShift;
if (EdgeDest == 0) EdgeDest = -1;
GW.emitEdge(&Call, 1, N, EdgeDest, "color=gray63");
// Print out the callee...
if (Call.isIndirectCall()) {
DSNode *N = Call.getCalleeNode();
assert(N && "Null call site callee node!");
GW.emitEdge(&Call, 1, N, -1, "color=gray63");
}
for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j)
if (DSNode *N = Call.getPtrArg(j).getNode()) {
int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift;