flag for strength reduction verbosity
[libfirm] / ir / stat / firmstat.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/stat/firmstat.h
4  * Purpose:     Statistics for Firm.
5  * Author:      Michael Beck
6  * Created:
7  * CVS-ID:      $Id$
8  * Copyright:   (c) 2004 Universität Karlsruhe
9  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
10  */
11 #ifndef _FIRMSTAT_H_
12 #define _FIRMSTAT_H_
13
14 /**
15  * @file firmstat.h
16  */
17 #include "irop.h"
18 #include "irnode.h"
19 #include "irgraph.h"
20
21 /**
22  * Statistic options, can be or'ed.
23  */
24 enum firmstat_options_t {
25   FIRMSTAT_ENABLED         = 0x00000001,        /**< enable statistics */
26   FIRMSTAT_PATTERN_ENABLED = 0x00000002         /**< enable pattern calculation */
27 };
28
29 /**
30  * Finish the statistics.
31  * Never called from libFirm should be called from user.
32  *
33  * @param name   basename of the statistic output file
34  */
35 void stat_finish(const char *name);
36
37 #ifdef FIRM_STATISTICS
38
39 typedef enum {
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_TUPLE,       /**< Tuple optimization */
48   STAT_OPT_ID,          /**< ID optimization */
49   STAT_OPT_CONST_EVAL,  /**< constant evaluation */
50   STAT_LOWERED,         /**< lowered */
51
52   STAT_OPT_MAX
53 } stat_opt_kind;
54
55 /**
56  * initialize the statistics module.
57  *
58  * @param enable_options  Bitmask containing the statistic options
59  */
60 void init_stat(unsigned enable_options);
61
62 /**
63  * A new IR op is registered.
64  */
65 void stat_new_ir_op(const ir_op *op);
66
67 /**
68  * An IR op is freed.
69  */
70 void stat_free_ir_op(const ir_op *op);
71
72 /**
73  * A new node is created.
74  */
75 void stat_new_node(const ir_node *node);
76
77 /**
78  * A node is changed into a Id node
79  */
80 void stat_turn_into_id(const ir_node *node);
81
82 /**
83  * A new graph was created
84  */
85 void stat_new_graph(ir_graph *irg, entity *ent);
86
87 /**
88  * A graph was deleted
89  */
90 void stat_free_graph(ir_graph *irg);
91
92 /**
93  * A walk over a graph is initiated
94  */
95 void stat_irg_walk(ir_graph *irg, void *pre, void *post);
96
97 /**
98  * A walk over a graph in block-wise order is initiated
99  */
100 void stat_irg_walk_blkwise(ir_graph *irg, void *pre, void *post);
101
102 /**
103  * A walk over the graph's blocks is initiated
104  */
105 void stat_irg_block_walk(ir_graph *irg, const ir_node *node, void *pre, void *post);
106
107 /**
108  * Some nodes were optimized into some others due to an optimization
109  */
110 void stat_merge_nodes(
111     ir_node **new_node_array, int new_num_entries,
112     ir_node **old_node_array, int old_num_entries,
113     stat_opt_kind opt);
114
115 /**
116  * A node was lowered into other nodes
117  */
118 void stat_lower(ir_node *node);
119
120 /**
121  * A graph was inlined
122  */
123 void stat_inline(ir_node *call, ir_graph *irg);
124
125 /**
126  * A graph with tail-recursions was optimized.
127  */
128 void stat_tail_rec(ir_graph *irg);
129
130 /**
131  * Start the dead node elimination.
132  */
133 void stat_dead_node_elim_start(ir_graph *irg);
134
135 /**
136  * Stops the dead node elimination.
137  */
138 void stat_dead_node_elim_stop(ir_graph *irg);
139
140 /**
141  * helper: get an ir_op from an opcode
142  *
143  * @param code  the opcode
144  *
145  * @return  The associated ir_op or NULL if the opcode could not be found.
146  */
147 ir_op *stat_get_op_from_opcode(opcode code);
148
149 #else
150
151 #define init_stat(enable_options)
152 #define stat_finish(name)
153 #define stat_new_ir_op(op)
154 #define stat_free_ir_op(op)
155 #define stat_new_node(node)
156 #define stat_turn_into_id(node)
157 #define stat_new_graph(irg, ent)
158 #define stat_free_graph(irg)
159 #define stat_irg_walk(irg, pre, post)
160 #define stat_irg_walk_blkwise(irg, pre, post)
161 #define stat_irg_block_walk(irg, node, pre, post)
162 #define stat_merge_nodes(new_node_array, new_num_entries, old_node_array, old_num_entries, opt)
163 #define stat_lower(node)
164 #define stat_inline(call, irg)
165 #define stat_tail_rec(irg)
166 #define stat_dead_node_elim_start(irg)
167 #define stat_dead_node_elim_stop(irg)
168
169 #endif
170
171 #endif /* _FIRMSTAT_H_ */