keep the API consistent with other enable functions
authorMatthias Braun <matze@braunis.de>
Thu, 11 Dec 2008 11:57:55 +0000 (11:57 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 11 Dec 2008 11:57:55 +0000 (11:57 +0000)
[r24520]

include/libfirm/tv.h
ir/ir/iropt.c
ir/tv/tv.c

index e718649..3b821b6 100644 (file)
@@ -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.
index d1a3e8a..265daad 100644 (file)
@@ -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) {
index 1caf7d3..8bdf692 100644 (file)
@@ -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;
 }
 
 /**