Added debug support
[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 http://www.absint.de/aisee/download/index.htm.
27  *
28  *   Most routines use the name of the passed entity as the name of the
29  *   file dumped to.
30  *
31  ******
32  */
33
34 #if 0
35 /* The following routines use a global variable that is not external.
36    Therefore removed from interface. */
37 /* dump a simple node */
38 void dump_ir_node (ir_node *node);
39 /* dump the edge to the block this node belongs to */
40 void dump_ir_block_edge(ir_node *n);
41 /* dump edges to our inputs */
42 void dump_ir_data_edges(ir_node *n);
43 #endif
44 /* @@@ GL: A hack */
45 extern char *dump_file_suffix;
46
47 /****m* irdump/dump_ir_graph
48  *
49  * NAME
50  *   dump_ir_graph  -- dump a firm graph
51  * SYNOPSIS
52  *  void dump_ir_graph (ir_graph *irg);
53  * FUNCTION
54  *  Dumps all Firm nodes of a single graph for a single procedure in
55  *  standard xvcg format.
56  *  Dumps the graph to a file.  The file name is constructed from the
57  *  name of the entity describing the procedure (irg->entity) and the
58  *  ending .vcg.  Eventually overwrites existing files.
59  * INPUTS
60  *   irg: The firm graph to be dumped.
61  * RESULT
62  *   A file containing the firm graph in vcg format.
63  * SEE ALSO
64  *  turn_of_edge_labels
65  ***
66  */
67 void dump_ir_graph (ir_graph *irg);
68
69 /****m* irdump/dump_ir_block_graph
70  *
71  * NAME
72  *   dump_ir_block_graph -- dump a firm graph without explicit block nodes.
73  * SYNOPSIS
74  *   void dump_ir_block_graph (ir_graph *irg);
75  * FUNCTION
76  *  Dumps all Firm nodes of a single graph for a single procedure in
77  *  extended xvcg format.
78  *  Dumps the graph to a file.  The file name is constructed from the
79  *  name of the entity describing the procedure (irg->entity) and the
80  *  ending .vcg.  Eventually overwrites existing files.
81  * INPUTS
82  *   irg: The firm graph to be dumped.
83  * RESULT
84  *   A file containing the firm graph in vcg format.
85  * SEE ALSO
86  *  turn_of_edge_labels
87  ***
88  */
89 void dump_ir_block_graph (ir_graph *irg);
90
91 /****m* irdump/dump_cfg
92  *
93  * NAME
94  *   dump_cfg -- Dump the control flow graph of a procedure
95  * SYNOPSIS
96  *   void dump_cfg (ir_graph *irg);
97  * FUNCTION
98  *   Dumps the control flow graph of a procedure in standard xvcg format.
99  *   Dumps the graph to a file.  The file name is constructed from the
100  *   name of the entity describing the procedure (irg->entity) and the
101  *   ending -cfg.vcg.  Eventually overwrites existing files.
102  * INPUTS
103  *   irg: The firm graph whose CFG shall be dumped.
104  * RESULT
105  *   A file containing the CFG in vcg format.
106  * SEE ALSO
107  *  turn_of_edge_labels
108  ***
109  */
110 void dump_cfg (ir_graph *irg);
111
112 /****m* irdump/dump_type_graph
113  *
114  * NAME
115  *   dump_type_graph --
116  * SYNOPSIS
117  *   void dump_type_graph (ir_graph *irg);
118  * FUNCTION
119  *  Dumps all the type information needed for Calls, Sels, ... in this graph.
120  *  Dumps this graph to a file.  The file name is constructed from the
121  *  name of the entity describing the procedure (irg->entity) and the
122  *  ending -type.vcg.  Eventually overwrites existing files.
123  * INPUTS
124  *  irg: The firm graph whose type information is to be dumped.
125  * RESULT
126  *  A file containing the type information of the firm graph in vcg format.
127  * SEE ALSO
128  *  turn_of_edge_labels
129  ***
130  */
131 void dump_type_graph (ir_graph *irg);
132
133 /****m* irdump/dump_all_types
134  *
135  * NAME
136  *   dump_all_types -- Dumps all type information
137  * SYNOPSIS
138  *   void dump_all_types (void);
139  * FUNCTION
140  *   Dumps all type information that is somehow reachable in standard vcg
141  *   format.
142  *   Dumps the graph to a file named All_types.vcg.
143  * INPUTS
144  *   No inputs.
145  * RESULT
146  *   A file containing all type information for the program in standard
147  *   vcg format.
148  * SEE ALSO
149  *  turn_of_edge_labels
150  ***
151  */
152 void dump_all_types (void);
153
154 /****m* irdump/dump_ir_graph_w_types
155  *
156  * NAME
157  *   dump_ir_graph_w_types
158  * SYNOPSIS
159  *   void dump_ir_graph_w_types (ir_graph *irg);
160  * FUNCTION
161  *  Dumps a firm graph and  all the type information needed for Calls,
162  *  Sels, ... in this graph.
163  *  Dumps the graph to a file.  The file name is constructed from the
164  *  name of the entity describing the procedure (irg->entity) and the
165  *  ending -all.vcg.  Eventually overwrites existing files.
166  * INPUTS
167  *   irg: The firm graph to be dumped with its type information.
168  * RESULT
169  *   A file containing the firm graph and the type information of the firm graph in vcg format.
170  * SEE ALSO
171  *  turn_of_edge_labels
172  ***
173  */
174
175 void dump_ir_graph_w_types (ir_graph *irg);
176  /****m* irdump/dump_ir_block_graph_w_types
177  *
178  * NAME
179  *   dump_ir_block_graph_w_types
180  * SYNOPSIS
181  *   void dump_ir_block_graph_w_types (ir_graph *irg);
182  * FUNCTION
183  *  Dumps a firm graph and  all the type information needed for Calls,
184  *  Sels, ... in this graph.  The graph is in blocked format.
185  *  Dumps the graph to a file.  The file name is constructed from the
186  *  name of the entity describing the procedure (irg->entity) and the
187  *  ending -all.vcg.  Eventually overwrites existing files.
188  * INPUTS
189  *   irg: The firm graph to be dumped with its type information.
190  * RESULT
191  *   A file containing the firm graph and the type information of the firm graph in vcg format.
192  * SEE ALSO
193  *  turn_of_edge_labels
194  ***
195  */
196 void dump_ir_block_graph_w_types (ir_graph *irg);
197
198 /****m* irdump/dump_all_ir_graphs
199  *
200  * NAME
201  *   dump_all_ir_graphs -- a walker that calls a dumper for each graph
202  * SYNOPSIS
203  *   void dump_all_ir_graphs (void dump_graph(ir_graph*));
204  * FUNCTION
205  *   Walks over all firm graphs and  calls a dumper for each graph.
206  *   The following dumpers can be passed as arguments:
207  *   dump_ir_graph
208  *   dump_ir_block_graph
209  *   dump_cfg
210  *   dump_type_graph
211  *   dump_ir_graph_w_types
212  * INPUTS
213  *   The dumper to be used for dumping.
214  * RESULT
215  *   Whatever the dumper creates.
216  * SEE ALSO
217  *  turn_of_edge_labels
218  ***
219  */
220 void dump_all_ir_graphs (void dump_graph(ir_graph*));
221
222 /****m* irdump/turn_off_edge_labels
223  *
224  * NAME
225  *   turn_off_edge_labels
226  * SYNOPSIS
227  *   void turn_off_edge_labels();
228  * FUNCTION
229  *   Sets the vcg flag "display_edge_labels" to no.  This is necessary
230  *   as xvcg and aisee both fail to display graphs with self-edges if these
231  *   edges have labes.
232  * INPUTS
233  *   No inputs
234  * RESULT
235  *   dumpers will generate vcg flags with a different header.
236  * SEE ALSO
237  *
238  ***
239  */
240 void turn_off_edge_labels();
241
242
243 /****m* irdump/turn_off_constant_entity_values
244  *
245  * NAME
246  *   turn_off_constant_entity_values
247  * SYNOPSIS
248  *   void turn_off_constant_entity_values()
249  * FUNCTION
250  *   Turns off dumping the values of constant entities. Makes type graphs
251  *   better readable.
252  * INPUTS
253  *   No inputs
254  * RESULT
255  * SEE ALSO
256  *
257  ***
258  */
259 void turn_off_constant_entity_values();
260
261
262 /****m* irdump/dump_keepalive_edges
263  *
264  * NAME
265  *   dump_keepalive_edges
266  * SYNOPSIS
267  *   void dump_keepalive_edges()
268  * FUNCTION
269  *   Turns on dumping the edges from the End node to nodes to be kept
270  *   alive
271  * INPUTS
272  *   No inputs
273  * RESULT
274  * SEE ALSO
275  *
276  ***
277  */
278 void dump_keepalive_edges();
279
280
281 /****m* irdump/dump_out_edges
282  *
283  * NAME
284  *   dump_out_edges
285  * SYNOPSIS
286  *   void dump_out_edges()
287  * FUNCTION
288  *   Turns on dumping the out edges starting from the Start block in
289  *   dump_ir_graph.  To test the consistency of the out datastructure.
290  * INPUTS
291  *   No inputs
292  * RESULT
293  * SEE ALSO
294  *
295  ***
296  */
297 void dump_out_edges();
298
299
300 /****m* irdump/dump_dominator_information
301  *
302  * NAME
303  *   dump_dominator_information
304  * SYNOPSIS
305  *   void dump_dominator_information()
306  * FUNCTION
307  *   If this flag is set the dumper dumps edges to immediate dominator in cfg.
308  * INPUTS
309  *   No inputs
310  * RESULT
311  * SEE ALSO
312  *
313  ***
314  */
315 void dump_dominator_information();
316
317
318 # endif /* _IRDUMP_H_ */