2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Provides several statistic functions for the backend.
9 * @author Christian Wuerdig, Matthias Braun
11 #ifndef FIRM_BE_BESTAT_H
12 #define FIRM_BE_BESTAT_H
14 #include "firm_types.h"
15 #include "irnodeset.h"
19 typedef enum be_stat_tag_t {
21 BE_STAT_PHIS = BE_STAT_FIRST, /**< phi count (excluding mem-phis) */
22 BE_STAT_MEM_PHIS, /**< memory-phi count */
23 BE_STAT_COPIES, /**< copies */
24 BE_STAT_PERMS, /**< perms */
27 ENUM_COUNTABLE(be_stat_tag_t)
28 typedef unsigned long be_node_stats_t[BE_STAT_COUNT];
31 * Collect statistics about node types
33 void be_collect_node_stats(be_node_stats_t *stats, ir_graph *irg);
35 void be_subtract_node_stats(be_node_stats_t *stats, be_node_stats_t *sub);
37 void be_copy_node_stats(be_node_stats_t *dest, be_node_stats_t *src);
39 void be_emit_node_stats(be_node_stats_t *stats, const char *prefix);
42 * Collects statistics information about register pressure.
45 void be_do_stat_reg_pressure(ir_graph *irg, const arch_register_class_t *cls);
48 * Gives a cost estimate for the program (based on execution frequencies)
49 * and backend op_estimated_cost
51 double be_estimate_irg_costs(ir_graph *irg);
54 * return number of "instructions" (=nodes without some virtual nodes like Proj,
57 unsigned long be_count_insns(ir_graph *irg);
60 * return number of basic blocks (without the end block)
62 unsigned long be_count_blocks(ir_graph *irg);