libFirm
irdump.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
13 #ifndef FIRM_IR_IRDUMP_H
14 #define FIRM_IR_IRDUMP_H
15 
16 #include <stdio.h>
17 
18 #include "firm_types.h"
19 #include "begin.h"
20 
44 FIRM_API void dump_ir_graph(ir_graph *graph, const char *suffix);
45 
49 typedef void (*ir_prog_dump_func)(FILE *out);
50 
64 FIRM_API void dump_ir_prog_ext(ir_prog_dump_func func, const char *suffix);
65 
69 typedef void (*ir_graph_dump_func)(FILE *out, ir_graph *graph);
70 
83 FIRM_API void dump_ir_graph_ext(ir_graph_dump_func func, ir_graph *graph,
84  const char *suffix);
85 
91 FIRM_API void dump_all_ir_graphs(const char *suffix);
92 
96 FIRM_API void ir_set_dump_path(const char *path);
97 
107 FIRM_API void ir_set_dump_filter(const char *name);
108 
110 FIRM_API const char *ir_get_dump_filter(void);
111 
121 FIRM_API void dump_ir_graph_file(FILE *out, ir_graph *graph);
122 
131 FIRM_API void dump_cfg(FILE *out, ir_graph *graph);
132 
138 FIRM_API void dump_callgraph(FILE *out);
139 
148 FIRM_API void dump_typegraph(FILE *out);
149 
161 FIRM_API void dump_class_hierarchy(FILE *out);
162 
170 FIRM_API void dump_loop_tree(FILE *out, ir_graph *graph);
171 
177 FIRM_API void dump_callgraph_loop_tree(FILE *out);
178 
187 FIRM_API void dump_types_as_text(FILE *out);
188 
196 FIRM_API void dump_globals_as_text(FILE *out);
197 
204 FIRM_API void dump_loop(FILE *out, ir_loop *loop);
205 
208 FIRM_API void dump_graph_as_text(FILE *out, const ir_graph *graph);
209 
211 FIRM_API void dump_entity_to_file(FILE *out, const ir_entity *entity);
212 
214 FIRM_API void dump_type_to_file(FILE *out, const ir_type *type);
215 
217 typedef enum {
220  dump_verbosity_fields = 0x00000002,
221  dump_verbosity_methods = 0x00000004,
222  dump_verbosity_nostatic = 0x00000040,
226  dump_verbosity_entattrs = 0x00000010,
231  dump_verbosity_max = 0x4FF00FBE
233 ENUM_BITSET(ir_dump_verbosity_t)
234 
235 
236 FIRM_API void ir_set_dump_verbosity(ir_dump_verbosity_t verbosity);
239 
245 typedef enum {
279 
287 ENUM_BITSET(ir_dump_flags_t)
288 
289 
290 FIRM_API void ir_set_dump_flags(ir_dump_flags_t flags);
292 FIRM_API void ir_add_dump_flags(ir_dump_flags_t flags);
294 FIRM_API void ir_remove_dump_flags(ir_dump_flags_t flags);
296 FIRM_API ir_dump_flags_t ir_get_dump_flags(void);
297 
303 typedef int (*dump_node_vcgattr_func)(FILE *out, const ir_node *node, const ir_node *local);
304 
310 typedef int (*dump_edge_vcgattr_func)(FILE *out, const ir_node *node, int to);
311 
316 typedef void (*dump_node_edge_func)(FILE *out, const ir_node *node);
317 
322 
327 FIRM_API void set_dump_node_edge_hook(dump_node_edge_func func);
328 
334 
340 
346 
348 typedef void (dump_node_info_cb_t)(void *data, FILE *out, const ir_node *n);
349 
362 FIRM_API hook_entry_t *dump_add_node_info_callback(dump_node_info_cb_t *cb, void *data);
363 
370 FIRM_API void dump_remove_node_info_callback(hook_entry_t *handle);
371 
381 void dump_vcg_header(FILE *out, const char *name, const char *layout,
382  const char *orientation);
383 
387 void dump_vcg_footer(FILE *out);
388 
392 void dump_node(FILE *out, const ir_node *node);
393 
397 void dump_ir_data_edges(FILE *out, const ir_node *node);
398 
402 void print_nodeid(FILE *out, const ir_node *node);
403 
408 void dump_begin_block_subgraph(FILE *out, const ir_node *block);
409 
413 void dump_end_block_subgraph(FILE *out, const ir_node *block);
414 
418 void dump_block_edges(FILE *out, const ir_node *block);
419 
425 void dump_blocks_as_subgraphs(FILE *out, ir_graph *irg);
426 
430 
431 #include "end.h"
432 
433 #endif
void ir_remove_dump_flags(ir_dump_flags_t flags)
disable certain dump flags
void dump_ir_graph_ext(ir_graph_dump_func func, ir_graph *graph, const char *suffix)
Convenience interface for dumping graphs.
Dump all type attributes.
Definition: irdump.h:225
ir_dump_verbosity_t ir_get_dump_verbosity(void)
return currently set text dump flags
dump out edges
Definition: irdump.h:265
dump basic blocks as subgraphs which contain the nodes in the block
Definition: irdump.h:247
Only dump names.
Definition: irdump.h:218
void dump_vcg_footer(FILE *out)
Prints the typical footer used in libfirm .vcg files to file out.
if set node idx will be added to node labels
Definition: irdump.h:259
void dump_ir_data_edges(FILE *out, const ir_node *node)
Prints vcg edges for firm graph node node to out.
dumps marked blocks with an asterisk in the label
Definition: irdump.h:278
void( dump_node_info_cb_t)(void *data, FILE *out, const ir_node *n)
A node info dumper callback.
Definition: irdump.h:348
Turn everything on.
Definition: irdump.h:231
turns of dumping of constant entity values in typegraphs
Definition: irdump.h:281
void(* ir_prog_dump_func)(FILE *out)
type for dumpers that dump information about the whole program
Definition: irdump.h:49
dump (parts of) typegraph along with nodes
Definition: irdump.h:249
Dump entity constants.
Definition: irdump.h:227
Dump types and dynamic allocated fields (like a type declaration).
Definition: irdump.h:222
void ir_set_dump_filter(const char *name)
Sets a prefix filter for output functions.
show keepalive edges from the end node
Definition: irdump.h:263
void ir_add_dump_flags(ir_dump_flags_t flags)
add flags to the currently set dump flags
int(* dump_node_vcgattr_func)(FILE *out, const ir_node *node, const ir_node *local)
This hook is called to dump the vcg attributes of a node to a file.
Definition: irdump.h:303
dumps ld_names of entities instead of their names
Definition: irdump.h:283
struct ir_type ir_type
Type.
Definition: firm_types.h:71
ir_dump_flags_t
A bitset indicating various options that affect what information is dumped and how exactly it is dump...
Definition: irdump.h:245
void dump_end_block_subgraph(FILE *out, const ir_node *block)
Prints the commands to end a vcg subgraph of firm block block to out.
ir_dump_verbosity_t
Verbosity for text dumpers.
Definition: irdump.h:217
void dump_callgraph_loop_tree(FILE *out)
Dumps the loop tree over the call graph.
void dump_class_hierarchy(FILE *out)
Dumps the class hierarchy with or without entities.
void dump_loop(FILE *out, ir_loop *loop)
Dumps the firm nodes in the sub-loop-tree of loop to a vcg file.
void set_dump_edge_vcgattr_hook(dump_edge_vcgattr_func hook)
Sets the edge_vcgattr hook.
void dump_block_edges(FILE *out, const ir_node *block)
Prints vcg edges for predecessors of firm block block to out.
void(* ir_graph_dump_func)(FILE *out, ir_graph *graph)
type for graph dumpers
Definition: irdump.h:69
void set_dump_node_vcgattr_hook(dump_node_vcgattr_func hook)
Sets the node_vcgattr hook.
If set constants will be replicated for every use.
Definition: irdump.h:257
void dump_globals_as_text(FILE *out)
Dumps all global variables as text.
Sets the vcg flag "display_edge_labels" to no.
Definition: irdump.h:253
hook_entry_t * dump_add_node_info_callback(dump_node_info_cb_t *cb, void *data)
Adds a new node info dumper callback.
void(* dump_node_edge_func)(FILE *out, const ir_node *node)
This hook allows dumping of additional edges (it is called outside a node: {} environment) ...
Definition: irdump.h:316
void print_nodeid(FILE *out, const ir_node *node)
Prints the vcg identifier for firm graph node node to out.
struct ir_loop ir_loop
Loop.
Definition: firm_types.h:80
void dump_entity_to_file(FILE *out, const ir_entity *entity)
Write the entity and all its attributes to the passed file.
void set_dump_node_edge_hook(dump_node_edge_func func)
Sets the hook to be called to dump additional edges to a node.
dump all anchor nodes, even the unused ones
Definition: irdump.h:276
ir_dump_flags_t ir_get_dump_flags(void)
return currently set dump flags
void ir_set_dump_path(const char *path)
Specifies output path for the dump_ir_graph function.
const char * ir_get_dump_filter(void)
Returns the prefix filter set with ir_set_dump_filter.
if set (and backedge info is computed) dump backedges
Definition: irdump.h:272
void dump_ir_graph(ir_graph *graph, const char *suffix)
Convenience interface for dumping a graph as vcg file.
Dump types and methods (like a type declaration).
Definition: irdump.h:221
if set dumps edges from blocks to their immediate dominator
Definition: irdump.h:267
If set the dumper dumps loop nodes and edges from these nodes to the contained ir nodes...
Definition: irdump.h:270
dump_node_edge_func get_dump_node_edge_hook(void)
Returns the additional edge dump hook.
void dump_begin_block_subgraph(FILE *out, const ir_node *block)
Prints the commands to begin of a new vcg subgraph intended for firm block block to out...
void dump_ir_graph_file(FILE *out, ir_graph *graph)
Dumps all Firm nodes of a single graph for a single procedure in standard xvcg format.
void dump_vcg_header(FILE *out, const char *name, const char *layout, const char *orientation)
Prints the typical header used in libfirm .vcg files to file out.
Dump entity access statistics.
Definition: irdump.h:229
void dump_ir_prog_ext(ir_prog_dump_func func, const char *suffix)
Convenience interface for dumping the whole compilation-unit/program.
void dump_remove_node_info_callback(hook_entry_t *handle)
Removes a previously added info dumper callback.
dump_node_edge_func get_dump_block_edge_hook(void)
Returns the additional block edge dump hook.
void dump_blocks_as_subgraphs(FILE *out, ir_graph *irg)
Prints vcg nodes+edges for all node in firm graph irg to out.
void dump_loop_tree(FILE *out, ir_graph *graph)
Dump a standalone loop tree, which contains the loop nodes and the firm nodes belonging to one loop p...
void ir_set_dump_flags(ir_dump_flags_t flags)
override currently set dump flags with new ones
dump entities in class hierarchies
Definition: irdump.h:285
Dump types and fields (like a type declaration).
Definition: irdump.h:220
void dump_typegraph(FILE *out)
Dumps all type information.
void dump_type_to_file(FILE *out, const ir_type *type)
Write the type and all its attributes to the file passed.
struct ir_entity ir_entity
Entity.
Definition: firm_types.h:83
struct ir_node ir_node
Procedure Graph Node.
Definition: firm_types.h:53
void dump_graph_as_text(FILE *out, const ir_graph *graph)
Write the graph and all its attributes to the file passed.
void set_dump_block_edge_hook(dump_node_edge_func func)
Sets the hook to be called to dump additional edges to a block.
void dump_cfg(FILE *out, ir_graph *graph)
Dump the control flow graph of a procedure.
void dump_all_ir_graphs(const char *suffix)
A walker that calls a dumper for each graph in the program.
Dump all entity attributes.
Definition: irdump.h:226
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
int(* dump_edge_vcgattr_func)(FILE *out, const ir_node *node, int to)
This hook is called to dump the vcg attributes of an edge to a file.
Definition: irdump.h:310
void dump_node(FILE *out, const ir_node *node)
Prints vcg node for a single firm graph node node to out.
void dump_callgraph(FILE *out)
Dump the call graph.
void dump_types_as_text(FILE *out)
Dump type information as text.
if set node number will be added to node labels
Definition: irdump.h:261
void ir_set_dump_verbosity(ir_dump_verbosity_t verbosity)
override currently set text dump flags with new ones
dump backedges from iredges.h
Definition: irdump.h:274