add a parameter to limit the maximum size of methods when inlining, otherwise some...
[libfirm] / ir / stat / firmstat.c
index a2f822d..d78489a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -526,6 +526,15 @@ static perm_stat_entry_t *perm_stat_get_entry(struct obstack *obst, ir_node *per
        return pset_insert(hmap, elem, HASH_PTR(perm));
 }  /* perm_stat_get_entry */
 
+/**
+ * Clear optimizations counter,
+ */
+static void clear_optimization_counter(void)  {
+       int i;
+       for (i = 0; i < FS_OPT_MAX; ++i)
+               cnt_clr(&status->num_opts[i]);
+}
+
 /**
  * Returns the ir_op for an IR-node,
  * handles special cases and return pseudo op codes.
@@ -1079,7 +1088,7 @@ static void mark_address_calc(ir_node *node, void *env) {
        int i, n;
        unsigned mark_preds = MARK_REF_NON_ADR;
 
-       if (! mode_is_numP(mode))
+       if (! mode_is_data(mode))
                return;
 
        if (mode_is_reference(mode)) {
@@ -1104,7 +1113,7 @@ static void mark_address_calc(ir_node *node, void *env) {
                ir_node *pred = get_irn_n(node, i);
 
                mode = get_irn_op_mode(pred);
-               if (! mode_is_numP(mode))
+               if (! mode_is_data(mode))
                        continue;
 
                set_adr_mark(graph, pred, get_adr_mark(graph, pred) | mark_preds);
@@ -1325,10 +1334,22 @@ static void stat_dump_param_tbl(const distrib_tbl_t *tbl, graph_entry_t *global)
        dumper_t *dumper;
 
        for (dumper = status->dumper; dumper; dumper = dumper->next) {
-               if (dumper->dump_const_tbl)
+               if (dumper->dump_param_tbl)
                        dumper->dump_param_tbl(dumper, tbl, global);
        }  /* for */
-}
+}  /* stat_dump_param_tbl */
+
+/**
+ * Dumps the optimization counter
+ */
+static void stat_dump_opt_cnt(const counter_t *tbl, unsigned len) {
+       dumper_t *dumper;
+
+       for (dumper = status->dumper; dumper; dumper = dumper->next) {
+               if (dumper->dump_opt_cnt)
+                       dumper->dump_opt_cnt(dumper, tbl, len);
+       }  /* for */
+}  /* stat_dump_opt_cnt */
 
 /**
  * Initialize the dumper.
@@ -1641,6 +1662,7 @@ static void stat_merge_nodes(
                int i, j;
                graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
 
+               cnt_inc(&status->num_opts[opt]);
                if (status->reassoc_run)
                        opt = HOOK_OPT_REASSOC;
 
@@ -2097,6 +2119,10 @@ void stat_dump_snapshot(const char *name, const char *phase)
                /* dump the parameter distribution */
                stat_dump_param_tbl(status->dist_param_cnt, global);
 
+               /* dump the optimization counter and clear them */
+               stat_dump_opt_cnt(status->num_opts, ARR_SIZE(status->num_opts));
+               clear_optimization_counter();
+
                stat_dump_finish();
 
                stat_finish_pattern_history(fname);
@@ -2239,6 +2265,8 @@ void firm_init_stat(unsigned enable_options)
        /* distribution table for parameter counts */
        status->dist_param_cnt = stat_new_int_distrib_tbl();
 
+       clear_optimization_counter();
+
 #undef HOOK
 #undef X
 }  /* firm_init_stat */