blob: b425e4e4729bfa1d2f691493617db475bccc8812 [file] [log] [blame]
Chris Lattnerc68c31b2002-07-10 22:38:08 +00001//===- Printer.cpp - Code for printing data structure graphs nicely -------===//
Misha Brukman2b37d7c2005-04-21 21:13:18 +00002//
John Criswellb576c942003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
Misha Brukman2b37d7c2005-04-21 21:13:18 +00007//
John Criswellb576c942003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Chris Lattnerc68c31b2002-07-10 22:38:08 +00009//
10// This file implements the 'dot' graph printer.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattner4dabb2c2004-07-07 06:32:21 +000014#include "llvm/Analysis/DataStructure/DataStructure.h"
15#include "llvm/Analysis/DataStructure/DSGraph.h"
16#include "llvm/Analysis/DataStructure/DSGraphTraits.h"
Chris Lattnerc68c31b2002-07-10 22:38:08 +000017#include "llvm/Module.h"
Chris Lattnerd9dad2c2003-07-01 16:27:32 +000018#include "llvm/Constants.h"
Chris Lattnerc68c31b2002-07-10 22:38:08 +000019#include "llvm/Assembly/Writer.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000020#include "llvm/Support/CommandLine.h"
21#include "llvm/Support/GraphWriter.h"
22#include "llvm/ADT/Statistic.h"
Reid Spencer3e0c1542006-06-05 15:44:46 +000023#include "llvm/Config/config.h"
Bill Wendling02319822006-11-17 09:44:28 +000024#include <iostream>
Chris Lattnerc68c31b2002-07-10 22:38:08 +000025#include <fstream>
26#include <sstream>
Chris Lattner9a927292003-11-12 23:11:14 +000027using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000028
Chris Lattner55c10582002-10-03 20:38:41 +000029// OnlyPrintMain - The DataStructure printer exposes this option to allow
30// printing of only the graph for "main".
31//
Chris Lattner49a1ed02002-11-18 21:42:45 +000032namespace {
33 cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
Chris Lattner4a857762004-01-22 13:42:43 +000034 cl::opt<bool> DontPrintAnything("dont-print-ds", cl::ReallyHidden);
Chris Lattnere92e7642004-02-07 23:58:05 +000035 Statistic<> MaxGraphSize ("dsa", "Maximum graph size");
36 Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
Chris Lattner49a1ed02002-11-18 21:42:45 +000037}
Chris Lattner55c10582002-10-03 20:38:41 +000038
Chris Lattnerc68c31b2002-07-10 22:38:08 +000039void DSNode::dump() const { print(std::cerr, 0); }
40
Chris Lattnerb3416bc2003-02-01 04:01:21 +000041static std::string getCaption(const DSNode *N, const DSGraph *G) {
Chris Lattnerc68c31b2002-07-10 22:38:08 +000042 std::stringstream OS;
Chris Lattner5a540632003-06-30 03:15:25 +000043 Module *M = 0;
Chris Lattner153f2402004-02-25 23:06:30 +000044
Chris Lattner72529392004-03-02 21:39:43 +000045 if (!G) G = N->getParentGraph();
Chris Lattner153f2402004-02-25 23:06:30 +000046
Chris Lattner5a540632003-06-30 03:15:25 +000047 // Get the module from ONE of the functions in the graph it is available.
Chris Lattnera5f47ea2005-03-15 16:55:04 +000048 if (G && G->retnodes_begin() != G->retnodes_end())
49 M = G->retnodes_begin()->first->getParent();
Chris Lattner72529392004-03-02 21:39:43 +000050 if (M == 0 && G) {
51 // If there is a global in the graph, we can use it to find the module.
52 const DSScalarMap &SM = G->getScalarMap();
53 if (SM.global_begin() != SM.global_end())
54 M = (*SM.global_begin())->getParent();
55 }
Chris Lattnerc68c31b2002-07-10 22:38:08 +000056
Chris Lattner08db7192002-11-06 06:20:27 +000057 if (N->isNodeCompletelyFolded())
Chris Lattner63899fa2003-07-02 04:39:27 +000058 OS << "COLLAPSED";
Chris Lattner08db7192002-11-06 06:20:27 +000059 else {
Chris Lattner49a1ed02002-11-18 21:42:45 +000060 WriteTypeSymbolic(OS, N->getType(), M);
61 if (N->isArray())
Chris Lattnerd1f8d0a2002-10-20 20:39:17 +000062 OS << " array";
Chris Lattner08db7192002-11-06 06:20:27 +000063 }
Chris Lattnerbd92b732003-06-19 21:15:11 +000064 if (unsigned NodeType = N->getNodeFlags()) {
Chris Lattner08db7192002-11-06 06:20:27 +000065 OS << ": ";
Chris Lattnerbd92b732003-06-19 21:15:11 +000066 if (NodeType & DSNode::AllocaNode ) OS << "S";
67 if (NodeType & DSNode::HeapNode ) OS << "H";
68 if (NodeType & DSNode::GlobalNode ) OS << "G";
69 if (NodeType & DSNode::UnknownNode) OS << "U";
70 if (NodeType & DSNode::Incomplete ) OS << "I";
71 if (NodeType & DSNode::Modified ) OS << "M";
72 if (NodeType & DSNode::Read ) OS << "R";
Chris Lattnerbd92b732003-06-19 21:15:11 +000073#ifndef NDEBUG
74 if (NodeType & DSNode::DEAD ) OS << "<dead>";
75#endif
Chris Lattner76d5b482002-07-11 20:33:32 +000076 OS << "\n";
Chris Lattner76d5b482002-07-11 20:33:32 +000077 }
78
Chris Lattnerf5c7ad82005-03-20 02:40:11 +000079 EquivalenceClasses<GlobalValue*> *GlobalECs = 0;
80 if (G) GlobalECs = &G->getGlobalECs();
Misha Brukman2b37d7c2005-04-21 21:13:18 +000081
Chris Lattnerf5c7ad82005-03-20 02:40:11 +000082 for (unsigned i = 0, e = N->getGlobalsList().size(); i != e; ++i) {
83 WriteAsOperand(OS, N->getGlobalsList()[i], false, true, M);
84
85 // Figure out how many globals are equivalent to this one.
86 if (GlobalECs) {
87 EquivalenceClasses<GlobalValue*>::iterator I =
88 GlobalECs->findValue(N->getGlobalsList()[i]);
89 if (I != GlobalECs->end()) {
Misha Brukman2b37d7c2005-04-21 21:13:18 +000090 unsigned NumMembers =
Chris Lattnerf5c7ad82005-03-20 02:40:11 +000091 std::distance(GlobalECs->member_begin(I), GlobalECs->member_end());
92 if (NumMembers != 1) OS << " + " << (NumMembers-1) << " EC";
93 }
94 }
Chris Lattnerfccd06f2002-10-01 22:33:50 +000095 OS << "\n";
96 }
97
Chris Lattnerc68c31b2002-07-10 22:38:08 +000098 return OS.str();
99}
100
Chris Lattner9a927292003-11-12 23:11:14 +0000101namespace llvm {
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000102template<>
Chris Lattnere17a4e82002-10-17 01:02:46 +0000103struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
104 static std::string getGraphName(const DSGraph *G) {
Chris Lattner5a540632003-06-30 03:15:25 +0000105 switch (G->getReturnNodes().size()) {
Chris Lattner6681e982003-06-30 05:57:39 +0000106 case 0: return G->getFunctionNames();
107 case 1: return "Function " + G->getFunctionNames();
108 default: return "Functions: " + G->getFunctionNames();
Chris Lattner5a540632003-06-30 03:15:25 +0000109 }
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000110 }
111
Chris Lattnere17a4e82002-10-17 01:02:46 +0000112 static std::string getNodeLabel(const DSNode *Node, const DSGraph *Graph) {
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000113 return getCaption(Node, Graph);
114 }
115
Jim Laskeyec204022006-10-02 12:26:53 +0000116 static std::string getNodeAttributes(const DSNode *N, const DSGraph *Graph) {
Brian Gaeke61780852004-05-05 06:10:06 +0000117 return "shape=Mrecord";
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000118 }
Chris Lattner8e667cd2004-06-22 07:13:10 +0000119
120 static bool edgeTargetsEdgeSource(const void *Node,
121 DSNode::const_iterator I) {
122 unsigned O = I.getNode()->getLink(I.getOffset()).getOffset();
123 return (O >> DS::PointerShift) != 0;
124 }
125
126 static DSNode::const_iterator getEdgeTarget(const DSNode *Node,
127 DSNode::const_iterator I) {
128 unsigned O = I.getNode()->getLink(I.getOffset()).getOffset();
129 unsigned LinkNo = O >> DS::PointerShift;
130 const DSNode *N = *I;
131 DSNode::const_iterator R = N->begin();
132 for (; LinkNo; --LinkNo)
133 ++R;
134 return R;
135 }
136
Misha Brukman2b37d7c2005-04-21 21:13:18 +0000137
Chris Lattnereb265cd2002-10-16 02:04:36 +0000138 /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes
139 /// and the return node.
140 ///
Chris Lattnere17a4e82002-10-17 01:02:46 +0000141 static void addCustomGraphFeatures(const DSGraph *G,
142 GraphWriter<const DSGraph*> &GW) {
Chris Lattner5a540632003-06-30 03:15:25 +0000143 Module *CurMod = 0;
Chris Lattnera5f47ea2005-03-15 16:55:04 +0000144 if (G->retnodes_begin() != G->retnodes_end())
145 CurMod = G->retnodes_begin()->first->getParent();
Chris Lattner72529392004-03-02 21:39:43 +0000146 else {
147 // If there is a global in the graph, we can use it to find the module.
148 const DSScalarMap &SM = G->getScalarMap();
149 if (SM.global_begin() != SM.global_end())
150 CurMod = (*SM.global_begin())->getParent();
151 }
152
Chris Lattner714752f2003-02-04 00:03:18 +0000153
Chris Lattner92673292002-11-02 00:13:20 +0000154 // Add scalar nodes to the graph...
Chris Lattner5a540632003-06-30 03:15:25 +0000155 const DSGraph::ScalarMapTy &VM = G->getScalarMap();
156 for (DSGraph::ScalarMapTy::const_iterator I = VM.begin(); I != VM.end();++I)
Reid Spencere8404342004-07-18 00:18:30 +0000157 if (!isa<GlobalValue>(I->first)) {
Chris Lattner92673292002-11-02 00:13:20 +0000158 std::stringstream OS;
Chris Lattner714752f2003-02-04 00:03:18 +0000159 WriteAsOperand(OS, I->first, false, true, CurMod);
Chris Lattner49a1ed02002-11-18 21:42:45 +0000160 GW.emitSimpleNode(I->first, "", OS.str());
Misha Brukman2b37d7c2005-04-21 21:13:18 +0000161
Chris Lattner92673292002-11-02 00:13:20 +0000162 // Add edge from return node to real destination
Chris Lattnerf1bd4b42004-10-30 07:21:19 +0000163 DSNode *DestNode = I->second.getNode();
Chris Lattner08db7192002-11-06 06:20:27 +0000164 int EdgeDest = I->second.getOffset() >> DS::PointerShift;
Chris Lattner92673292002-11-02 00:13:20 +0000165 if (EdgeDest == 0) EdgeDest = -1;
Chris Lattnerf1bd4b42004-10-30 07:21:19 +0000166 GW.emitEdge(I->first, -1, DestNode,
Chris Lattner92673292002-11-02 00:13:20 +0000167 EdgeDest, "arrowtail=tee,color=gray63");
168 }
169
170
Chris Lattnereb265cd2002-10-16 02:04:36 +0000171 // Output the returned value pointer...
Chris Lattnera5f47ea2005-03-15 16:55:04 +0000172 for (DSGraph::retnodes_iterator I = G->retnodes_begin(),
173 E = G->retnodes_end(); I != E; ++I)
Chris Lattner5a540632003-06-30 03:15:25 +0000174 if (I->second.getNode()) {
175 std::string Label;
Chris Lattnera5f47ea2005-03-15 16:55:04 +0000176 if (G->getReturnNodes().size() == 1)
Chris Lattner5a540632003-06-30 03:15:25 +0000177 Label = "returning";
178 else
179 Label = I->first->getName() + " ret node";
180 // Output the return node...
Chris Lattnerd8ea8a52003-11-12 04:58:19 +0000181 GW.emitSimpleNode((void*)I->first, "plaintext=circle", Label);
Chris Lattnereb265cd2002-10-16 02:04:36 +0000182
Chris Lattner5a540632003-06-30 03:15:25 +0000183 // Add edge from return node to real destination
Chris Lattnerf1bd4b42004-10-30 07:21:19 +0000184 DSNode *RetNode = I->second.getNode();
Chris Lattner5a540632003-06-30 03:15:25 +0000185 int RetEdgeDest = I->second.getOffset() >> DS::PointerShift;;
186 if (RetEdgeDest == 0) RetEdgeDest = -1;
Chris Lattnerf1bd4b42004-10-30 07:21:19 +0000187 GW.emitEdge((void*)I->first, -1, RetNode,
Chris Lattner5a540632003-06-30 03:15:25 +0000188 RetEdgeDest, "arrowtail=tee,color=gray63");
189 }
Chris Lattner962ee452002-10-16 20:16:16 +0000190
191 // Output all of the call nodes...
Chris Lattnera9548d92005-01-30 23:51:02 +0000192 const std::list<DSCallSite> &FCs =
Chris Lattner4f7815f2002-11-10 06:53:59 +0000193 G->shouldPrintAuxCalls() ? G->getAuxFunctionCalls()
194 : G->getFunctionCalls();
Chris Lattnera9548d92005-01-30 23:51:02 +0000195 for (std::list<DSCallSite>::const_iterator I = FCs.begin(), E = FCs.end();
196 I != E; ++I) {
197 const DSCallSite &Call = *I;
Chris Lattner923fc052003-02-05 21:59:58 +0000198 std::vector<std::string> EdgeSourceCaptions(Call.getNumPtrArgs()+2);
199 EdgeSourceCaptions[0] = "r";
200 if (Call.isDirectCall())
201 EdgeSourceCaptions[1] = Call.getCalleeFunc()->getName();
Chris Lattnerf1c28382003-02-14 20:25:47 +0000202 else
203 EdgeSourceCaptions[1] = "f";
Chris Lattner923fc052003-02-05 21:59:58 +0000204
205 GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2,
206 &EdgeSourceCaptions);
Chris Lattner962ee452002-10-16 20:16:16 +0000207
Chris Lattner482b6512002-10-21 13:47:57 +0000208 if (DSNode *N = Call.getRetVal().getNode()) {
Chris Lattner08db7192002-11-06 06:20:27 +0000209 int EdgeDest = Call.getRetVal().getOffset() >> DS::PointerShift;
Chris Lattner482b6512002-10-21 13:47:57 +0000210 if (EdgeDest == 0) EdgeDest = -1;
Chris Lattner352a6fa2003-02-13 20:14:40 +0000211 GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63,tailclip=false");
Chris Lattner482b6512002-10-21 13:47:57 +0000212 }
Chris Lattner923fc052003-02-05 21:59:58 +0000213
214 // Print out the callee...
215 if (Call.isIndirectCall()) {
216 DSNode *N = Call.getCalleeNode();
217 assert(N && "Null call site callee node!");
Chris Lattner352a6fa2003-02-13 20:14:40 +0000218 GW.emitEdge(&Call, 1, N, -1, "color=gray63,tailclip=false");
Chris Lattner482b6512002-10-21 13:47:57 +0000219 }
Chris Lattner923fc052003-02-05 21:59:58 +0000220
Chris Lattner0969c502002-10-21 02:08:03 +0000221 for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j)
222 if (DSNode *N = Call.getPtrArg(j).getNode()) {
Chris Lattner08db7192002-11-06 06:20:27 +0000223 int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift;
Chris Lattner962ee452002-10-16 20:16:16 +0000224 if (EdgeDest == 0) EdgeDest = -1;
Chris Lattner352a6fa2003-02-13 20:14:40 +0000225 GW.emitEdge(&Call, j+2, N, EdgeDest, "color=gray63,tailclip=false");
Chris Lattner962ee452002-10-16 20:16:16 +0000226 }
227 }
Chris Lattnereb265cd2002-10-16 02:04:36 +0000228 }
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000229};
Chris Lattner9a927292003-11-12 23:11:14 +0000230} // end namespace llvm
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000231
Chris Lattnere17a4e82002-10-17 01:02:46 +0000232void DSNode::print(std::ostream &O, const DSGraph *G) const {
233 GraphWriter<const DSGraph *> W(O, G);
234 W.writeNode(this);
235}
Chris Lattnerf6c52db2002-10-13 19:31:57 +0000236
Chris Lattnere17a4e82002-10-17 01:02:46 +0000237void DSGraph::print(std::ostream &O) const {
238 WriteGraph(O, this, "DataStructures");
239}
240
Chris Lattnerb3416bc2003-02-01 04:01:21 +0000241void DSGraph::writeGraphToFile(std::ostream &O,
242 const std::string &GraphName) const {
243 std::string Filename = GraphName + ".dot";
Vikram S. Advedfd2f322002-07-30 22:07:26 +0000244 O << "Writing '" << Filename << "'...";
245 std::ofstream F(Filename.c_str());
Misha Brukman2b37d7c2005-04-21 21:13:18 +0000246
Vikram S. Advedfd2f322002-07-30 22:07:26 +0000247 if (F.good()) {
Chris Lattnere17a4e82002-10-17 01:02:46 +0000248 print(F);
Chris Lattner60525942002-11-11 00:01:02 +0000249 unsigned NumCalls = shouldPrintAuxCalls() ?
250 getAuxFunctionCalls().size() : getFunctionCalls().size();
251 O << " [" << getGraphSize() << "+" << NumCalls << "]\n";
Vikram S. Advedfd2f322002-07-30 22:07:26 +0000252 } else {
253 O << " error opening file for writing!\n";
254 }
255}
256
Chris Lattnere79eaa92003-02-10 18:17:07 +0000257/// viewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
258/// then cleanup. For use from the debugger.
259///
260void DSGraph::viewGraph() const {
Reid Spencer9d5b5322006-06-27 16:49:46 +0000261 ViewGraph(this, "ds.tempgraph", "DataStructures");
Chris Lattnere79eaa92003-02-10 18:17:07 +0000262}
263
264
Chris Lattner0d9bab82002-07-18 00:12:30 +0000265template <typename Collection>
Chris Lattner97f51a32002-07-27 01:12:15 +0000266static void printCollection(const Collection &C, std::ostream &O,
Chris Lattnerb3416bc2003-02-01 04:01:21 +0000267 const Module *M, const std::string &Prefix) {
Chris Lattner97f51a32002-07-27 01:12:15 +0000268 if (M == 0) {
269 O << "Null Module pointer, cannot continue!\n";
270 return;
271 }
272
Chris Lattner14212332002-11-07 02:18:46 +0000273 unsigned TotalNumNodes = 0, TotalCallNodes = 0;
Chris Lattner97f51a32002-07-27 01:12:15 +0000274 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
Chris Lattner4f7815f2002-11-10 06:53:59 +0000275 if (C.hasGraph(*I)) {
Chris Lattner95a80ad2002-11-07 01:54:44 +0000276 DSGraph &Gr = C.getDSGraph((Function&)*I);
Chris Lattner4f7815f2002-11-10 06:53:59 +0000277 unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
278 Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
Chris Lattnercf908252005-03-25 20:54:45 +0000279 bool IsDuplicateGraph = false;
Chris Lattner4f7815f2002-11-10 06:53:59 +0000280
Chris Lattner1e759992005-02-01 19:10:48 +0000281 if (I->getName() == "main" || !OnlyPrintMain) {
Chris Lattnera5f47ea2005-03-15 16:55:04 +0000282 Function *SCCFn = Gr.retnodes_begin()->first;
Chris Lattner0423e032005-03-25 20:37:32 +0000283 if (&*I == SCCFn) {
Chris Lattner1e759992005-02-01 19:10:48 +0000284 Gr.writeGraphToFile(O, Prefix+I->getName());
Chris Lattner0423e032005-03-25 20:37:32 +0000285 } else {
Chris Lattnercf908252005-03-25 20:54:45 +0000286 IsDuplicateGraph = true; // Don't double count node/call nodes.
Chris Lattner1e759992005-02-01 19:10:48 +0000287 O << "Didn't write '" << Prefix+I->getName()
288 << ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName()
289 << "\n";
Chris Lattner0423e032005-03-25 20:37:32 +0000290 }
Chris Lattner1e759992005-02-01 19:10:48 +0000291 } else {
Chris Lattnercf908252005-03-25 20:54:45 +0000292 Function *SCCFn = Gr.retnodes_begin()->first;
293 if (&*I == SCCFn) {
294 O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
295 << Gr.getGraphSize() << "+" << NumCalls << "]\n";
296 } else {
297 IsDuplicateGraph = true; // Don't double count node/call nodes.
298 }
Chris Lattner95a80ad2002-11-07 01:54:44 +0000299 }
Chris Lattner49a1ed02002-11-18 21:42:45 +0000300
Chris Lattnercf908252005-03-25 20:54:45 +0000301 if (!IsDuplicateGraph) {
302 unsigned GraphSize = Gr.getGraphSize();
303 if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
Chris Lattnere92e7642004-02-07 23:58:05 +0000304
Chris Lattnercf908252005-03-25 20:54:45 +0000305 TotalNumNodes += Gr.getGraphSize();
306 TotalCallNodes += NumCalls;
307 for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
308 NI != E; ++NI)
309 if (NI->isNodeCompletelyFolded())
310 ++NumFoldedNodes;
311 }
Chris Lattner95a80ad2002-11-07 01:54:44 +0000312 }
Chris Lattner14212332002-11-07 02:18:46 +0000313
Chris Lattneraa0b4682002-11-09 21:12:07 +0000314 DSGraph &GG = C.getGlobalsGraph();
315 TotalNumNodes += GG.getGraphSize();
316 TotalCallNodes += GG.getFunctionCalls().size();
Chris Lattnerf76e7542002-11-09 21:40:58 +0000317 if (!OnlyPrintMain) {
Chris Lattneraa0b4682002-11-09 21:12:07 +0000318 GG.writeGraphToFile(O, Prefix+"GlobalsGraph");
319 } else {
320 O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... ["
321 << GG.getGraphSize() << "+" << GG.getFunctionCalls().size() << "]\n";
322 }
323
Misha Brukman2b37d7c2005-04-21 21:13:18 +0000324 O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes
Chris Lattner33312f72002-11-08 01:21:07 +0000325 << "] nodes total" << std::endl;
Chris Lattnerc68c31b2002-07-10 22:38:08 +0000326}
Chris Lattner0d9bab82002-07-18 00:12:30 +0000327
328
329// print - Print out the analysis results...
Chris Lattner97f51a32002-07-27 01:12:15 +0000330void LocalDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner4a857762004-01-22 13:42:43 +0000331 if (DontPrintAnything) return;
Chris Lattnerfccd06f2002-10-01 22:33:50 +0000332 printCollection(*this, O, M, "ds.");
Chris Lattner0d9bab82002-07-18 00:12:30 +0000333}
334
Chris Lattner97f51a32002-07-27 01:12:15 +0000335void BUDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner4a857762004-01-22 13:42:43 +0000336 if (DontPrintAnything) return;
Chris Lattnerfccd06f2002-10-01 22:33:50 +0000337 printCollection(*this, O, M, "bu.");
Vikram S. Advedfd2f322002-07-30 22:07:26 +0000338}
339
340void TDDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner4a857762004-01-22 13:42:43 +0000341 if (DontPrintAnything) return;
Chris Lattnerfccd06f2002-10-01 22:33:50 +0000342 printCollection(*this, O, M, "td.");
Chris Lattnere25ab832002-10-17 04:24:30 +0000343}
Brian Gaeked0fde302003-11-11 22:41:34 +0000344
Chris Lattner79390d42003-11-13 05:05:41 +0000345void CompleteBUDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner4a857762004-01-22 13:42:43 +0000346 if (DontPrintAnything) return;
Chris Lattner79390d42003-11-13 05:05:41 +0000347 printCollection(*this, O, M, "cbu.");
348}
349
350
Chris Lattneradfd5f12005-03-13 19:51:24 +0000351void EquivClassGraphs::print(std::ostream &O, const Module *M) const {
352 if (DontPrintAnything) return;
353 printCollection(*this, O, M, "eq.");
354}
355