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
40 * The value of this string will be added to the file name before .vcg
42 * @todo GL: A hack -- add parameter to dumper function.
44 extern char *dump_file_suffix;
49 * @param irg The firm graph to be dumped.
52 * A file containing the firm graph in vcg format.
54 * Dumps all Firm nodes of a single graph for a single procedure in
55 * standard xvcg format. Dumps the graph to a file. The file name
56 * is constructed from the name of the entity describing the
57 * procedure (irg->entity) and the ending -pure<-ip>.vcg. Eventually
58 * overwrites existing files. Visits all nodes in
59 * interprocedural_view.
61 * @see turn_off_edge_labels()
63 void dump_ir_graph (ir_graph *irg);
64 #define dump_cg_graph dump_ir_graph
67 * Dump a firm graph without explicit block nodes.
69 * @param irg The firm graph to be dumped.
72 * A file containing the firm graph in vcg format.
74 * Dumps all Firm nodes of a single graph for a single procedure in
75 * extended xvcg format.
76 * Dumps the graph to a file. The file name is constructed from the
77 * name of the entity describing the procedure (irg->entity) and the
78 * ending <-ip>.vcg. Eventually overwrites existing files. Dumps several
79 * procedures in boxes if interprocedural_view.
81 * @see turn_off_edge_labels()
83 void dump_ir_block_graph (ir_graph *irg);
84 #define dump_cg_block_graph dump_ir_block_graph
86 /** Dumps all graphs in interprocedural view to a file named All_graphs.vcg.
88 void dump_all_cg_block_graph(void);
91 * Dumps a firm graph and all the type information needed for Calls,
92 * Sels, ... in this graph.
94 * @param irg The firm graph to be dumped with its type information.
97 * A file containing the firm graph and the type information of the firm graph in vcg format.
99 * Dumps the graph to a file. The file name is constructed from the
100 * name of the entity describing the procedure (irg->entity) and the
101 * ending -all.vcg. Eventually overwrites existing files.
103 * @see turn_off_edge_labels()
105 void dump_ir_graph_w_types (ir_graph *irg);
108 * Dumps a firm graph and all the type information needed for Calls,
109 * Sels, ... in this graph.
111 * @param irg The firm graph to be dumped with its type information.
114 * A file containing the firm graph and the type information of the firm graph in vcg format.
116 * The graph is in blocked format.
117 * Dumps the graph to a file. The file name is constructed from the
118 * name of the entity describing the procedure (irg->entity) and the
119 * ending -all.vcg. Eventually overwrites existing files.
121 * @see turn_off_edge_labels()
123 void dump_ir_block_graph_w_types (ir_graph *irg);
126 * The type of a walker function that is called for each graph.
128 * @param irg current visited graph
130 typedef void dump_graph_func(ir_graph *irg);
133 * A walker that calls a dumper for each graph.
135 * @param dump_graph The dumper to be used for dumping.
138 * Whatever the dumper creates.
140 * Walks over all firm graphs and calls a dumper for each graph.
141 * The following dumpers can be passed as arguments:
143 * - dump_ir_block_graph()
145 * - dump_type_graph()
146 * - dump_ir_graph_w_types()
148 * @see turn_off_edge_labels()
150 void dump_all_ir_graphs (dump_graph_func *dump_graph);
154 * Dump the control flow graph of a procedure.
156 * @param irg The firm graph whose CFG shall be dumped.
159 * A file containing the CFG in vcg format.
161 * Dumps the control flow graph of a procedure in standard xvcg format.
162 * Dumps the graph to a file. The file name is constructed from the
163 * name of the entity describing the procedure (irg->entity) and the
164 * ending -cfg.vcg. Eventually overwrites existing files.
166 * @see turn_off_edge_labels()
168 void dump_cfg (ir_graph *irg);
171 * Dumps all the type information needed for Calls, Sels, ... in this graph.
172 * Does not dump the graph!
174 * @param irg The firm graph whose type information is to be dumped.
176 * A file containing the type information of the firm graph in vcg format.
178 * Dumps this graph to a file. The file name is constructed from the
179 * name of the entity describing the procedure (irg->entity) and the
180 * ending -type.vcg. Eventually overwrites existing files.
182 * @see turn_off_edge_labels()
184 void dump_type_graph (ir_graph *irg);
187 * Dumps all type information.
190 * A file containing all type information for the program in standard
193 * Dumps all type information that is somehow reachable in standard vcg
195 * Dumps the graph to a file named All_types.vcg.
197 * @see turn_off_edge_labels()
199 void dump_all_types (void);
202 * Dumps the class hierarchy with or without entities.
204 * @param entities Flag whether to dump the entities.
207 * A file containing the class hierarchy tree for the program in standard
210 * Does not dump the global type.
211 * Dumps a node for all classes and the sub/supertype relations. If
212 * entities is set to true also dumps the entities of classes, but without
213 * any additional information as the entities type. The overwrites relation
214 * is dumped along with the entities.
215 * Dumps to a file class_hierarchy.vcg
217 void dump_class_hierarchy (bool entities);
220 * Sets the vcg flag "display_edge_labels" to no.
223 * as xvcg and aisee both fail to display graphs with self-edges if these
225 * Dumpers will generate vcg flags with a different header.
227 void turn_off_edge_labels(void);
230 * If set to true constants will be replicated for every use. In non blocked
231 * view edges from constant to block are scipped. Vcg
232 * then layouts the graphs more compact, this makes them better readable.
233 * The flag is automatically and temporarily set to false if other
234 * edges are dumped, as outs, loop, ...
235 * Default setting: false.
237 void dump_consts_local(bool b);
239 * Returns false if dump_out_edge_flag or dump_loop_information_flag
240 * are set, else returns dump_const_local_flag.
242 bool get_opt_dump_const_local(void);
245 * Turns off dumping the values of constant entities. Makes type graphs
248 void turn_off_constant_entity_values(void);
251 * Turns on dumping the edges from the End node to nodes to be kept
254 void dump_keepalive_edges(bool b);
255 bool get_opt_dump_keepalive_edges(void);
258 * Turns on dumping the out edges starting from the Start block in
259 * dump_ir_graph. To test the consistency of the out datastructure.
261 void dump_out_edges(void);
264 * If this flag is set the dumper dumps edges to immediate dominator in cfg.
266 void dump_dominator_information(void);
269 * If this flag is set the dumper dumps loop nodes and edges from
270 * these nodes to the contained ir nodes.
271 * Can be turned off with dont_dump_loop_information().
272 * If the loops are interprocedural nodes can be missing.
274 void dump_loop_information(void);
277 * @see dump_loop_information()
279 void dont_dump_loop_information(void);
282 * If set and backedge info is computed, backedges are dumped dashed
283 * and as vcg 'backedge' construct. Default: set.
285 void dump_backedge_information(bool b);
288 * Dump the information of type field specified in ana/irtypeinfo.h.
289 * If the flag is set, the type name is output in [] in the node label,
290 * else it is output as info.
292 void dump_analysed_type_info(bool b);
295 * Write the address of a node into the vcg info.
296 * This is off per default for automatic comparisons of
297 * vcg graphs -- these will differ in the pointer values!
299 void dump_pointer_values_to_info(bool b);
300 # endif /* _IRDUMP_H_ */