minor imporvements: comments, output
[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 # ifndef _IRDUMP_H_
10 # define _IRDUMP_H_
11
12 # include "irnode.h"
13 # include "irgraph.h"
14
15 /****h* libfirm/irdump
16  *
17  * NAME
18  *   irdump -- dump routines for the graph and all type information
19  * NOTES
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 http://www.absint.de/aisee/download/index.htm.
25  *
26  *   Most routines use the name of the passed entity as the name of the
27  *   file dumped to.
28  *
29  ******
30  */
31
32 #if 0
33 /* The following routines use a global variable that is not external.
34    Therefore removed from interface. */
35 /* dump a simple node */
36 void dump_ir_node (ir_node *node);
37 /* dump the edge to the block this node belongs to */
38 void dump_ir_block_edge(ir_node *n);
39 /* dump edges to our inputs */
40 void dump_ir_data_edges(ir_node *n);
41 #endif
42
43 /****m* irdump/dump_ir_graph
44  *
45  * NAME
46  *   dump_ir_graph  -- dump a firm graph
47  * SYNOPSIS
48  *  void dump_ir_graph (ir_graph *irg);
49  * FUNCTION
50  *  Dumps all Firm nodes of a single graph for a single procedure in
51  *  standard xvcg format.
52  *  Dumps the graph to a file.  The file name is constructed from the
53  *  name of the entity describing the procedure (irg->entity) and the
54  *  ending .vcg.  Eventually overwrites existing files.
55  * INPUTS
56  *   irg: The firm graph to be dumped.
57  * RESULT
58  *   A file containing the firm graph in vcg format.
59  * SEE ALSO
60  *  turn_of_edge_labels
61  ***
62  */
63 void dump_ir_graph (ir_graph *irg);
64
65 /****m* irdump/dump_ir_block_graph
66  *
67  * NAME
68  *   dump_ir_block_graph -- dump a firm graph without explicit block nodes.
69  * SYNOPSIS
70  *   void dump_ir_block_graph (ir_graph *irg);
71  * FUNCTION
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 .vcg.  Eventually overwrites existing files.
77  * INPUTS
78  *   irg: The firm graph to be dumped.
79  * RESULT
80  *   A file containing the firm graph in vcg format.
81  * SEE ALSO
82  *  turn_of_edge_labels
83  ***
84  */
85 void dump_ir_block_graph (ir_graph *irg);
86
87 /****m* irdump/dump_cfg
88  *
89  * NAME
90  *   dump_cfg -- Dump the control flow graph of a procedure
91  * SYNOPSIS
92  *   void dump_cfg (ir_graph *irg);
93  * FUNCTION
94  *   Dumps the control flow graph of a procedure in standard xvcg format.
95  *   Dumps the graph to a file.  The file name is constructed from the
96  *   name of the entity describing the procedure (irg->entity) and the
97  *   ending -cfg.vcg.  Eventually overwrites existing files.
98  * INPUTS
99  *   irg: The firm graph whose CFG shall be dumped.
100  * RESULT
101  *   A file containing the CFG in vcg format.
102  * SEE ALSO
103  *  turn_of_edge_labels
104  ***
105  */
106 void dump_cfg (ir_graph *irg);
107
108 /****m* irdump/dump_type_graph
109  *
110  * NAME
111  *   dump_type_graph --
112  * SYNOPSIS
113  *   void dump_type_graph (ir_graph *irg);
114  * FUNCTION
115  *  Dumps all the type information needed for Calls, Sels, ... in this graph.
116  *  Dumps this graph to a file.  The file name is constructed from the
117  *  name of the entity describing the procedure (irg->entity) and the
118  *  ending -type.vcg.  Eventually overwrites existing files.
119  * INPUTS
120  *  irg: The firm graph whose type information is to be dumped.
121  * RESULT
122  *  A file containing the type information of the firm graph in vcg format.
123  * SEE ALSO
124  *  turn_of_edge_labels
125  ***
126  */
127 void dump_type_graph (ir_graph *irg);
128
129 /****m* irdump/dump_all_types
130  *
131  * NAME
132  *   dump_all_types -- Dumps all type information
133  * SYNOPSIS
134  *   void dump_all_types (void);
135  * FUNCTION
136  *   Dumps all type information that is somehow reachable in standard vcg
137  *   format.
138  *   Dumps the graph to a file named All_types.vcg.
139  * INPUTS
140  *   No inputs.
141  * RESULT
142  *   A file containing all type information for the program in standard
143  *   vcg format.
144  * SEE ALSO
145  *  turn_of_edge_labels
146  ***
147  */
148 void dump_all_types (void);
149
150 /****m* irdump/dump_ir_graph_w_types
151  *
152  * NAME
153  *   dump_ir_graph_w_types
154  * SYNOPSIS
155  *   void dump_ir_graph_w_types (ir_graph *irg);
156  * FUNCTION
157  *  Dumps a firm graph and  all the type information needed for Calls,
158  *  Sels, ... in this graph.
159  *  Dumps the graph to a file.  The file name is constructed from the
160  *  name of the entity describing the procedure (irg->entity) and the
161  *  ending -all.vcg.  Eventually overwrites existing files.
162  * INPUTS
163  *   irg: The firm graph to be dumped with its type information.
164  * RESULT
165  *   A file containing the firm graph and the type information of the firm graph in vcg format.
166  * SEE ALSO
167  *  turn_of_edge_labels
168  ***
169  */
170
171 void dump_ir_graph_w_types (ir_graph *irg);
172  /****m* irdump/dump_ir_block_graph_w_types
173  *
174  * NAME
175  *   dump_ir_block_graph_w_types
176  * SYNOPSIS
177  *   void dump_ir_block_graph_w_types (ir_graph *irg);
178  * FUNCTION
179  *  Dumps a firm graph and  all the type information needed for Calls,
180  *  Sels, ... in this graph.  The graph is in blocked format.
181  *  Dumps the graph to a file.  The file name is constructed from the
182  *  name of the entity describing the procedure (irg->entity) and the
183  *  ending -all.vcg.  Eventually overwrites existing files.
184  * INPUTS
185  *   irg: The firm graph to be dumped with its type information.
186  * RESULT
187  *   A file containing the firm graph and the type information of the firm graph in vcg format.
188  * SEE ALSO
189  *  turn_of_edge_labels
190  ***
191  */
192 void dump_ir_block_graph_w_types (ir_graph *irg);
193
194 /****m* irdump/dump_all_ir_graphs
195  *
196  * NAME
197  *   dump_all_ir_graphs -- a walker that calls a dumper for each graph
198  * SYNOPSIS
199  *   void dump_all_ir_graphs (void dump_graph(ir_graph*));
200  * FUNCTION
201  *   Walks over all firm graphs and  calls a dumper for each graph.
202  *   The following dumpers can be passed as arguments:
203  *   dump_ir_graph
204  *   dump_ir_block_graph
205  *   dump_cfg
206  *   dump_type_graph
207  *   dump_ir_graph_w_types
208  * INPUTS
209  *   The dumper to be used for dumping.
210  * RESULT
211  *   Whatever the dumper creates.
212  * SEE ALSO
213  *  turn_of_edge_labels
214  ***
215  */
216 void dump_all_ir_graphs (void dump_graph(ir_graph*));
217
218 /****m* irdump/turn_of_edge_labels
219  *
220  * NAME
221  *   turn_of_edge_labels
222  * SYNOPSIS
223  *   void turn_of_edge_labels();
224  * FUNCTION
225  *   Sets the vcg flag "display_edge_labels" to no.  This is necessary
226  *   as xvcg and aisee both fail to display graphs with self-edges if these
227  *   edges have labes.
228  * INPUTS
229  *   No inputs
230  * RESULT
231  *   dumpers will generate vcg flags with a different header.
232  * SEE ALSO
233  *
234  ***
235  */
236 void turn_of_edge_labels();
237
238
239 # endif /* _IRDUMP_H_ */