mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user