3 * File name: ir/ir/irdump.h
4 * Purpose: Write vcg representation of firm to file.
5 * Author: Martin Trapp, Christian Schaefer
6 * Modified by: Goetz Lindenmaier, Hubert Schmidt
9 * Copyright: (c) 1998-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
17 * Dump routines for the ir graph and all type information.
19 * @author Martin Trapp, Christian Schaefer
21 * The dump format of most functions is vcg. This is a text based graph
22 * representation. Some use the original format,
23 * but most generate an extended format that is only read by some special
24 * versions of xvcg or by the comercialized version now calles aiSee.
25 * A test version of aiSee is available at
26 * http://www.absint.de/aisee/download/index.htm.
28 * Most routines use the name of the passed entity as the name of the
41 /** Set this to the name (not the ld_name) of the method to be dumped. */
42 extern char *dump_file_filter;
47 * @param irg The firm graph to be dumped.
50 * A file containing the firm graph in vcg format.
52 * Dumps all Firm nodes of a single graph for a single procedure in
53 * standard xvcg format. Dumps the graph to a file. The file name
54 * is constructed from the name of the entity describing the
55 * procedure (irg->entity) and the ending -pure<-ip>.vcg. Eventually
56 * overwrites existing files. Visits all nodes in
57 * interprocedural_view.
59 * @see turn_off_edge_labels()
61 void dump_ir_graph (ir_graph *irg, const char *suffix);
62 #define dump_cg_graph dump_ir_graph
65 * Dump a firm graph without explicit block nodes.
67 * @param irg The firm graph to be dumped.
70 * A file containing the firm graph in vcg format.
72 * Dumps all Firm nodes of a single graph for a single procedure in
73 * extended xvcg format.
74 * Dumps the graph to a file. The file name is constructed from the
75 * name of the entity describing the procedure (irg->entity) and the
76 * ending <-ip>.vcg. Eventually overwrites existing files. Dumps several
77 * procedures in boxes if interprocedural_view.
79 * @see turn_off_edge_labels()
81 void dump_ir_block_graph (ir_graph *irg, const char *suffix);
82 #define dump_cg_block_graph dump_ir_block_graph
84 /** Dumps all graphs in interprocedural view to a file named All_graphs.vcg.
86 void dump_all_cg_block_graph(const char *suffix);
89 * Dumps a firm graph and all the type information needed for Calls,
90 * Sels, ... in this graph.
92 * @param irg The firm graph to be dumped with its type information.
95 * A file containing the firm graph and the type information of the firm graph in vcg format.
97 * Dumps the graph to a file. The file name is constructed from the
98 * name of the entity describing the procedure (irg->entity) and the
99 * ending -all.vcg. Eventually overwrites existing files.
101 * @see turn_off_edge_labels()
103 void dump_ir_graph_w_types (ir_graph *irg, const char *suffix);
106 * Dumps a firm graph and all the type information needed for Calls,
107 * Sels, ... in this graph.
109 * @param irg The firm graph to be dumped with its type information.
112 * A file containing the firm graph and the type information of the firm graph in vcg format.
114 * The graph is in blocked format.
115 * Dumps the graph to a file. The file name is constructed from the
116 * name of the entity describing the procedure (irg->entity) and the
117 * ending -all.vcg. Eventually overwrites existing files.
119 * @see turn_off_edge_labels()
121 void dump_ir_block_graph_w_types (ir_graph *irg, const char *suffix);
124 * The type of a walker function that is called for each graph.
126 * @param irg current visited graph
128 typedef void dump_graph_func(ir_graph *irg, const char *suffix);
131 * A walker that calls a dumper for each graph.
133 * @param dump_graph The dumper to be used for dumping.
136 * Whatever the dumper creates.
138 * Walks over all firm graphs and calls a dumper for each graph.
139 * The following dumpers can be passed as arguments:
141 * - dump_ir_block_graph()
143 * - dump_type_graph()
144 * - dump_ir_graph_w_types()
146 * @see turn_off_edge_labels()
148 void dump_all_ir_graphs (dump_graph_func *dump_graph, const char *suffix);
152 * Dump the control flow graph of a procedure.
154 * @param irg The firm graph whose CFG shall be dumped.
157 * A file containing the CFG in vcg format.
159 * Dumps the control flow graph of a procedure in standard xvcg format.
160 * Dumps the graph to a file. The file name is constructed from the
161 * name of the entity describing the procedure (irg->entity) and the
162 * ending -cfg.vcg. Eventually overwrites existing files.
164 * @see turn_off_edge_labels()
166 void dump_cfg (ir_graph *irg, const char *suffix);
169 /** Dump the call graph.
171 * Dumps the callgraph to a file "Callgraph"<suffix>".vcg".
173 void dump_callgraph(const char *suffix);
176 * Dumps all the type information needed for Calls, Sels, ... in this graph.
177 * Does not dump the graph!
179 * @param irg The firm graph whose type information is to be dumped.
181 * A file containing the type information of the firm graph in vcg format.
183 * Dumps this graph to a file. The file name is constructed from the
184 * name of the entity describing the procedure (irg->entity) and the
185 * ending -type.vcg. Eventually overwrites existing files.
187 * @see turn_off_edge_labels()
189 void dump_type_graph (ir_graph *irg, const char *suffix);
192 * Dumps all type information.
195 * A file containing all type information for the program in standard
198 * Dumps all type information that is somehow reachable in standard vcg
200 * Dumps the graph to a file named All_types.vcg.
202 * @see turn_off_edge_labels()
204 void dump_all_types (const char *suffix);
207 * Dumps the class hierarchy with or without entities.
209 * @param entities Flag whether to dump the entities.
212 * A file containing the class hierarchy tree for the program in standard
215 * Does not dump the global type.
216 * Dumps a node for all classes and the sub/supertype relations. If
217 * entities is set to true also dumps the entities of classes, but without
218 * any additional information as the entities type. The overwrites relation
219 * is dumped along with the entities.
220 * Dumps to a file class_hierarchy.vcg
222 void dump_class_hierarchy (bool entities, const char *suffix);
226 * Dump a standalone loop tree, which contains the loop nodes and the firm nodes
227 * belonging to one loop packed together in one subgraph. Dumps to file
228 * <name of irg><suffix>-looptree.vcg
229 * Turns on edge labels by default.
231 * Implementing this dumper was stimulated by Florian Liekwegs similar dumper.
233 * @arg irg Dump the loop tree for this graph.
234 * @arg suffix Suffix to filename.
236 void dump_loop_tree(ir_graph *irg, const char *suffix);
238 /** Dumps the firm nodes in the sub-loop-tree of loop to a graph.
239 * Dumps the loop nodes if dump_loop_information() is set.
241 * The name of the file is loop_<loop_nr><suffix>.vcg.
243 * @arg loop Dump the loop tree for this loop.
244 * @arg suffix Suffix to filename.
246 void dump_loop (ir_loop *l, const char *suffix);
248 /** Dumps the loop tree over the call graph.
250 * See for yourself what you can use this for.
251 * The filename is "Callgraph_looptree<suffix>.vcg".
253 * @arg suffix Suffix to filename.
255 void dump_callgraph_loop_tree(char *suffix);
257 /** Sets the vcg flag "display_edge_labels" to no.
259 * This is necessary as xvcg and aisee both fail to display graphs
260 * with self-edges if these edges have labes.
262 void turn_off_edge_labels(void);
265 * If set to true constants will be replicated for every use. In non
266 * blocked view edges from constant to block are scipped. Vcg then
267 * layouts the graphs more compact, this makes them better readable.
268 * The flag is automatically and temporarily set to false if other
269 * edges are dumped, as outs, loop, ...
270 * Default setting: false.
272 void dump_consts_local(bool b);
275 * Returns false if dump_out_edge_flag or dump_loop_information_flag
276 * are set, else returns dump_const_local_flag.
278 bool get_opt_dump_const_local(void);
281 * Turns off dumping the values of constant entities. Makes type graphs
284 void turn_off_constant_entity_values(void);
287 * Turns on dumping the edges from the End node to nodes to be kept
290 void dump_keepalive_edges(bool b);
291 bool get_opt_dump_keepalive_edges(void);
294 * Turns on dumping the out edges starting from the Start block in
295 * dump_ir_graph. To test the consistency of the out datastructure.
297 void dump_out_edges(void);
300 * If this flag is set the dumper dumps edges to immediate dominator in cfg.
302 void dump_dominator_information(void);
305 * If this flag is set the dumper dumps loop nodes and edges from
306 * these nodes to the contained ir nodes.
307 * Can be turned off with dont_dump_loop_information().
308 * If the loops are interprocedural nodes can be missing.
310 void dump_loop_information(void);
313 * @see dump_loop_information()
315 void dont_dump_loop_information(void);
318 * If set and backedge info is computed, backedges are dumped dashed
319 * and as vcg 'backedge' construct. Default: set.
321 void dump_backedge_information(bool b);
324 * Dump the information of type field specified in ana/irtypeinfo.h.
325 * If the flag is set, the type name is output in [] in the node label,
326 * else it is output as info.
328 void dump_analysed_type_info(bool b);
331 * Write the address of a node into the vcg info.
332 * This is off per default for automatic comparisons of
333 * vcg graphs -- these will differ in the pointer values!
335 void dump_pointer_values_to_info(bool b);
338 # endif /* _IRDUMP_H_ */