3 * File name: ir/stat/firmstat.h
4 * Purpose: Statistics for Firm.
8 * Copyright: (c) 2004 Universität Karlsruhe
9 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
22 * Statistic options, can be or'ed.
24 enum firmstat_options_t {
25 FIRMSTAT_ENABLED = 0x00000001, /**< enable statistics */
26 FIRMSTAT_PATTERN_ENABLED = 0x00000002 /**< enable pattern calculation */
30 * Finish the statistics.
31 * Never called from libFirm should be called from user.
33 * @param name basename of the statistic output file
35 void stat_finish(const char *name);
37 #ifdef FIRM_STATISTICS
40 STAT_OPT_STG, /**< straightening optimization */
41 STAT_OPT_IFSIM, /**< if simplification */
42 STAT_OPT_ALGSIM, /**< algebraic simplification */
43 STAT_OPT_PHI, /**< Phi optmization */
44 STAT_OPT_WAW, /**< Write-After-Write optimization */
45 STAT_OPT_WAR, /**< Write-After-Read optimization */
46 STAT_OPT_RAW, /**< Read-After-Write optimization */
47 STAT_OPT_RAR, /**< Read-After-Read optimization */
48 STAT_OPT_TUPLE, /**< Tuple optimization */
49 STAT_OPT_ID, /**< ID optimization */
50 STAT_OPT_CONST_EVAL, /**< constant evaluation */
51 STAT_OPT_STRENGTH_RED, /**< strenght reduction */
52 STAT_LOWERED, /**< lowered */
58 * initialize the statistics module.
60 * @param enable_options Bitmask containing the statistic options
62 void init_stat(unsigned enable_options);
65 * A new IR op is registered.
67 void stat_new_ir_op(const ir_op *op);
72 void stat_free_ir_op(const ir_op *op);
75 * A new node is created.
77 void stat_new_node(const ir_node *node);
80 * A node is changed into a Id node
82 void stat_turn_into_id(const ir_node *node);
85 * A new graph was created
87 void stat_new_graph(ir_graph *irg, entity *ent);
92 void stat_free_graph(ir_graph *irg);
95 * A walk over a graph is initiated
97 void stat_irg_walk(ir_graph *irg, void *pre, void *post);
100 * A walk over a graph in block-wise order is initiated
102 void stat_irg_walk_blkwise(ir_graph *irg, void *pre, void *post);
105 * A walk over the graph's blocks is initiated
107 void stat_irg_block_walk(ir_graph *irg, const ir_node *node, void *pre, void *post);
110 * Some nodes were optimized into some others due to an optimization
112 void stat_merge_nodes(
113 ir_node **new_node_array, int new_num_entries,
114 ir_node **old_node_array, int old_num_entries,
118 * A node was lowered into other nodes
120 void stat_lower(ir_node *node);
123 * A graph was inlined
125 void stat_inline(ir_node *call, ir_graph *irg);
128 * A graph with tail-recursions was optimized.
130 void stat_tail_rec(ir_graph *irg);
133 * Strength reduction was performed on an iteration variable.
135 void stat_strength_red(ir_graph *irg, ir_node *strong, ir_node *cmp);
138 * Start the dead node elimination.
140 void stat_dead_node_elim_start(ir_graph *irg);
143 * Stops the dead node elimination.
145 void stat_dead_node_elim_stop(ir_graph *irg);
148 * helper: get an ir_op from an opcode
150 * @param code the opcode
152 * @return The associated ir_op or NULL if the opcode could not be found.
154 ir_op *stat_get_op_from_opcode(opcode code);
158 #define init_stat(enable_options)
159 #define stat_finish(name)
160 #define stat_new_ir_op(op)
161 #define stat_free_ir_op(op)
162 #define stat_new_node(node)
163 #define stat_turn_into_id(node)
164 #define stat_new_graph(irg, ent)
165 #define stat_free_graph(irg)
166 #define stat_irg_walk(irg, pre, post)
167 #define stat_irg_walk_blkwise(irg, pre, post)
168 #define stat_irg_block_walk(irg, node, pre, post)
169 #define stat_merge_nodes(new_node_array, new_num_entries, old_node_array, old_num_entries, opt)
170 #define stat_lower(node)
171 #define stat_inline(call, irg)
172 #define stat_tail_rec(irg)
173 #define stat_strength_red(irg, strong, cmp)
174 #define stat_dead_node_elim_start(irg)
175 #define stat_dead_node_elim_stop(irg)
179 #endif /* _FIRMSTAT_H_ */