2 * Provides several statistic functions for the backend.
3 * @author Christian Wuerdig
10 #include "firm_config.h"
12 #include "benodesets.h"
13 #include "bestatevent.h"
16 STAT_TAG_FILE = 0, /**< tag for source file name */
17 STAT_TAG_TIME = 1, /**< tag for time */
18 STAT_TAG_IRG = 2, /**< tag for function name (irg) */
19 STAT_TAG_CLS = 3, /**< tag for register class (or "<all>") */
23 extern FILE *be_stat_file;
24 extern const char *be_stat_tags[STAT_TAG_LAST];
27 #ifdef FIRM_STATISTICS
30 * Collects statistics information about register pressure.
31 * @param birg The be irg object containing the irg
33 void be_do_stat_reg_pressure(be_irg_t *birg);
36 * Collect statistics about amount of ready nodes per block
37 * @param block The block
38 * @param ready_set A set of ready nodes
40 void be_do_stat_sched_ready(ir_node *block, nodeset *ready_set);
43 * Pass information about a perm to the statistic module.
45 * @param class_name the name of the register class
46 * @param n_regs number of registers in the register class
47 * @param perm the perm node
48 * @param block the block containing the perm
49 * @param size the size of the perm
50 * @param real_size number of pairs with different registers
52 void be_do_stat_perm(const char *class_name, int n_regs, ir_node *perm, ir_node *block, int n, int real_size);
55 * Pass information about a cycle or chain in a perm to the statistic module.
57 * @param class_name the name of the register class
58 * @param perm the perm node
59 * @param block the block containing the perm
60 * @param is_chain 1 if chain, 0 if cycle
61 * @param size length of the cycle/chain
62 * @param n_ops the number of ops representing this cycle/chain after lowering
64 void be_do_stat_permcycle(const char *class_name, ir_node *perm, ir_node *block, int is_chain, int n_elems, int n_ops);
67 * Collects node statistics.
69 * @param irg the to do statistics for
70 * @param phase the phase to collect the statistic for
72 void be_do_stat_nodes(ir_graph *irg, const char *phase);
75 * Performs initialization for be node statistics.
77 void be_stat_init_irg(const arch_env_t *arch_env, ir_graph *irg);
79 void be_init_stat_file(const char *filename, const char *sourcefilename);
80 void be_close_stat_file(void);
84 #define be_stat_init_irg(arch_env, irg)
85 #define be_do_stat_nodes(irg, phase)
86 #define be_do_stat_reg_pressure(birg)
87 #define be_do_stat_sched_ready(block, ready_set)
88 #define be_do_stat_perm(class_name, n_regs, perm, block, n, real_size)
89 #define be_do_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops)
91 #endif /* FIRM_STATISTICS */
94 * Gives a cost estimate for the program (based on execution frequencies)
95 * and backend op_estimated_cost
97 double be_estimate_irg_costs(ir_graph *irg, const arch_env_t *arch_env, ir_exec_freq *execfreqs);
99 #endif /* _BESTAT_H_ */