Fixed function implemenation type
[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 /**
18  *
19  *   - dump routines for the graph and all type information
20  *   The dump format of most functions is vcg.  This is a text based graph
21  *   representation. Some use the original format,
22  *   but most generate an extended format that is only read by some special
23  *   versions of xvcg or by the comercialized version now calles aiSee.
24  *   A test version of aiSee is available at
25  *   http://www.absint.de/aisee/download/index.htm.
26  *
27  *   Most routines use the name of the passed entity as the name of the
28  *   file dumped to.
29  *
30  */
31
32 /* @@@ GL: A hack */
33 extern char *dump_file_suffix;
34
35 /**
36  *
37  *   - dump a firm graph
38  *  Dumps all Firm nodes of a single graph for a single procedure in
39  *  standard xvcg format.
40  *  Dumps the graph to a file.  The file name is constructed from the
41  *  name of the entity describing the procedure (irg->entity) and the
42  *  ending .vcg.  Eventually overwrites existing files.
43  *   @param irg: The firm graph to be dumped.
44  *   @return A file containing the firm graph in vcg format.
45  * @see turn_of_edge_labels
46  * @see
47  */
48 void dump_ir_graph (ir_graph *irg);
49
50 /**
51  *
52  *   - dump a firm graph without explicit block nodes.
53  *  Dumps all Firm nodes of a single graph for a single procedure in
54  *  extended xvcg format.
55  *  Dumps the graph to a file.  The file name is constructed from the
56  *  name of the entity describing the procedure (irg->entity) and the
57  *  ending .vcg.  Eventually overwrites existing files.
58  *   @param irg: The firm graph to be dumped.
59  *   @return A file containing the firm graph in vcg format.
60  * @see turn_of_edge_labels
61  * @see
62  */
63 void dump_ir_block_graph (ir_graph *irg);
64
65 /**
66  *
67  *   - Dump the control flow graph of a procedure
68  *   Dumps the control flow graph of a procedure in standard 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 -cfg.vcg.  Eventually overwrites existing files.
72  *   @param irg: The firm graph whose CFG shall be dumped.
73  *   @return A file containing the CFG in vcg format.
74  * @see turn_of_edge_labels
75  * @see
76  */
77 void dump_cfg (ir_graph *irg);
78
79 /**
80  *
81  *   -
82  *  Dumps all the type information needed for Calls, Sels, ... in this graph.
83  *  Dumps this graph to a file.  The file name is constructed from the
84  *  name of the entity describing the procedure (irg->entity) and the
85  *  ending -type.vcg.  Eventually overwrites existing files.
86  *  @param irg: The firm graph whose type information is to be dumped.
87  *  @return A file containing the type information of the firm graph in vcg format.
88  * @see turn_of_edge_labels
89  * @see
90  */
91 void dump_type_graph (ir_graph *irg);
92
93 /**
94  *
95  *   - Dumps all type information
96  *   Dumps all type information that is somehow reachable in standard vcg
97  *   format.
98  *   Dumps the graph to a file named All_types.vcg.
99  *   @param No inputs.
100  *   @return A file containing all type information for the program in standard
101  *   @return vcg format.
102  * @see turn_of_edge_labels
103  * @see
104  */
105 void dump_all_types (void);
106
107 /**
108  *
109  *    - Dumps the class hierarchy with or without entities.
110  *   Dumps a node for all classes and the sub/supertype relations.  If
111  *   entities is set to true also dumps the entities of classes, but without
112  *   any additional information as the entities type.  The overwrites relation
113  *   is dumped along with the entities.
114  *   Dumps to a file class_hierarchy.vcg
115  *   @param Flag whether to dump the entities.
116  *   @return A file containing the class hierarchy tree for the program in standard
117  *   @return vcg format.
118  * @see
119  * @see
120  */
121 void dump_class_hierarchy (bool entities);
122
123 /**
124  *
125  *   dump_ir_graph_w_types
126  *  Dumps a firm graph and  all the type information needed for Calls,
127  *  Sels, ... in this graph.
128  *  Dumps the graph to a file.  The file name is constructed from the
129  *  name of the entity describing the procedure (irg->entity) and the
130  *  ending -all.vcg.  Eventually overwrites existing files.
131  *   @param irg: The firm graph to be dumped with its type information.
132  *   @return A file containing the firm graph and the type information of the firm graph in vcg format.
133  * @see turn_of_edge_labels
134  * @see
135  */
136
137 void dump_ir_graph_w_types (ir_graph *irg);
138 /**
139  *
140  *   dump_ir_block_graph_w_types
141  *  Dumps a firm graph and  all the type information needed for Calls,
142  *  Sels, ... in this graph.  The graph is in blocked format.
143  *  Dumps the graph to a file.  The file name is constructed from the
144  *  name of the entity describing the procedure (irg->entity) and the
145  *  ending -all.vcg.  Eventually overwrites existing files.
146  *   @param irg: The firm graph to be dumped with its type information.
147  *   @return A file containing the firm graph and the type information of the firm graph in vcg format.
148  * @see turn_of_edge_labels
149  * @see
150  */
151 void dump_ir_block_graph_w_types (ir_graph *irg);
152
153
154
155 /**
156  *
157  *   dump_cg_graph
158  *  Dumps a interprocedural firm graph as dump_ir_graph.
159  *   @param irg: The firm graph to be dumped.
160  *   @return A file containing the firm graph in vcg format.
161  * @see
162  */
163 void dump_cg_graph(ir_graph * irg);
164
165 /**
166  *
167  *   dump_cg_block_graph
168  *  Dumps a interprocedural firm graph as dump_ir_block_graph.
169  *   @param irg: The firm graph to be dumped.
170  *   @return A file containing the firm graph in vcg format.
171  * @see
172  */
173 void dump_cg_block_graph(ir_graph * irg);
174
175
176 void dump_all_cg_block_graph();
177
178 /**
179  *
180  *   - a walker that calls a dumper for each graph
181  *   Walks over all firm graphs and  calls a dumper for each graph.
182  *   The following dumpers can be passed as arguments:
183  *   dump_ir_graph
184  *   dump_ir_block_graph
185  *   dump_cfg
186  *   dump_type_graph
187  *   dump_ir_graph_w_types
188  *   @param The dumper to be used for dumping.
189  *   @return Whatever the dumper creates.
190  * @see turn_of_edge_labels
191  * @see
192  */
193 typedef void (dump_graph_func)(ir_graph *);
194 void dump_all_ir_graphs (dump_graph_func *dump_graph);
195
196 /**
197  *
198  *   turn_off_edge_labels
199  *   Sets the vcg flag "display_edge_labels" to no.  This is necessary
200  *   as xvcg and aisee both fail to display graphs with self-edges if these
201  *   edges have labes.
202  *   @param No inputs
203  *   @return dumpers will generate vcg flags with a different header.
204  * @see
205  * @see
206  */
207 void turn_off_edge_labels();
208
209 /**
210  *
211  *   dump_consts_local
212  *   If set to true constants will be replicated for every use. In non blocked
213  *   view edges from constant to block are scipped.  Vcg
214  *   then layouts the graphs more compact, this makes them better readable.
215  *   The flag is automatically and temporarily set to false if other
216  *   edges are dumped, as outs, loop, ...
217  *   Default setting: false.
218  * @see
219  * @see
220  */
221 void dump_consts_local(bool b);
222
223
224 /**
225  *
226  *   turn_off_constant_entity_values
227  *   Turns off dumping the values of constant entities. Makes type graphs
228  *   better readable.
229  *   @param No inputs
230  * @see
231  * @see
232  */
233 void turn_off_constant_entity_values();
234
235
236 /**
237  *
238  *   dump_keepalive_edges
239  *   Turns on dumping the edges from the End node to nodes to be kept
240  *   alive
241  *   @param No inputs
242  * @see
243  * @see
244  */
245 void dump_keepalive_edges(bool b);
246
247
248 /**
249  *
250  *   dump_out_edges
251  *   Turns on dumping the out edges starting from the Start block in
252  *   dump_ir_graph.  To test the consistency of the out datastructure.
253  *   @param No inputs
254  * @see
255  * @see
256  */
257 void dump_out_edges();
258
259
260 /**
261  *
262  *   dump_dominator_information
263  *   If this flag is set the dumper dumps edges to immediate dominator in cfg.
264  *   @param No inputs
265  * @see
266  * @see
267  */
268 void dump_dominator_information();
269
270
271 /**
272  *
273  *   dump_loop_information
274  *   If this flag is set the dumper dumps loop nodes and edges from
275  *   these nodes to the contained ir nodes.
276  *   Can be turned off with dont_dump_loop_information().
277  *   If the loops are interprocedural nodes can be missing.
278  *   @param No inputs
279  * @see
280  * @see
281  */
282 void dump_loop_information();
283 void dont_dump_loop_information();
284
285 # endif /* _IRDUMP_H_ */