aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1999-03-14 14:02:10 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1999-03-14 14:02:10 +0000
commit1a87eea22067f6e19e30ad9f5dc2e41c3f204b80 (patch)
tree72dc4ff5c660048c298d80243ea16ff9e4568de0 /gcc/tree.c
parentc2b2e000045ac8a9291c05dafc5f6aec7da47dc2 (diff)
downloadgcc-1a87eea22067f6e19e30ad9f5dc2e41c3f204b80.zip
gcc-1a87eea22067f6e19e30ad9f5dc2e41c3f204b80.tar.gz
gcc-1a87eea22067f6e19e30ad9f5dc2e41c3f204b80.tar.bz2
cse.c (check_fold_consts): New static function.
* cse.c (check_fold_consts): New static function. (cfc_args): New struct. (simplify_relational_operation): Use them in call to `do_float_handler'. * toplev.c (do_float_handler): New function to wrap calls to setjmp/set_float_handler. * toplev.h (do_float_handler): Add extern prototype. * tree.c (build_real_from_int_cst_1): New static function. (brfic_args): New struct. (build_real_from_int_cst): Use them in call to `do_float_handler'. From-SVN: r25768
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c54
1 files changed, 37 insertions, 17 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 1114ec34..bfbc8c2 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -35,7 +35,6 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
-#include <setjmp.h>
#include "flags.h"
#include "tree.h"
#include "except.h"
@@ -266,6 +265,7 @@ int (*lang_get_alias_set) PROTO((tree));
static void set_type_quals PROTO((tree, int));
static void append_random_chars PROTO((char *));
+static void build_real_from_int_cst_1 PROTO((PTR));
extern char *mode_name[];
@@ -1450,6 +1450,29 @@ real_value_from_int_cst (type, i)
return d;
}
+struct brfic_args
+{
+ /* Input */
+ tree type, i;
+ /* Output */
+ REAL_VALUE_TYPE d;
+};
+
+static void
+build_real_from_int_cst_1 (data)
+ PTR data;
+{
+ struct brfic_args * args = (struct brfic_args *) data;
+
+#ifdef REAL_ARITHMETIC
+ args->d = real_value_from_int_cst (args->type, args->i);
+#else
+ args->d =
+ REAL_VALUE_TRUNCATE (TYPE_MODE (args->type),
+ real_value_from_int_cst (args->type, args->i));
+#endif
+}
+
/* This function can't be implemented if we can't do arithmetic
on the float representation. */
@@ -1461,32 +1484,29 @@ build_real_from_int_cst (type, i)
tree v;
int overflow = TREE_OVERFLOW (i);
REAL_VALUE_TYPE d;
- jmp_buf float_error;
+ struct brfic_args args;
v = make_node (REAL_CST);
TREE_TYPE (v) = type;
- if (setjmp (float_error))
+ /* Setup input for build_real_from_int_cst_1() */
+ args.type = type;
+ args.i = i;
+
+ if (do_float_handler (build_real_from_int_cst_1, (PTR) &args))
+ {
+ /* Receive output from build_real_from_int_cst_1() */
+ d = args.d;
+ }
+ else
{
+ /* We got an exception from build_real_from_int_cst_1() */
d = dconst0;
overflow = 1;
- goto got_it;
}
-
- set_float_handler (float_error);
-
-#ifdef REAL_ARITHMETIC
- d = real_value_from_int_cst (type, i);
-#else
- d = REAL_VALUE_TRUNCATE (TYPE_MODE (type),
- real_value_from_int_cst (type, i));
-#endif
-
+
/* Check for valid float value for this type on this target machine. */
- got_it:
- set_float_handler (NULL_PTR);
-
#ifdef CHECK_FLOAT_VALUE
CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
#endif