Bugfix line 1465
[libfirm] / ir / ir / irdump.h
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Authors: Martin Trapp, Christian Schaefer
5 **
6 ** dump an ir graph, for further use with xvcg
7 */
8
9 /* $Id$ */
10
11 # ifndef _IRDUMP_H_
12 # define _IRDUMP_H_
13
14 # include "irnode.h"
15 # include "irgraph.h"
16
17 /****h* libfirm/irdump
18  *
19  * NAME
20  *   irdump -- dump routines for the graph and all type information
21  * NOTES
22  *   The dump format of most functions is vcg.  This is a text based graph
23  *   representation. Some use the original format,
24  *   but most generate an extended format that is only read by some special
25  *   versions of xvcg or by the comercialized version now calles aiSee.
26  *   A test version of aiSee is available at
27  *   http://www.absint.de/aisee/download/index.htm.
28  *
29  *   Most routines use the name of the passed entity as the name of the
30  *   file dumped to.
31  *
32  ******
33  */
34
35 /* @@@ GL: A hack */
36 extern char *dump_file_suffix;
37
38 /****m* irdump/dump_ir_graph
39  *
40  * NAME
41  *   dump_ir_graph  -- dump a firm graph
42  * SYNOPSIS
43  *  void dump_ir_graph (ir_graph *irg);
44  * FUNCTION
45  *  Dumps all Firm nodes of a single graph for a single procedure in
46  *  standard xvcg format.
47  *  Dumps the graph to a file.  The file name is constructed from the
48  *  name of the entity describing the procedure (irg->entity) and the
49  *  ending .vcg.  Eventually overwrites existing files.
50  * INPUTS
51  *   irg: The firm graph to be dumped.
52  * RESULT
53  *   A file containing the firm graph in vcg format.
54  * SEE ALSO
55  *  turn_of_edge_labels
56  ***
57  */
58 void dump_ir_graph (ir_graph *irg);
59
60 /****m* irdump/dump_ir_block_graph
61  *
62  * NAME
63  *   dump_ir_block_graph -- dump a firm graph without explicit block nodes.
64  * SYNOPSIS
65  *   void dump_ir_block_graph (ir_graph *irg);
66  * FUNCTION
67  *  Dumps all Firm nodes of a single graph for a single procedure in
68  *  extended xvcg format.
69  *  Dumps the graph to a file.  The file name is constructed from the
70  *  name of the entity describing the procedure (irg->entity) and the
71  *  ending .vcg.  Eventually overwrites existing files.
72  * INPUTS
73  *   irg: The firm graph to be dumped.
74  * RESULT
75  *   A file containing the firm graph in vcg format.
76  * SEE ALSO
77  *  turn_of_edge_labels
78  ***
79  */
80 void dump_ir_block_graph (ir_graph *irg);
81
82 /****m* irdump/dump_cfg
83  *
84  * NAME
85  *   dump_cfg -- Dump the control flow graph of a procedure
86  * SYNOPSIS
87  *   void dump_cfg (ir_graph *irg);
88  * FUNCTION
89  *   Dumps the control flow graph of a procedure in standard xvcg format.
90  *   Dumps the graph to a file.  The file name is constructed from the
91  *   name of the entity describing the procedure (irg->entity) and the
92  *   ending -cfg.vcg.  Eventually overwrites existing files.
93  * INPUTS
94  *   irg: The firm graph whose CFG shall be dumped.
95  * RESULT
96  *   A file containing the CFG in vcg format.
97  * SEE ALSO
98  *  turn_of_edge_labels
99  ***
100  */
101 void dump_cfg (ir_graph *irg);
102
103 /****m* irdump/dump_type_graph
104  *
105  * NAME
106  *   dump_type_graph --
107  * SYNOPSIS
108  *   void dump_type_graph (ir_graph *irg);
109  * FUNCTION
110  *  Dumps all the type information needed for Calls, Sels, ... in this graph.
111  *  Dumps this graph to a file.  The file name is constructed from the
112  *  name of the entity describing the procedure (irg->entity) and the
113  *  ending -type.vcg.  Eventually overwrites existing files.
114  * INPUTS
115  *  irg: The firm graph whose type information is to be dumped.
116  * RESULT
117  *  A file containing the type information of the firm graph in vcg format.
118  * SEE ALSO
119  *  turn_of_edge_labels
120  ***
121  */
122 void dump_type_graph (ir_graph *irg);
123
124 /****m* irdump/dump_all_types
125  *
126  * NAME
127  *   dump_all_types -- Dumps all type information
128  * SYNOPSIS
129  *   void dump_all_types (void);
130  * FUNCTION
131  *   Dumps all type information that is somehow reachable in standard vcg
132  *   format.
133  *   Dumps the graph to a file named All_types.vcg.
134  * INPUTS
135  *   No inputs.
136  * RESULT
137  *   A file containing all type information for the program in standard
138  *   vcg format.
139  * SEE ALSO
140  *  turn_of_edge_labels
141  ***
142  */
143 void dump_all_types (void);
144
145 /****m* irdump/dump_ir_graph_w_types
146  *
147  * NAME
148  *   dump_ir_graph_w_types
149  * SYNOPSIS
150  *   void dump_ir_graph_w_types (ir_graph *irg);
151  * FUNCTION
152  *  Dumps a firm graph and  all the type information needed for Calls,
153  *  Sels, ... in this graph.
154  *  Dumps the graph to a file.  The file name is constructed from the
155  *  name of the entity describing the procedure (irg->entity) and the
156  *  ending -all.vcg.  Eventually overwrites existing files.
157  * INPUTS
158  *   irg: The firm graph to be dumped with its type information.
159  * RESULT
160  *   A file containing the firm graph and the type information of the firm graph in vcg format.
161  * SEE ALSO
162  *  turn_of_edge_labels
163  ***
164  */
165
166 void dump_ir_graph_w_types (ir_graph *irg);
167  /****m* irdump/dump_ir_block_graph_w_types
168  *
169  * NAME
170  *   dump_ir_block_graph_w_types
171  * SYNOPSIS
172  *   void dump_ir_block_graph_w_types (ir_graph *irg);
173  * FUNCTION
174  *  Dumps a firm graph and  all the type information needed for Calls,
175  *  Sels, ... in this graph.  The graph is in blocked format.
176  *  Dumps the graph to a file.  The file name is constructed from the
177  *  name of the entity describing the procedure (irg->entity) and the
178  *  ending -all.vcg.  Eventually overwrites existing files.
179  * INPUTS
180  *   irg: The firm graph to be dumped with its type information.
181  * RESULT
182  *   A file containing the firm graph and the type information of the firm graph in vcg format.
183  * SEE ALSO
184  *  turn_of_edge_labels
185  ***
186  */
187 void dump_ir_block_graph_w_types (ir_graph *irg);
188
189
190
191 /****m* irdump/dump_cg_graph
192  *
193  * NAME
194  *   dump_cg_graph
195  * SYNOPSIS
196  *   void dump_cg_graph (ir_graph *irg);
197  * FUNCTION
198  *  Dumps a interprocedural firm graph as dump_ir_graph.
199  * INPUTS
200  *   irg: The firm graph to be dumped.
201  * RESULT
202  *   A file containing the firm graph in vcg format.
203  * SEE ALSO
204  ***
205  */
206 void dump_cg_graph(ir_graph * irg);
207
208 /****m* irdump/dump_cg_block_graph
209  *
210  * NAME
211  *   dump_cg_block_graph
212  * SYNOPSIS
213  *   void dump_cg_block_graph (ir_graph *irg);
214  * FUNCTION
215  *  Dumps a interprocedural firm graph as dump_ir_block_graph.
216  * INPUTS
217  *   irg: The firm graph to be dumped.
218  * RESULT
219  *   A file containing the firm graph in vcg format.
220  * SEE ALSO
221  ***
222  */
223 void dump_cg_block_graph(ir_graph * irg);
224
225
226 void dump_all_cg_block_graph();
227
228 /****m* irdump/dump_all_ir_graphs
229  *
230  * NAME
231  *   dump_all_ir_graphs -- a walker that calls a dumper for each graph
232  * SYNOPSIS
233  *   void dump_all_ir_graphs (void dump_graph(ir_graph*));
234  * FUNCTION
235  *   Walks over all firm graphs and  calls a dumper for each graph.
236  *   The following dumpers can be passed as arguments:
237  *   dump_ir_graph
238  *   dump_ir_block_graph
239  *   dump_cfg
240  *   dump_type_graph
241  *   dump_ir_graph_w_types
242  * INPUTS
243  *   The dumper to be used for dumping.
244  * RESULT
245  *   Whatever the dumper creates.
246  * SEE ALSO
247  *  turn_of_edge_labels
248  ***
249  */
250 void dump_all_ir_graphs (void dump_graph(ir_graph*));
251
252 /****m* irdump/turn_off_edge_labels
253  *
254  * NAME
255  *   turn_off_edge_labels
256  * SYNOPSIS
257  *   void turn_off_edge_labels();
258  * FUNCTION
259  *   Sets the vcg flag "display_edge_labels" to no.  This is necessary
260  *   as xvcg and aisee both fail to display graphs with self-edges if these
261  *   edges have labes.
262  * INPUTS
263  *   No inputs
264  * RESULT
265  *   dumpers will generate vcg flags with a different header.
266  * SEE ALSO
267  *
268  ***
269  */
270 void turn_off_edge_labels();
271
272 /****m* irdump/dump_consts_local
273  *
274  * NAME
275  *   dump_consts_local
276  * SYNOPSIS
277  *   void dump_consts_local(bool b);
278  * FUNCTION
279  *   If set to true constants will be replicated for every use. In non blocked
280  *   view edges from constant to block are scipped.  Vcg
281  *   then layouts the graphs more compact, this makes them better readable.
282  *   The flag is automatically and temporarily set to false if other
283  *   edges are dumped, as outs, loop, ...
284  *   Default setting: false.
285  * INPUTS
286  * RESULT
287  * SEE ALSO
288  *
289  ***
290  */
291 void dump_consts_local(bool b);
292
293
294 /****m* irdump/turn_off_constant_entity_values
295  *
296  * NAME
297  *   turn_off_constant_entity_values
298  * SYNOPSIS
299  *   void turn_off_constant_entity_values()
300  * FUNCTION
301  *   Turns off dumping the values of constant entities. Makes type graphs
302  *   better readable.
303  * INPUTS
304  *   No inputs
305  * RESULT
306  * SEE ALSO
307  *
308  ***
309  */
310 void turn_off_constant_entity_values();
311
312
313 /****m* irdump/dump_keepalive_edges
314  *
315  * NAME
316  *   dump_keepalive_edges
317  * SYNOPSIS
318  *   void dump_keepalive_edges()
319  * FUNCTION
320  *   Turns on dumping the edges from the End node to nodes to be kept
321  *   alive
322  * INPUTS
323  *   No inputs
324  * RESULT
325  * SEE ALSO
326  *
327  ***
328  */
329 void dump_keepalive_edges();
330
331
332 /****m* irdump/dump_out_edges
333  *
334  * NAME
335  *   dump_out_edges
336  * SYNOPSIS
337  *   void dump_out_edges()
338  * FUNCTION
339  *   Turns on dumping the out edges starting from the Start block in
340  *   dump_ir_graph.  To test the consistency of the out datastructure.
341  * INPUTS
342  *   No inputs
343  * RESULT
344  * SEE ALSO
345  *
346  ***
347  */
348 void dump_out_edges();
349
350
351 /****m* irdump/dump_dominator_information
352  *
353  * NAME
354  *   dump_dominator_information
355  * SYNOPSIS
356  *   void dump_dominator_information()
357  * FUNCTION
358  *   If this flag is set the dumper dumps edges to immediate dominator in cfg.
359  * INPUTS
360  *   No inputs
361  * RESULT
362  * SEE ALSO
363  *
364  ***
365  */
366 void dump_dominator_information();
367
368
369 /****m* irdump/dump_loop_information
370  *
371  * NAME
372  *   dump_loop_information
373  * SYNOPSIS
374  *   void dump_loop_information()
375  * FUNCTION
376  *   If this flag is set the dumper dumps loop nodes and edges from
377  *   these nodes to the contained ir nodes.
378  *   Can be turned off with dont_dump_loop_information().
379  *   If the loops are interprocedural nodes can be missing.
380  * INPUTS
381  *   No inputs
382  * RESULT
383  * SEE ALSO
384  *
385  ***
386  */
387 void dump_loop_information();
388 void dont_dump_loop_information();
389
390 # endif /* _IRDUMP_H_ */