diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-05 21:59:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-05 21:59:58 +0000 |
commit | 923fc05b3a95efad270b283f97b2670152a41efb (patch) | |
tree | f57c34bd5de4a4e4b59c46847c9da54894f2bf9e /lib/Analysis/DataStructure/Printer.cpp | |
parent | bbe5ac1458f3719fd51785f086e9166ccbb0c464 (diff) |
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
Diffstat (limited to 'lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Printer.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index b6b843b345..d862264dcf 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -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; |