From: Matthias Braun Date: Thu, 11 Dec 2008 11:57:55 +0000 (+0000) Subject: keep the API consistent with other enable functions X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=ae99c9d7652f8173985a1d112ce088010143d9af;p=libfirm keep the API consistent with other enable functions [r24520] --- diff --git a/include/libfirm/tv.h b/include/libfirm/tv.h index e7186490f..3b821b68c 100644 --- a/include/libfirm/tv.h +++ b/include/libfirm/tv.h @@ -797,7 +797,10 @@ unsigned tarval_ieee754_get_mantissa_size(const ir_mode *mode); /** * Enable/Disable floating point constant folding. */ -int tarval_enable_fp_ops(int enable); +void tarval_enable_fp_ops(int enable); + +/** returns 0/1 if floating point folding is enable/disabled */ +int tarval_fp_ops_enabled(void); /** * Check if its the a floating point NaN. diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index d1a3e8a6a..265daadb3 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -3075,7 +3075,7 @@ static ir_node *transform_node_Quot(ir_node *n) { tarval *tv = value_of(b); if (tv != tarval_bad) { - int rem; + int rem = tarval_fp_ops_enabled(); /* * Floating point constant folding might be disabled here to @@ -3083,9 +3083,9 @@ static ir_node *transform_node_Quot(ir_node *n) { * However, as we check for exact result, doing it is safe. * Switch it on. */ - rem = tarval_enable_fp_ops(1); + tarval_enable_fp_ops(1); tv = tarval_quo(get_mode_one(mode), tv); - (void)tarval_enable_fp_ops(rem); + tarval_enable_fp_ops(rem); /* Do the transformation if the result is either exact or we are not using strict rules. */ @@ -6341,7 +6341,9 @@ ir_node *optimize_node(ir_node *n) { /* neither constants nor Tuple values can be evaluated */ if (iro != iro_Const && (get_irn_mode(n) != mode_T)) { unsigned fp_model = get_irg_fp_model(current_ir_graph); - int old_fp_mode = tarval_enable_fp_ops((fp_model & fp_strict_algebraic) == 0); + int old_fp_mode = tarval_fp_ops_enabled(); + + tarval_enable_fp_ops((fp_model & fp_strict_algebraic) == 0); /* try to evaluate */ tv = computed_value(n); if (tv != tarval_bad) { @@ -6453,7 +6455,9 @@ ir_node *optimize_in_place_2(ir_node *n) { /* neither constants nor Tuple values can be evaluated */ if (iro != iro_Const && get_irn_mode(n) != mode_T) { unsigned fp_model = get_irg_fp_model(current_ir_graph); - int old_fp_mode = tarval_enable_fp_ops((fp_model & fp_strict_algebraic) == 0); + int old_fp_mode = tarval_fp_ops_enabled(); + + tarval_enable_fp_ops((fp_model & fp_strict_algebraic) == 0); /* try to evaluate */ tv = computed_value(n); if (tv != tarval_bad) { diff --git a/ir/tv/tv.c b/ir/tv/tv.c index 1caf7d3db..8bdf6921a 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -1686,11 +1686,12 @@ tarval_int_overflow_mode_t tarval_get_integer_overflow_mode(void) { } /* Enable/Disable floating point constant folding. */ -int tarval_enable_fp_ops(int enable) { - int old = !no_float; - +void tarval_enable_fp_ops(int enable) { no_float = !enable; - return old; +} + +int tarval_fp_ops_enabled(void) { + return !no_float; } /**