From: Matthias Braun Date: Mon, 9 Oct 2006 12:07:59 +0000 (+0000) Subject: dirty hack to make execfreqs work with endless apps X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=0984ca56913852999e88e3b517e010b6a7ecde1a;p=libfirm dirty hack to make execfreqs work with endless apps [r8323] --- diff --git a/ir/ana/execfreq.c b/ir/ana/execfreq.c index 5b3833c24..a09b15c93 100644 --- a/ir/ana/execfreq.c +++ b/ir/ana/execfreq.c @@ -9,7 +9,6 @@ * Copyright: (c) 2006 Universität Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -124,7 +123,8 @@ get_block_execfreq_ulong(const ir_exec_freq *ef, const ir_node *bb) return res; } -#define ZERO(x) (fabs(x) < 0.0001) +#define EPSILON 0.0001 +#define UNDEF(x) !(x > EPSILON) static void block_walker(ir_node * bb, void * data) @@ -286,9 +286,9 @@ compute_execfreq(ir_graph * irg, double loop_weight) size_t idx = PTR_TO_INT(get_irn_link(bb)); #ifdef USE_GSL - freq->freq = ZERO(gsl_vector_get(x, idx)) ? 0.0 : gsl_vector_get(x, idx); + freq->freq = UNDEF(gsl_vector_get(x, idx)) ? EPSILON : gsl_vector_get(x, idx); #else - freq->freq = ZERO(x[idx]) ? 0.0 : x[idx]; + freq->freq = UNDEF(x[idx]) ? EPSILON : x[idx]; #endif /* get the maximum exec freq */ @@ -325,7 +325,7 @@ compute_execfreq(ir_graph * irg, double loop_weight) for(j = i + 1; j < n; ++j) { double diff = fabs(fs[i] - fs[j]); - if(!ZERO(diff)) + if(!UNDEF(diff)) smallest_diff = MIN(diff, smallest_diff); } }