X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fstat%2Fconst_stat.c;h=296e74bfdb329669ff7fd073a09de9743e4d8e2b;hb=78bac126e7f9ca55761ab892ebfa9c19a4a65fcf;hp=abe0dd7de301b32376d69d56104e57b71f98c417;hpb=0fbcef83aa6060534172bb13e71cdadb04428806;p=libfirm diff --git a/ir/stat/const_stat.c b/ir/stat/const_stat.c index abe0dd7de..296e74bfd 100644 --- a/ir/stat/const_stat.c +++ b/ir/stat/const_stat.c @@ -27,11 +27,13 @@ #include "firmstat_t.h" #include "tv_t.h" +#include "util.h" /** * calculated the dual logarithm of |value| */ -static unsigned log2abs(long value) { +static unsigned log2abs(long value) +{ unsigned res = 0; if (value < 0) @@ -63,7 +65,8 @@ static unsigned log2abs(long value) { /** * classify the value of a float tarval */ -static float_classify_t classify_float_value(tarval *tv) { +static float_classify_t classify_float_value(ir_tarval *tv) +{ ir_mode *mode = get_tarval_mode(tv); if (tv == get_mode_null(mode)) @@ -85,7 +88,8 @@ static float_classify_t classify_float_value(tarval *tv) { } /* return a human readable name for an float classification */ -const char *stat_fc_name(float_classify_t classification) { +const char *stat_fc_name(float_classify_t classification) +{ switch (classification) { case STAT_FC_0: return "0.0"; case STAT_FC_1: return "1.0"; @@ -100,9 +104,9 @@ const char *stat_fc_name(float_classify_t classification) { /* update info on Consts */ void stat_update_const(stat_info_t *status, ir_node *node, graph_entry_t *graph) { - ir_mode *mode = get_irn_mode(node); - tarval *tv; - unsigned bits; + ir_mode *mode = get_irn_mode(node); + ir_tarval *tv; + unsigned bits; (void) graph; if (mode_is_int(mode)) { @@ -114,8 +118,8 @@ void stat_update_const(stat_info_t *status, ir_node *node, graph_entry_t *graph) bits = log2abs(get_tarval_long(tv)); - if (bits > ARR_SIZE(status->const_info.int_bits_count)) - bits = ARR_SIZE(status->const_info.int_bits_count); + if (bits > ARRAY_SIZE(status->const_info.int_bits_count)) + bits = ARRAY_SIZE(status->const_info.int_bits_count); cnt_inc(&status->const_info.int_bits_count[bits]); } else if (mode_is_float(mode)) { @@ -129,20 +133,22 @@ void stat_update_const(stat_info_t *status, ir_node *node, graph_entry_t *graph) } /* clears the const statistics for a new snapshot */ -void stat_const_clear(stat_info_t *status) { +void stat_const_clear(stat_info_t *status) +{ size_t i; - for (i = 0; i < ARR_SIZE(status->const_info.int_bits_count); ++i) + for (i = 0; i < ARRAY_SIZE(status->const_info.int_bits_count); ++i) cnt_clr(&status->const_info.int_bits_count[i]); - for (i = 0; i < ARR_SIZE(status->const_info.floats); ++i) + for (i = 0; i < ARRAY_SIZE(status->const_info.floats); ++i) cnt_clr(&status->const_info.floats[i]); cnt_clr(&status->const_info.others); } /* initialize the Const statistic. */ -void stat_init_const_cnt(stat_info_t *status) { +void stat_init_const_cnt(stat_info_t *status) +{ (void) status; /* currently nothing */ }