diff options
author | Zack Weinberg <zackw@panix.com> | 2001-08-12 01:56:10 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2001-08-12 01:56:10 +0000 |
commit | 94aca342987fa4c024f4aaa32c72715787ab84e5 (patch) | |
tree | 7e0d274b9d7e3a3888aa3d22cd6cba4854e43f24 /gcc/fold-const.c | |
parent | 31cdd4996b4223793a65643fcbf69163c3623258 (diff) | |
download | gcc-94aca342987fa4c024f4aaa32c72715787ab84e5.zip gcc-94aca342987fa4c024f4aaa32c72715787ab84e5.tar.gz gcc-94aca342987fa4c024f4aaa32c72715787ab84e5.tar.bz2 |
toplev.c (set_float_handler): Make static.
* toplev.c (set_float_handler): Make static.
* toplev.h: Don't prototype set_float_handler.
* simplify-rtx.c: Don't include setjmp.h.
(simplify_unary_real, simplify_binary_real, simplify_binary_is2orm1):
New functions.
(simplify_unary_operation, simplify_binary_operation): Use them,
via do_float_handler.
* fold-const.c: Don't include setjmp.h.
(exact_real_inverse_1): New function.
(exact_real_inverse): Use it, via do_float_handler.
* varasm.c: Don't include setjmp.h.
(assemble_real_1): New function.
(assemble_real): Use it, via do_float_handler.
Call internal_error if we get a trap here.
* c-parse.in, cse.c, cselib.c, ch/lex.c, config/i386/i386.c,
config/pj/pj.c, config/s390/s390.c: Don't include setjmp.h.
* java/lex.h: Don't include setjmp.h. Don't define
SET_FLOAT_HANDLER or prototype set_float_handler.
From-SVN: r44815
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 99 |
1 files changed, 61 insertions, 38 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5ffaf10..00af527 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" -#include <setjmp.h> #include "flags.h" #include "tree.h" #include "rtl.h" @@ -59,6 +58,9 @@ static void encode PARAMS ((HOST_WIDE_INT *, static void decode PARAMS ((HOST_WIDE_INT *, unsigned HOST_WIDE_INT *, HOST_WIDE_INT *)); +#ifndef REAL_ARITHMETIC +static void exact_real_inverse_1 PARAMS ((PTR)); +#endif static tree negate_expr PARAMS ((tree)); static tree split_tree PARAMS ((tree, enum tree_code, tree *, tree *, int)); @@ -956,51 +958,41 @@ target_negative (x) /* Try to change R into its exact multiplicative inverse in machine mode MODE. Return nonzero function value if successful. */ +struct exact_real_inverse_args +{ + REAL_VALUE_TYPE *r; + enum machine_mode mode; + int success; +}; -int -exact_real_inverse (mode, r) - enum machine_mode mode; - REAL_VALUE_TYPE *r; +static void +exact_real_inverse_1 (p) + PTR p; { - jmp_buf float_error; + struct exact_real_inverse_args *args = + (struct exact_real_inverse_args *) p; + + enum machine_mode mode = args->mode; + REAL_VALUE_TYPE *r = args->r; + union - { - double d; - unsigned short i[4]; - }x, t, y; + { + double d; + unsigned short i[4]; + } + x, t, y; #ifdef CHECK_FLOAT_VALUE int i; #endif - /* Usually disable if bounds checks are not reliable. */ - if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT) && !flag_pretend_float) - return 0; - /* Set array index to the less significant bits in the unions, depending - on the endian-ness of the host doubles. - Disable if insufficient information on the data structure. */ -#if HOST_FLOAT_FORMAT == UNKNOWN_FLOAT_FORMAT - return 0; + on the endian-ness of the host doubles. */ +#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT \ + || HOST_FLOAT_FORMAT == IBM_FLOAT_FORMAT +# define K 2 #else -#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT -#define K 2 -#else -#if HOST_FLOAT_FORMAT == IBM_FLOAT_FORMAT -#define K 2 -#else -#define K (2 * HOST_FLOAT_WORDS_BIG_ENDIAN) -#endif +# define K (2 * HOST_FLOAT_WORDS_BIG_ENDIAN) #endif -#endif - - if (setjmp (float_error)) - { - /* Don't do the optimization if there was an arithmetic error. */ -fail: - set_float_handler (NULL); - return 0; - } - set_float_handler (float_error); /* Domain check the argument. */ x.d = *r; @@ -1040,9 +1032,40 @@ fail: #endif /* Output the reciprocal and return success flag. */ - set_float_handler (NULL); *r = y.d; - return 1; + args->success = 1; + return; + + fail: + args->success = 0; + return; + +#undef K +} + + +int +exact_real_inverse (mode, r) + enum machine_mode mode; + REAL_VALUE_TYPE *r; +{ + struct exact_real_inverse_args args; + + /* Disable if insufficient information on the data structure. */ +#if HOST_FLOAT_FORMAT == UNKNOWN_FLOAT_FORMAT + return 0; +#endif + + /* Usually disable if bounds checks are not reliable. */ + if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT) && !flag_pretend_float) + return 0; + + args.mode = mode; + args.r = r; + + if (do_float_handler (exact_real_inverse_1, (PTR) &args)) + return args.success; + return 0; } /* Convert C99 hexadecimal floating point string constant S. Return |