normalized various syntactic constructs for firm jni.
[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 typedef void (dump_graph_func)(ir_graph *);
251 void dump_all_ir_graphs (dump_graph_func *dump_graph);
252
253 /****m* irdump/turn_off_edge_labels
254  *
255  * NAME
256  *   turn_off_edge_labels
257  * SYNOPSIS
258  *   void turn_off_edge_labels();
259  * FUNCTION
260  *   Sets the vcg flag "display_edge_labels" to no.  This is necessary
261  *   as xvcg and aisee both fail to display graphs with self-edges if these
262  *   edges have labes.
263  * INPUTS
264  *   No inputs
265  * RESULT
266  *   dumpers will generate vcg flags with a different header.
267  * SEE ALSO
268  *
269  ***
270  */
271 void turn_off_edge_labels();
272
273 /****m* irdump/dump_consts_local
274  *
275  * NAME
276  *   dump_consts_local
277  * SYNOPSIS
278  *   void dump_consts_local(bool b);
279  * FUNCTION
280  *   If set to true constants will be replicated for every use. In non blocked
281  *   view edges from constant to block are scipped.  Vcg
282  *   then layouts the graphs more compact, this makes them better readable.
283  *   The flag is automatically and temporarily set to false if other
284  *   edges are dumped, as outs, loop, ...
285  *   Default setting: false.
286  * INPUTS
287  * RESULT
288  * SEE ALSO
289  *
290  ***
291  */
292 void dump_consts_local(bool b);
293
294
295 /****m* irdump/turn_off_constant_entity_values
296  *
297  * NAME
298  *   turn_off_constant_entity_values
299  * SYNOPSIS
300  *   void turn_off_constant_entity_values()
301  * FUNCTION
302  *   Turns off dumping the values of constant entities. Makes type graphs
303  *   better readable.
304  * INPUTS
305  *   No inputs
306  * RESULT
307  * SEE ALSO
308  *
309  ***
310  */
311 void turn_off_constant_entity_values();
312
313
314 /****m* irdump/dump_keepalive_edges
315  *
316  * NAME
317  *   dump_keepalive_edges
318  * SYNOPSIS
319  *   void dump_keepalive_edges()
320  * FUNCTION
321  *   Turns on dumping the edges from the End node to nodes to be kept
322  *   alive
323  * INPUTS
324  *   No inputs
325  * RESULT
326  * SEE ALSO
327  *
328  ***
329  */
330 void dump_keepalive_edges();
331
332
333 /****m* irdump/dump_out_edges
334  *
335  * NAME
336  *   dump_out_edges
337  * SYNOPSIS
338  *   void dump_out_edges()
339  * FUNCTION
340  *   Turns on dumping the out edges starting from the Start block in
341  *   dump_ir_graph.  To test the consistency of the out datastructure.
342  * INPUTS
343  *   No inputs
344  * RESULT
345  * SEE ALSO
346  *
347  ***
348  */
349 void dump_out_edges();
350
351
352 /****m* irdump/dump_dominator_information
353  *
354  * NAME
355  *   dump_dominator_information
356  * SYNOPSIS
357  *   void dump_dominator_information()
358  * FUNCTION
359  *   If this flag is set the dumper dumps edges to immediate dominator in cfg.
360  * INPUTS
361  *   No inputs
362  * RESULT
363  * SEE ALSO
364  *
365  ***
366  */
367 void dump_dominator_information();
368
369
370 /****m* irdump/dump_loop_information
371  *
372  * NAME
373  *   dump_loop_information
374  * SYNOPSIS
375  *   void dump_loop_information()
376  * FUNCTION
377  *   If this flag is set the dumper dumps loop nodes and edges from
378  *   these nodes to the contained ir nodes.
379  *   Can be turned off with dont_dump_loop_information().
380  *   If the loops are interprocedural nodes can be missing.
381  * INPUTS
382  *   No inputs
383  * RESULT
384  * SEE ALSO
385  *
386  ***
387  */
388 void dump_loop_information();
389 void dont_dump_loop_information();
390
391 # endif /* _IRDUMP_H_ */