blob: ce99961581121307835ad5458b913840318bd043 [file] [log] [blame]
Chris Lattnerc0dab432002-07-10 22:38:08 +00001//===- Printer.cpp - Code for printing data structure graphs nicely -------===//
Misha Brukman01808ca2005-04-21 21:13:18 +00002//
John Criswell482202a2003-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 Brukman01808ca2005-04-21 21:13:18 +00007//
John Criswell482202a2003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Chris Lattnerc0dab432002-07-10 22:38:08 +00009//
10// This file implements the 'dot' graph printer.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattnerf6118db2004-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 Lattnerc0dab432002-07-10 22:38:08 +000017#include "llvm/Module.h"
Chris Lattner8a30ad62003-07-01 16:27:32 +000018#include "llvm/Constants.h"
Chris Lattnerc0dab432002-07-10 22:38:08 +000019#include "llvm/Assembly/Writer.h"
Reid Spencer7c16caa2004-09-01 22:55:40 +000020#include "llvm/Support/CommandLine.h"
21#include "llvm/Support/GraphWriter.h"
22#include "llvm/ADT/Statistic.h"
Reid Spencer7c773232006-06-05 15:44:46 +000023#include "llvm/Config/config.h"
Chris Lattnerc0dab432002-07-10 22:38:08 +000024#include <fstream>
25#include <sstream>
Chris Lattner9e876552003-11-12 23:11:14 +000026using namespace llvm;
Brian Gaeke960707c2003-11-11 22:41:34 +000027
Chris Lattnerc9c681e2002-10-03 20:38:41 +000028// OnlyPrintMain - The DataStructure printer exposes this option to allow
29// printing of only the graph for "main".
30//
Chris Lattner77b80612002-11-18 21:42:45 +000031namespace {
32 cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
Chris Lattner45fd9d52004-01-22 13:42:43 +000033 cl::opt<bool> DontPrintAnything("dont-print-ds", cl::ReallyHidden);
Chris Lattnerce74c2f2004-02-07 23:58:05 +000034 Statistic<> MaxGraphSize ("dsa", "Maximum graph size");
35 Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
Chris Lattner77b80612002-11-18 21:42:45 +000036}
Chris Lattnerc9c681e2002-10-03 20:38:41 +000037
Chris Lattnerc0dab432002-07-10 22:38:08 +000038void DSNode::dump() const { print(std::cerr, 0); }
39
Chris Lattneree97c8b2003-02-01 04:01:21 +000040static std::string getCaption(const DSNode *N, const DSGraph *G) {
Chris Lattnerc0dab432002-07-10 22:38:08 +000041 std::stringstream OS;
Chris Lattner63aeacf2003-06-30 03:15:25 +000042 Module *M = 0;
Chris Lattner17bce882004-02-25 23:06:30 +000043
Chris Lattner2e92b462004-03-02 21:39:43 +000044 if (!G) G = N->getParentGraph();
Chris Lattner17bce882004-02-25 23:06:30 +000045
Chris Lattner63aeacf2003-06-30 03:15:25 +000046 // Get the module from ONE of the functions in the graph it is available.
Chris Lattner92d0c1c1b2005-03-15 16:55:04 +000047 if (G && G->retnodes_begin() != G->retnodes_end())
48 M = G->retnodes_begin()->first->getParent();
Chris Lattner2e92b462004-03-02 21:39:43 +000049 if (M == 0 && G) {
50 // If there is a global in the graph, we can use it to find the module.
51 const DSScalarMap &SM = G->getScalarMap();
52 if (SM.global_begin() != SM.global_end())
53 M = (*SM.global_begin())->getParent();
54 }
Chris Lattnerc0dab432002-07-10 22:38:08 +000055
Chris Lattner48e37d92002-11-06 06:20:27 +000056 if (N->isNodeCompletelyFolded())
Chris Lattner049d5582003-07-02 04:39:27 +000057 OS << "COLLAPSED";
Chris Lattner48e37d92002-11-06 06:20:27 +000058 else {
Chris Lattner77b80612002-11-18 21:42:45 +000059 WriteTypeSymbolic(OS, N->getType(), M);
60 if (N->isArray())
Chris Lattner07d69052002-10-20 20:39:17 +000061 OS << " array";
Chris Lattner48e37d92002-11-06 06:20:27 +000062 }
Chris Lattner4853d162003-06-19 21:15:11 +000063 if (unsigned NodeType = N->getNodeFlags()) {
Chris Lattner48e37d92002-11-06 06:20:27 +000064 OS << ": ";
Chris Lattner4853d162003-06-19 21:15:11 +000065 if (NodeType & DSNode::AllocaNode ) OS << "S";
66 if (NodeType & DSNode::HeapNode ) OS << "H";
67 if (NodeType & DSNode::GlobalNode ) OS << "G";
68 if (NodeType & DSNode::UnknownNode) OS << "U";
69 if (NodeType & DSNode::Incomplete ) OS << "I";
70 if (NodeType & DSNode::Modified ) OS << "M";
71 if (NodeType & DSNode::Read ) OS << "R";
Chris Lattner4853d162003-06-19 21:15:11 +000072#ifndef NDEBUG
73 if (NodeType & DSNode::DEAD ) OS << "<dead>";
74#endif
Chris Lattner83ce4f92002-07-11 20:33:32 +000075 OS << "\n";
Chris Lattner83ce4f92002-07-11 20:33:32 +000076 }
77
Chris Lattner5635a882005-03-20 02:40:11 +000078 EquivalenceClasses<GlobalValue*> *GlobalECs = 0;
79 if (G) GlobalECs = &G->getGlobalECs();
Misha Brukman01808ca2005-04-21 21:13:18 +000080
Chris Lattner5635a882005-03-20 02:40:11 +000081 for (unsigned i = 0, e = N->getGlobalsList().size(); i != e; ++i) {
82 WriteAsOperand(OS, N->getGlobalsList()[i], false, true, M);
83
84 // Figure out how many globals are equivalent to this one.
85 if (GlobalECs) {
86 EquivalenceClasses<GlobalValue*>::iterator I =
87 GlobalECs->findValue(N->getGlobalsList()[i]);
88 if (I != GlobalECs->end()) {
Misha Brukman01808ca2005-04-21 21:13:18 +000089 unsigned NumMembers =
Chris Lattner5635a882005-03-20 02:40:11 +000090 std::distance(GlobalECs->member_begin(I), GlobalECs->member_end());
91 if (NumMembers != 1) OS << " + " << (NumMembers-1) << " EC";
92 }
93 }
Chris Lattner193e6922002-10-01 22:33:50 +000094 OS << "\n";
95 }
96
Chris Lattnerc0dab432002-07-10 22:38:08 +000097 return OS.str();
98}
99
Chris Lattner9e876552003-11-12 23:11:14 +0000100namespace llvm {
Chris Lattnerb0f38782002-10-13 19:31:57 +0000101template<>
Chris Lattnerddebb432002-10-17 01:02:46 +0000102struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
103 static std::string getGraphName(const DSGraph *G) {
Chris Lattner63aeacf2003-06-30 03:15:25 +0000104 switch (G->getReturnNodes().size()) {
Chris Lattner70923c62003-06-30 05:57:39 +0000105 case 0: return G->getFunctionNames();
106 case 1: return "Function " + G->getFunctionNames();
107 default: return "Functions: " + G->getFunctionNames();
Chris Lattner63aeacf2003-06-30 03:15:25 +0000108 }
Chris Lattnerb0f38782002-10-13 19:31:57 +0000109 }
110
Chris Lattnerddebb432002-10-17 01:02:46 +0000111 static std::string getNodeLabel(const DSNode *Node, const DSGraph *Graph) {
Chris Lattnerb0f38782002-10-13 19:31:57 +0000112 return getCaption(Node, Graph);
113 }
114
Jim Laskey1368c262006-10-02 12:26:53 +0000115 static std::string getNodeAttributes(const DSNode *N, const DSGraph *Graph) {
Brian Gaekee330adf2004-05-05 06:10:06 +0000116 return "shape=Mrecord";
Chris Lattnerb0f38782002-10-13 19:31:57 +0000117 }
Chris Lattner881d9592004-06-22 07:13:10 +0000118
119 static bool edgeTargetsEdgeSource(const void *Node,
120 DSNode::const_iterator I) {
121 unsigned O = I.getNode()->getLink(I.getOffset()).getOffset();
122 return (O >> DS::PointerShift) != 0;
123 }
124
125 static DSNode::const_iterator getEdgeTarget(const DSNode *Node,
126 DSNode::const_iterator I) {
127 unsigned O = I.getNode()->getLink(I.getOffset()).getOffset();
128 unsigned LinkNo = O >> DS::PointerShift;
129 const DSNode *N = *I;
130 DSNode::const_iterator R = N->begin();
131 for (; LinkNo; --LinkNo)
132 ++R;
133 return R;
134 }
135
Misha Brukman01808ca2005-04-21 21:13:18 +0000136
Chris Lattnerfea9f0b2002-10-16 02:04:36 +0000137 /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes
138 /// and the return node.
139 ///
Chris Lattnerddebb432002-10-17 01:02:46 +0000140 static void addCustomGraphFeatures(const DSGraph *G,
141 GraphWriter<const DSGraph*> &GW) {
Chris Lattner63aeacf2003-06-30 03:15:25 +0000142 Module *CurMod = 0;
Chris Lattner92d0c1c1b2005-03-15 16:55:04 +0000143 if (G->retnodes_begin() != G->retnodes_end())
144 CurMod = G->retnodes_begin()->first->getParent();
Chris Lattner2e92b462004-03-02 21:39:43 +0000145 else {
146 // If there is a global in the graph, we can use it to find the module.
147 const DSScalarMap &SM = G->getScalarMap();
148 if (SM.global_begin() != SM.global_end())
149 CurMod = (*SM.global_begin())->getParent();
150 }
151
Chris Lattner41135712003-02-04 00:03:18 +0000152
Chris Lattnera7b0d4e2002-11-02 00:13:20 +0000153 // Add scalar nodes to the graph...
Chris Lattner63aeacf2003-06-30 03:15:25 +0000154 const DSGraph::ScalarMapTy &VM = G->getScalarMap();
155 for (DSGraph::ScalarMapTy::const_iterator I = VM.begin(); I != VM.end();++I)
Reid Spencer30d69a52004-07-18 00:18:30 +0000156 if (!isa<GlobalValue>(I->first)) {
Chris Lattnera7b0d4e2002-11-02 00:13:20 +0000157 std::stringstream OS;
Chris Lattner41135712003-02-04 00:03:18 +0000158 WriteAsOperand(OS, I->first, false, true, CurMod);
Chris Lattner77b80612002-11-18 21:42:45 +0000159 GW.emitSimpleNode(I->first, "", OS.str());
Misha Brukman01808ca2005-04-21 21:13:18 +0000160
Chris Lattnera7b0d4e2002-11-02 00:13:20 +0000161 // Add edge from return node to real destination
Chris Lattnerc76fef12004-10-30 07:21:19 +0000162 DSNode *DestNode = I->second.getNode();
Chris Lattner48e37d92002-11-06 06:20:27 +0000163 int EdgeDest = I->second.getOffset() >> DS::PointerShift;
Chris Lattnera7b0d4e2002-11-02 00:13:20 +0000164 if (EdgeDest == 0) EdgeDest = -1;
Chris Lattnerc76fef12004-10-30 07:21:19 +0000165 GW.emitEdge(I->first, -1, DestNode,
Chris Lattnera7b0d4e2002-11-02 00:13:20 +0000166 EdgeDest, "arrowtail=tee,color=gray63");
167 }
168
169
Chris Lattnerfea9f0b2002-10-16 02:04:36 +0000170 // Output the returned value pointer...
Chris Lattner92d0c1c1b2005-03-15 16:55:04 +0000171 for (DSGraph::retnodes_iterator I = G->retnodes_begin(),
172 E = G->retnodes_end(); I != E; ++I)
Chris Lattner63aeacf2003-06-30 03:15:25 +0000173 if (I->second.getNode()) {
174 std::string Label;
Chris Lattner92d0c1c1b2005-03-15 16:55:04 +0000175 if (G->getReturnNodes().size() == 1)
Chris Lattner63aeacf2003-06-30 03:15:25 +0000176 Label = "returning";
177 else
178 Label = I->first->getName() + " ret node";
179 // Output the return node...
Chris Lattnerb740afb2003-11-12 04:58:19 +0000180 GW.emitSimpleNode((void*)I->first, "plaintext=circle", Label);
Chris Lattnerfea9f0b2002-10-16 02:04:36 +0000181
Chris Lattner63aeacf2003-06-30 03:15:25 +0000182 // Add edge from return node to real destination
Chris Lattnerc76fef12004-10-30 07:21:19 +0000183 DSNode *RetNode = I->second.getNode();
Chris Lattner63aeacf2003-06-30 03:15:25 +0000184 int RetEdgeDest = I->second.getOffset() >> DS::PointerShift;;
185 if (RetEdgeDest == 0) RetEdgeDest = -1;
Chris Lattnerc76fef12004-10-30 07:21:19 +0000186 GW.emitEdge((void*)I->first, -1, RetNode,
Chris Lattner63aeacf2003-06-30 03:15:25 +0000187 RetEdgeDest, "arrowtail=tee,color=gray63");
188 }
Chris Lattner7b0ebe92002-10-16 20:16:16 +0000189
190 // Output all of the call nodes...
Chris Lattnera1b39fa2005-01-30 23:51:02 +0000191 const std::list<DSCallSite> &FCs =
Chris Lattnere79ce7d2002-11-10 06:53:59 +0000192 G->shouldPrintAuxCalls() ? G->getAuxFunctionCalls()
193 : G->getFunctionCalls();
Chris Lattnera1b39fa2005-01-30 23:51:02 +0000194 for (std::list<DSCallSite>::const_iterator I = FCs.begin(), E = FCs.end();
195 I != E; ++I) {
196 const DSCallSite &Call = *I;
Chris Lattner80614ee2003-02-05 21:59:58 +0000197 std::vector<std::string> EdgeSourceCaptions(Call.getNumPtrArgs()+2);
198 EdgeSourceCaptions[0] = "r";
199 if (Call.isDirectCall())
200 EdgeSourceCaptions[1] = Call.getCalleeFunc()->getName();
Chris Lattnerb5cbfa02003-02-14 20:25:47 +0000201 else
202 EdgeSourceCaptions[1] = "f";
Chris Lattner80614ee2003-02-05 21:59:58 +0000203
204 GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2,
205 &EdgeSourceCaptions);
Chris Lattner7b0ebe92002-10-16 20:16:16 +0000206
Chris Lattner800b7e32002-10-21 13:47:57 +0000207 if (DSNode *N = Call.getRetVal().getNode()) {
Chris Lattner48e37d92002-11-06 06:20:27 +0000208 int EdgeDest = Call.getRetVal().getOffset() >> DS::PointerShift;
Chris Lattner800b7e32002-10-21 13:47:57 +0000209 if (EdgeDest == 0) EdgeDest = -1;
Chris Lattner60ede772003-02-13 20:14:40 +0000210 GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63,tailclip=false");
Chris Lattner800b7e32002-10-21 13:47:57 +0000211 }
Chris Lattner80614ee2003-02-05 21:59:58 +0000212
213 // Print out the callee...
214 if (Call.isIndirectCall()) {
215 DSNode *N = Call.getCalleeNode();
216 assert(N && "Null call site callee node!");
Chris Lattner60ede772003-02-13 20:14:40 +0000217 GW.emitEdge(&Call, 1, N, -1, "color=gray63,tailclip=false");
Chris Lattner800b7e32002-10-21 13:47:57 +0000218 }
Chris Lattner80614ee2003-02-05 21:59:58 +0000219
Chris Lattner5c3ce312002-10-21 02:08:03 +0000220 for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j)
221 if (DSNode *N = Call.getPtrArg(j).getNode()) {
Chris Lattner48e37d92002-11-06 06:20:27 +0000222 int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift;
Chris Lattner7b0ebe92002-10-16 20:16:16 +0000223 if (EdgeDest == 0) EdgeDest = -1;
Chris Lattner60ede772003-02-13 20:14:40 +0000224 GW.emitEdge(&Call, j+2, N, EdgeDest, "color=gray63,tailclip=false");
Chris Lattner7b0ebe92002-10-16 20:16:16 +0000225 }
226 }
Chris Lattnerfea9f0b2002-10-16 02:04:36 +0000227 }
Chris Lattnerb0f38782002-10-13 19:31:57 +0000228};
Chris Lattner9e876552003-11-12 23:11:14 +0000229} // end namespace llvm
Chris Lattnerb0f38782002-10-13 19:31:57 +0000230
Chris Lattnerddebb432002-10-17 01:02:46 +0000231void DSNode::print(std::ostream &O, const DSGraph *G) const {
232 GraphWriter<const DSGraph *> W(O, G);
233 W.writeNode(this);
234}
Chris Lattnerb0f38782002-10-13 19:31:57 +0000235
Chris Lattnerddebb432002-10-17 01:02:46 +0000236void DSGraph::print(std::ostream &O) const {
237 WriteGraph(O, this, "DataStructures");
238}
239
Chris Lattneree97c8b2003-02-01 04:01:21 +0000240void DSGraph::writeGraphToFile(std::ostream &O,
241 const std::string &GraphName) const {
242 std::string Filename = GraphName + ".dot";
Vikram S. Adve256776e2002-07-30 22:07:26 +0000243 O << "Writing '" << Filename << "'...";
244 std::ofstream F(Filename.c_str());
Misha Brukman01808ca2005-04-21 21:13:18 +0000245
Vikram S. Adve256776e2002-07-30 22:07:26 +0000246 if (F.good()) {
Chris Lattnerddebb432002-10-17 01:02:46 +0000247 print(F);
Chris Lattner773da862002-11-11 00:01:02 +0000248 unsigned NumCalls = shouldPrintAuxCalls() ?
249 getAuxFunctionCalls().size() : getFunctionCalls().size();
250 O << " [" << getGraphSize() << "+" << NumCalls << "]\n";
Vikram S. Adve256776e2002-07-30 22:07:26 +0000251 } else {
252 O << " error opening file for writing!\n";
253 }
254}
255
Chris Lattner75007f12003-02-10 18:17:07 +0000256/// viewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
257/// then cleanup. For use from the debugger.
258///
259void DSGraph::viewGraph() const {
Reid Spenceree7eaa22006-06-27 16:49:46 +0000260 ViewGraph(this, "ds.tempgraph", "DataStructures");
Chris Lattner75007f12003-02-10 18:17:07 +0000261}
262
263
Chris Lattner4c0d6202002-07-18 00:12:30 +0000264template <typename Collection>
Chris Lattner96a0dfa2002-07-27 01:12:15 +0000265static void printCollection(const Collection &C, std::ostream &O,
Chris Lattneree97c8b2003-02-01 04:01:21 +0000266 const Module *M, const std::string &Prefix) {
Chris Lattner96a0dfa2002-07-27 01:12:15 +0000267 if (M == 0) {
268 O << "Null Module pointer, cannot continue!\n";
269 return;
270 }
271
Chris Lattnerc03a3772002-11-07 02:18:46 +0000272 unsigned TotalNumNodes = 0, TotalCallNodes = 0;
Chris Lattner96a0dfa2002-07-27 01:12:15 +0000273 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
Chris Lattnere79ce7d2002-11-10 06:53:59 +0000274 if (C.hasGraph(*I)) {
Chris Lattner2d0081a2002-11-07 01:54:44 +0000275 DSGraph &Gr = C.getDSGraph((Function&)*I);
Chris Lattnere79ce7d2002-11-10 06:53:59 +0000276 unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
277 Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
Chris Lattnerd21e2202005-03-25 20:54:45 +0000278 bool IsDuplicateGraph = false;
Chris Lattnere79ce7d2002-11-10 06:53:59 +0000279
Chris Lattner63a46ce2005-02-01 19:10:48 +0000280 if (I->getName() == "main" || !OnlyPrintMain) {
Chris Lattner92d0c1c1b2005-03-15 16:55:04 +0000281 Function *SCCFn = Gr.retnodes_begin()->first;
Chris Lattnerb7ffd502005-03-25 20:37:32 +0000282 if (&*I == SCCFn) {
Chris Lattner63a46ce2005-02-01 19:10:48 +0000283 Gr.writeGraphToFile(O, Prefix+I->getName());
Chris Lattnerb7ffd502005-03-25 20:37:32 +0000284 } else {
Chris Lattnerd21e2202005-03-25 20:54:45 +0000285 IsDuplicateGraph = true; // Don't double count node/call nodes.
Chris Lattner63a46ce2005-02-01 19:10:48 +0000286 O << "Didn't write '" << Prefix+I->getName()
287 << ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName()
288 << "\n";
Chris Lattnerb7ffd502005-03-25 20:37:32 +0000289 }
Chris Lattner63a46ce2005-02-01 19:10:48 +0000290 } else {
Chris Lattnerd21e2202005-03-25 20:54:45 +0000291 Function *SCCFn = Gr.retnodes_begin()->first;
292 if (&*I == SCCFn) {
293 O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
294 << Gr.getGraphSize() << "+" << NumCalls << "]\n";
295 } else {
296 IsDuplicateGraph = true; // Don't double count node/call nodes.
297 }
Chris Lattner2d0081a2002-11-07 01:54:44 +0000298 }
Chris Lattner77b80612002-11-18 21:42:45 +0000299
Chris Lattnerd21e2202005-03-25 20:54:45 +0000300 if (!IsDuplicateGraph) {
301 unsigned GraphSize = Gr.getGraphSize();
302 if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
Chris Lattnerce74c2f2004-02-07 23:58:05 +0000303
Chris Lattnerd21e2202005-03-25 20:54:45 +0000304 TotalNumNodes += Gr.getGraphSize();
305 TotalCallNodes += NumCalls;
306 for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
307 NI != E; ++NI)
308 if (NI->isNodeCompletelyFolded())
309 ++NumFoldedNodes;
310 }
Chris Lattner2d0081a2002-11-07 01:54:44 +0000311 }
Chris Lattnerc03a3772002-11-07 02:18:46 +0000312
Chris Lattner4b1be352002-11-09 21:12:07 +0000313 DSGraph &GG = C.getGlobalsGraph();
314 TotalNumNodes += GG.getGraphSize();
315 TotalCallNodes += GG.getFunctionCalls().size();
Chris Lattnerd185d2c2002-11-09 21:40:58 +0000316 if (!OnlyPrintMain) {
Chris Lattner4b1be352002-11-09 21:12:07 +0000317 GG.writeGraphToFile(O, Prefix+"GlobalsGraph");
318 } else {
319 O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... ["
320 << GG.getGraphSize() << "+" << GG.getFunctionCalls().size() << "]\n";
321 }
322
Misha Brukman01808ca2005-04-21 21:13:18 +0000323 O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes
Chris Lattnerb0c9b372002-11-08 01:21:07 +0000324 << "] nodes total" << std::endl;
Chris Lattnerc0dab432002-07-10 22:38:08 +0000325}
Chris Lattner4c0d6202002-07-18 00:12:30 +0000326
327
328// print - Print out the analysis results...
Chris Lattner96a0dfa2002-07-27 01:12:15 +0000329void LocalDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner45fd9d52004-01-22 13:42:43 +0000330 if (DontPrintAnything) return;
Chris Lattner193e6922002-10-01 22:33:50 +0000331 printCollection(*this, O, M, "ds.");
Chris Lattner4c0d6202002-07-18 00:12:30 +0000332}
333
Chris Lattner96a0dfa2002-07-27 01:12:15 +0000334void BUDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner45fd9d52004-01-22 13:42:43 +0000335 if (DontPrintAnything) return;
Chris Lattner193e6922002-10-01 22:33:50 +0000336 printCollection(*this, O, M, "bu.");
Vikram S. Adve256776e2002-07-30 22:07:26 +0000337}
338
339void TDDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner45fd9d52004-01-22 13:42:43 +0000340 if (DontPrintAnything) return;
Chris Lattner193e6922002-10-01 22:33:50 +0000341 printCollection(*this, O, M, "td.");
Chris Lattner6b5acda2002-10-17 04:24:30 +0000342}
Brian Gaeke960707c2003-11-11 22:41:34 +0000343
Chris Lattnerbaef2342003-11-13 05:05:41 +0000344void CompleteBUDataStructures::print(std::ostream &O, const Module *M) const {
Chris Lattner45fd9d52004-01-22 13:42:43 +0000345 if (DontPrintAnything) return;
Chris Lattnerbaef2342003-11-13 05:05:41 +0000346 printCollection(*this, O, M, "cbu.");
347}
348
349
Chris Lattner68c3cac2005-03-13 19:51:24 +0000350void EquivClassGraphs::print(std::ostream &O, const Module *M) const {
351 if (DontPrintAnything) return;
352 printCollection(*this, O, M, "eq.");
353}
354