bcac2d78b52143369dc99529049e17da03627bcd
[libfirm] / ir / stat / firmstat.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/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
12
13 # ifndef _FIRMSTAT_H_
14 # define _FIRMSTAT_H_
15
16 #ifdef FIRM_STATISTICS
17
18 typedef enum {
19   STAT_OPT_STG        = 0,              /**< straightening optimization */
20   STAT_OPT_IFSIM      = 1,              /**< if simplification */
21   STAT_OPT_ALGSIM     = 2,              /**< algebraic simplification */
22   STAT_OPT_PHI        = 3,              /**< Phi optmization */
23   STAT_OPT_WAW        = 4,              /**< Write-After-Write optimization */
24   STAT_OPT_WAR        = 5,              /**< Write-After-Read optimization */
25   STAT_OPT_TUPLE      = 6,              /**< Tuple optimization */
26   STAT_OPT_ID         = 7,              /**< ID optimization */
27   STAT_OPT_CONST_EVAL = 8,              /**< constant evaluation */
28
29   STAT_OPT_MAX        = 9
30 }
31 stat_opt_kind;
32
33 /**
34  * initialize the statistics module.
35  */
36 void stat_init(void);
37
38 /**
39  * Finish the statistics .
40  */
41 void stat_finish(void);
42
43 /**
44  * A new IR op is registered.
45  */
46 void stat_new_ir_op(const ir_op *op);
47
48 /**
49  * An IR op is freed.
50  */
51 void stat_free_ir_op(const ir_op *op);
52
53 /**
54  * A new node is created.
55  */
56 void stat_new_node(const ir_node *node);
57
58 /**
59  * A node is changed into a Id node
60  */
61 void stat_turn_into_id(const ir_node *node);
62
63 /**
64  * A new graph was created
65  */
66 void stat_new_graph(const ir_graph *irg);
67
68 /**
69  * A walk over a graph is initiated
70  */
71 void stat_irg_walk(const ir_graph *irg, void *pre, void *post);
72
73 /**
74  * A walk over the graph's blocks is initiated
75  */
76 void stat_irg_block_walk(const ir_graph *irg, const ir_node *node, void *pre, void *post);
77
78 /**
79  * Some nodes were optimized into some others due to an optimization
80  */
81 void stat_merge_nodes(
82     ir_node **new_node_array, int new_num_entries,
83     ir_node **old_node_array, int old_num_entries,
84     stat_opt_kind opt);
85
86 #else
87
88 #define stat_init()
89 #define stat_finish()
90 #define stat_new_ir_op(op)
91 #define stat_free_ir_op(op)
92 #define stat_new_node(node)
93 #define stat_turn_into_id(node)
94 #define stat_new_graph(irg)
95 #define stat_irg_walk(irg, pre, post)
96 #define stat_irg_block_walk(irg, node, pre, post)
97 #define stat_merge_nodes(new_node_array, new_num_entries, old_node_array, old_num_entries, opt)
98
99 #endif
100
101 #endif /* _FIRMSTAT_H_ */