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 extern char *dump_file_suffix;
38 /****m* irdump/dump_ir_graph
41 * dump_ir_graph -- dump a firm graph
43 * void dump_ir_graph (ir_graph *irg);
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.
51 * irg: The firm graph to be dumped.
53 * A file containing the firm graph in vcg format.
58 void dump_ir_graph (ir_graph *irg);
60 /****m* irdump/dump_ir_block_graph
63 * dump_ir_block_graph -- dump a firm graph without explicit block nodes.
65 * void dump_ir_block_graph (ir_graph *irg);
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.
73 * irg: The firm graph to be dumped.
75 * A file containing the firm graph in vcg format.
80 void dump_ir_block_graph (ir_graph *irg);
82 /****m* irdump/dump_cfg
85 * dump_cfg -- Dump the control flow graph of a procedure
87 * void dump_cfg (ir_graph *irg);
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.
94 * irg: The firm graph whose CFG shall be dumped.
96 * A file containing the CFG in vcg format.
101 void dump_cfg (ir_graph *irg);
103 /****m* irdump/dump_type_graph
108 * void dump_type_graph (ir_graph *irg);
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.
115 * irg: The firm graph whose type information is to be dumped.
117 * A file containing the type information of the firm graph in vcg format.
119 * turn_of_edge_labels
122 void dump_type_graph (ir_graph *irg);
124 /****m* irdump/dump_all_types
127 * dump_all_types -- Dumps all type information
129 * void dump_all_types (void);
131 * Dumps all type information that is somehow reachable in standard vcg
133 * Dumps the graph to a file named All_types.vcg.
137 * A file containing all type information for the program in standard
140 * turn_of_edge_labels
143 void dump_all_types (void);
145 /****m* irdump/dump_ir_graph_w_types
148 * dump_ir_graph_w_types
150 * void dump_ir_graph_w_types (ir_graph *irg);
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.
158 * irg: The firm graph to be dumped with its type information.
160 * A file containing the firm graph and the type information of the firm graph in vcg format.
162 * turn_of_edge_labels
166 void dump_ir_graph_w_types (ir_graph *irg);
167 /****m* irdump/dump_ir_block_graph_w_types
170 * dump_ir_block_graph_w_types
172 * void dump_ir_block_graph_w_types (ir_graph *irg);
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.
180 * irg: The firm graph to be dumped with its type information.
182 * A file containing the firm graph and the type information of the firm graph in vcg format.
184 * turn_of_edge_labels
187 void dump_ir_block_graph_w_types (ir_graph *irg);
191 /****m* irdump/dump_cg_graph
196 * void dump_cg_graph (ir_graph *irg);
198 * Dumps a interprocedural firm graph as dump_ir_graph.
200 * irg: The firm graph to be dumped.
202 * A file containing the firm graph in vcg format.
206 void dump_cg_graph(ir_graph * irg);
208 /****m* irdump/dump_cg_block_graph
211 * dump_cg_block_graph
213 * void dump_cg_block_graph (ir_graph *irg);
215 * Dumps a interprocedural firm graph as dump_ir_block_graph.
217 * irg: The firm graph to be dumped.
219 * A file containing the firm graph in vcg format.
223 void dump_cg_block_graph(ir_graph * irg);
226 void dump_all_cg_block_graph();
228 /****m* irdump/dump_all_ir_graphs
231 * dump_all_ir_graphs -- a walker that calls a dumper for each graph
233 * void dump_all_ir_graphs (void dump_graph(ir_graph*));
235 * Walks over all firm graphs and calls a dumper for each graph.
236 * The following dumpers can be passed as arguments:
238 * dump_ir_block_graph
241 * dump_ir_graph_w_types
243 * The dumper to be used for dumping.
245 * Whatever the dumper creates.
247 * turn_of_edge_labels
250 typedef void (dump_graph_func)(ir_graph *);
251 void dump_all_ir_graphs (dump_graph_func *dump_graph);
253 /****m* irdump/turn_off_edge_labels
256 * turn_off_edge_labels
258 * void turn_off_edge_labels();
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
266 * dumpers will generate vcg flags with a different header.
271 void turn_off_edge_labels();
273 /****m* irdump/dump_consts_local
278 * void dump_consts_local(bool b);
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.
292 void dump_consts_local(bool b);
295 /****m* irdump/turn_off_constant_entity_values
298 * turn_off_constant_entity_values
300 * void turn_off_constant_entity_values()
302 * Turns off dumping the values of constant entities. Makes type graphs
311 void turn_off_constant_entity_values();
314 /****m* irdump/dump_keepalive_edges
317 * dump_keepalive_edges
319 * void dump_keepalive_edges()
321 * Turns on dumping the edges from the End node to nodes to be kept
330 void dump_keepalive_edges(bool b);
333 /****m* irdump/dump_out_edges
338 * void dump_out_edges()
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.
349 void dump_out_edges();
352 /****m* irdump/dump_dominator_information
355 * dump_dominator_information
357 * void dump_dominator_information()
359 * If this flag is set the dumper dumps edges to immediate dominator in cfg.
367 void dump_dominator_information();
370 /****m* irdump/dump_loop_information
373 * dump_loop_information
375 * void dump_loop_information()
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.
388 void dump_loop_information();
389 void dont_dump_loop_information();
391 # endif /* _IRDUMP_H_ */