-#include "benode_t.h"
-
-typedef struct _be_stat_irg_t {
- ir_graph *irg; /**< the irg, the statistic is about */
- pset *phases; /**< node statistics for each phase */
- struct obstack obst; /**< the obstack containing the information */
- const arch_env_t *arch_env; /**< the current arch env */
-} be_stat_irg_t;
-
-typedef struct _be_stat_phase_t {
- const arch_env_t *arch_env; /**< the current arch env */
- const char *phase; /**< the name of the phase the statistic is about */
- unsigned long num_nodes; /**< overall number of reachable nodes in the irg */
- unsigned long num_data; /**< number of data nodes ((mode_datab && ! Proj && ! Phi) || mode_T) */
- unsigned long num_proj; /**< number of Projs */
- unsigned long num_phi; /**< number of Phis */
- unsigned long num_load; /**< number of Loads */
- unsigned long num_store; /**< number of Stores */
- unsigned long num_spill; /**< number of Spills */
- unsigned long num_reload; /**< number of Reloads */
-} be_stat_phase_t;
-
-static set *be_stat_data = NULL;
-
-static int cmp_stat_phase(const void *a, const void *b) {
- const be_stat_phase_t *p1 = a;
- const be_stat_phase_t *p2 = b;
-
- return p1->phase != p2->phase;
-}
+#include "benode.h"
+
+
+
+typedef struct pressure_walker_env_t pressure_walker_env_t;
+struct pressure_walker_env_t {
+ ir_graph *irg;
+ be_lv_t *lv;
+ double insn_count;
+ double regpressure;
+ size_t max_pressure;
+ const arch_register_class_t *cls;
+};
+
+static void check_reg_pressure_class(pressure_walker_env_t *env,
+ ir_node *block,
+ const arch_register_class_t *cls)
+{
+ ir_graph *irg = env->irg;
+ ir_node *irn;
+ ir_nodeset_t live_nodes;
+ size_t max_live;
+
+ ir_nodeset_init(&live_nodes);
+ be_liveness_end_of_block(env->lv, cls, block, &live_nodes);
+ max_live = ir_nodeset_size(&live_nodes);
+ env->regpressure += max_live;
+
+ sched_foreach_reverse(block, irn) {
+ size_t cnt;
+
+ if (is_Phi(irn))
+ break;
+
+ be_liveness_transfer(cls, irn, &live_nodes);
+ cnt = ir_nodeset_size(&live_nodes);
+ max_live = cnt < max_live ? max_live : cnt;
+ env->regpressure += cnt;
+ env->insn_count++;
+ }