diff options
author | Chris Lattner <sabre@nondot.org> | 2002-11-06 06:20:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-11-06 06:20:27 +0000 |
commit | 08db719c4b1134746da5d03b22f0da4050c91f99 (patch) | |
tree | 89433bb3d0f5552f6819e65aef467ed1531f529e /lib/Analysis/DataStructure/Printer.cpp | |
parent | 4268c93b0082509f96dea6e3934c6306ab7da2ee (diff) |
Dramatically simplify internal DSNode representation, get implementation
*FULLY OPERATIONAL* and safe. We are now capable of completely analyzing
at LEAST the Olden benchmarks + 181.mcf
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Printer.cpp | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index e683c358e2..e196535c25 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -27,23 +27,25 @@ static string getCaption(const DSNode *N, const DSGraph *G) { std::stringstream OS; Module *M = G && &G->getFunction() ? G->getFunction().getParent() : 0; - for (unsigned i = 0, e = N->getTypeEntries().size(); i != e; ++i) { - WriteTypeSymbolic(OS, N->getTypeEntries()[i].Ty, M); - if (N->getTypeEntries()[i].Offset) - OS << "@" << N->getTypeEntries()[i].Offset; - if (N->getTypeEntries()[i].isArray) + if (N->isNodeCompletelyFolded()) + OS << "FOLDED"; + else { + WriteTypeSymbolic(OS, N->getType().Ty, M); + if (N->getType().isArray) OS << " array"; + } + if (N->NodeType) { + OS << ": "; + if (N->NodeType & DSNode::AllocaNode ) OS << "S"; + if (N->NodeType & DSNode::HeapNode ) OS << "H"; + if (N->NodeType & DSNode::GlobalNode ) OS << "G"; + if (N->NodeType & DSNode::UnknownNode) OS << "U"; + if (N->NodeType & DSNode::Incomplete ) OS << "I"; + if (N->NodeType & DSNode::Modified ) OS << "M"; + if (N->NodeType & DSNode::Read ) OS << "R"; OS << "\n"; } - if (N->NodeType & DSNode::AllocaNode ) OS << "S"; - if (N->NodeType & DSNode::HeapNode ) OS << "H"; - if (N->NodeType & DSNode::GlobalNode ) OS << "G"; - if (N->NodeType & DSNode::UnknownNode) OS << "U"; - if (N->NodeType & DSNode::Incomplete ) OS << "I"; - if (N->NodeType & DSNode::Modified ) OS << "M"; - if (N->NodeType & DSNode::Read ) OS << "R"; - for (unsigned i = 0, e = N->getGlobals().size(); i != e; ++i) { WriteAsOperand(OS, N->getGlobals()[i], false, true, M); OS << "\n"; @@ -75,11 +77,6 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { return "shape=Mrecord";//fontname=Courier"; } - static int getEdgeSourceLabel(const DSNode *Node, DSNode::iterator I) { - assert(Node == I.getNode() && "Iterator not for this node!"); - return Node->getMergeMapLabel(I.getOffset()); - } - /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes /// and the return node. /// @@ -95,7 +92,7 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { GW.emitSimpleNode(I->first, "plaintext=circle", OS.str()); // Add edge from return node to real destination - int EdgeDest = I->second.getOffset(); + int EdgeDest = I->second.getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(I->first, -1, I->second.getNode(), EdgeDest, "arrowtail=tee,color=gray63"); @@ -108,7 +105,7 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { GW.emitSimpleNode((void*)1, "plaintext=circle", "returning"); // Add edge from return node to real destination - int RetEdgeDest = G->getRetNode().getOffset(); + int RetEdgeDest = G->getRetNode().getOffset() >> DS::PointerShift;; if (RetEdgeDest == 0) RetEdgeDest = -1; GW.emitEdge((void*)1, -1, G->getRetNode().getNode(), RetEdgeDest, "arrowtail=tee,color=gray63"); @@ -121,18 +118,18 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2); if (DSNode *N = Call.getRetVal().getNode()) { - int EdgeDest = Call.getRetVal().getOffset(); + 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(); + int EdgeDest = Call.getCallee().getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(&Call, 1, N, EdgeDest, "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(); + int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(&Call, j+2, N, EdgeDest, "color=gray63"); } |