1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer
6 ** dump an ir graph, for further use with xvcg
17 /****h* libfirm/irdump
20 * irdump -- dump routines for the graph and all type information
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.
29 * Most routines use the name of the passed entity as the name of the
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);
46 extern char *dump_file_suffix;
48 /****m* irdump/dump_ir_graph
51 * dump_ir_graph -- dump a firm graph
53 * void dump_ir_graph (ir_graph *irg);
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.
61 * irg: The firm graph to be dumped.
63 * A file containing the firm graph in vcg format.
68 void dump_ir_graph (ir_graph *irg);
70 /****m* irdump/dump_ir_block_graph
73 * dump_ir_block_graph -- dump a firm graph without explicit block nodes.
75 * void dump_ir_block_graph (ir_graph *irg);
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.
83 * irg: The firm graph to be dumped.
85 * A file containing the firm graph in vcg format.
90 void dump_ir_block_graph (ir_graph *irg);
92 /****m* irdump/dump_cfg
95 * dump_cfg -- Dump the control flow graph of a procedure
97 * void dump_cfg (ir_graph *irg);
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.
104 * irg: The firm graph whose CFG shall be dumped.
106 * A file containing the CFG in vcg format.
108 * turn_of_edge_labels
111 void dump_cfg (ir_graph *irg);
113 /****m* irdump/dump_type_graph
118 * void dump_type_graph (ir_graph *irg);
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.
125 * irg: The firm graph whose type information is to be dumped.
127 * A file containing the type information of the firm graph in vcg format.
129 * turn_of_edge_labels
132 void dump_type_graph (ir_graph *irg);
134 /****m* irdump/dump_all_types
137 * dump_all_types -- Dumps all type information
139 * void dump_all_types (void);
141 * Dumps all type information that is somehow reachable in standard vcg
143 * Dumps the graph to a file named All_types.vcg.
147 * A file containing all type information for the program in standard
150 * turn_of_edge_labels
153 void dump_all_types (void);
155 /****m* irdump/dump_ir_graph_w_types
158 * dump_ir_graph_w_types
160 * void dump_ir_graph_w_types (ir_graph *irg);
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.
168 * irg: The firm graph to be dumped with its type information.
170 * A file containing the firm graph and the type information of the firm graph in vcg format.
172 * turn_of_edge_labels
176 void dump_ir_graph_w_types (ir_graph *irg);
177 /****m* irdump/dump_ir_block_graph_w_types
180 * dump_ir_block_graph_w_types
182 * void dump_ir_block_graph_w_types (ir_graph *irg);
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.
190 * irg: The firm graph to be dumped with its type information.
192 * A file containing the firm graph and the type information of the firm graph in vcg format.
194 * turn_of_edge_labels
197 void dump_ir_block_graph_w_types (ir_graph *irg);
201 /****m* irdump/dump_cg_graph
206 * void dump_cg_graph (ir_graph *irg);
208 * Dumps a interprocedural firm graph as dump_ir_graph.
210 * irg: The firm graph to be dumped.
212 * A file containing the firm graph in vcg format.
216 void dump_cg_graph(ir_graph * irg);
218 /****m* irdump/dump_cg_block_graph
221 * dump_cg_block_graph
223 * void dump_cg_block_graph (ir_graph *irg);
225 * Dumps a interprocedural firm graph as dump_ir_block_graph.
227 * irg: The firm graph to be dumped.
229 * A file containing the firm graph in vcg format.
233 void dump_cg_block_graph(ir_graph * irg);
236 void dump_all_cg_block_graph();
238 /****m* irdump/dump_all_ir_graphs
241 * dump_all_ir_graphs -- a walker that calls a dumper for each graph
243 * void dump_all_ir_graphs (void dump_graph(ir_graph*));
245 * Walks over all firm graphs and calls a dumper for each graph.
246 * The following dumpers can be passed as arguments:
248 * dump_ir_block_graph
251 * dump_ir_graph_w_types
253 * The dumper to be used for dumping.
255 * Whatever the dumper creates.
257 * turn_of_edge_labels
260 void dump_all_ir_graphs (void dump_graph(ir_graph*));
262 /****m* irdump/turn_off_edge_labels
265 * turn_off_edge_labels
267 * void turn_off_edge_labels();
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
275 * dumpers will generate vcg flags with a different header.
280 void turn_off_edge_labels();
282 /****m* irdump/dump_consts_local
287 * void dump_consts_local(bool b);
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.
301 void dump_consts_local(bool b);
304 /****m* irdump/turn_off_constant_entity_values
307 * turn_off_constant_entity_values
309 * void turn_off_constant_entity_values()
311 * Turns off dumping the values of constant entities. Makes type graphs
320 void turn_off_constant_entity_values();
323 /****m* irdump/dump_keepalive_edges
326 * dump_keepalive_edges
328 * void dump_keepalive_edges()
330 * Turns on dumping the edges from the End node to nodes to be kept
339 void dump_keepalive_edges();
342 /****m* irdump/dump_out_edges
347 * void dump_out_edges()
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.
358 void dump_out_edges();
361 /****m* irdump/dump_dominator_information
364 * dump_dominator_information
366 * void dump_dominator_information()
368 * If this flag is set the dumper dumps edges to immediate dominator in cfg.
376 void dump_dominator_information();
379 /****m* irdump/dump_loop_information
382 * dump_loop_information
384 * void dump_loop_information()
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.
397 void dump_loop_information();
398 void dont_dump_loop_information();
400 # endif /* _IRDUMP_H_ */