diff options
author | Chris Lattner <sabre@nondot.org> | 2002-11-02 00:13:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-11-02 00:13:20 +0000 |
commit | 92673296e61a535bd3b1a88afdb4cb8fe05085f0 (patch) | |
tree | d44b83a91b8938d08554c82cc7804123eeb1e5f2 /lib/Analysis/DataStructure/Printer.cpp | |
parent | 332043264ee52b171b9164ae9c454b9ebe9e9f04 (diff) |
Stop representing scalars as explicit nodes in the graph. Now the only
nodes in the graph are memory objects, which is very nice. This also greatly
reduces the size and memory footprint for DSGraphs. For example, the local
DSGraph for llu went from 65 to 13 nodes with this change. As a side bonus,
dot seems to lay out the graphs slightly better too. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Printer.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index 35f491dd5c..fd6006c2a5 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -36,7 +36,6 @@ static string getCaption(const DSNode *N, const DSGraph *G) { OS << "\n"; } - if (N->NodeType & DSNode::ScalarNode) OS << "S"; if (N->NodeType & DSNode::AllocaNode) OS << "A"; if (N->NodeType & DSNode::NewNode ) OS << "N"; if (N->NodeType & DSNode::GlobalNode) OS << "G"; @@ -49,15 +48,6 @@ static string getCaption(const DSNode *N, const DSGraph *G) { OS << "\n"; } - if ((N->NodeType & DSNode::ScalarNode) && G) { - const std::map<Value*, DSNodeHandle> &VM = G->getValueMap(); - for (std::map<Value*, DSNodeHandle>::const_iterator I = VM.begin(), - E = VM.end(); I != E; ++I) - if (I->second.getNode() == N) { - WriteAsOperand(OS, I->first, false, true, M); - OS << "\n"; - } - } return OS.str(); } @@ -94,6 +84,23 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { /// static void addCustomGraphFeatures(const DSGraph *G, GraphWriter<const DSGraph*> &GW) { + // Add scalar nodes to the graph... + const std::map<Value*, DSNodeHandle> &VM = G->getValueMap(); + for (std::map<Value*, DSNodeHandle>::const_iterator I = VM.begin(); + I != VM.end(); ++I) + if (!isa<GlobalValue>(I->first)) { + std::stringstream OS; + WriteAsOperand(OS, I->first, false, true, G->getFunction().getParent()); + GW.emitSimpleNode(I->first, "plaintext=circle", OS.str()); + + // Add edge from return node to real destination + int EdgeDest = I->second.getOffset(); + if (EdgeDest == 0) EdgeDest = -1; + GW.emitEdge(I->first, -1, I->second.getNode(), + EdgeDest, "arrowtail=tee,color=gray63"); + } + + // Output the returned value pointer... if (G->getRetNode().getNode() != 0) { // Output the return node... |