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