Commit 94aca342 by Zack Weinberg Committed by Zack Weinberg

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
parent 31cdd499
2001-08-11 Zack Weinberg <zackw@panix.com>
* 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, config/i386/i386.c,
config/pj/pj.c, config/s390/s390.c: Don't include setjmp.h.
2001-08-11 Zack Weinberg <zackw@panix.com>
* defaults.h: Define PREFERRED_STACK_BOUNDARY to
STACK_BOUNDARY if not already defined.
......
......@@ -38,7 +38,6 @@ end ifc
%{
#include "config.h"
#include "system.h"
#include <setjmp.h>
#include "tree.h"
#include "input.h"
#include "cpplib.h"
......
2001-08-11 Zack Weinberg <zackw@panix.com>
* lex.c: Don't include setjmp.h.
2001-08-09 Richard Henderson <rth@redhat.com>
* grant.c (chill_finish_compile): Use target hooks instead of
......
......@@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include <setjmp.h>
#include <sys/stat.h>
#include "tree.h"
......
......@@ -20,7 +20,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include <setjmp.h>
#include "system.h"
#include "rtl.h"
#include "tree.h"
......
......@@ -78,7 +78,6 @@ Boston, MA 02111-1307, USA. */
order, so nothing more needs to be done. */
#include <setjmp.h>
#include "config.h"
#include "system.h"
#include "rtl.h"
......
......@@ -21,7 +21,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include <setjmp.h>
#include "system.h"
#include "rtl.h"
#include "tree.h"
......
......@@ -22,7 +22,6 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
/* stdio.h must precede rtl.h for FFS. */
#include "system.h"
#include <setjmp.h>
#include "rtl.h"
#include "tm_p.h"
......
......@@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include <setjmp.h>
#include "rtl.h"
#include "tm_p.h"
......
......@@ -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
......
2001-08-11 Zack Weinberg <zackw@panix.com>
* lex.h: Don't include setjmp.h. Don't define
SET_FLOAT_HANDLER or prototype set_float_handler.
2001-08-09 Richard Henderson <rth@redhat.com>
* Make-lang.in (class.o): Depend on TARGET_H.
......
......@@ -26,8 +26,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#ifndef GCC_JAVA_LEX_H
#define GCC_JAVA_LEX_H
#include <setjmp.h> /* set_float_handler argument uses it */
/* Extern global variables declarations */
extern FILE *finput;
extern int lineno;
......@@ -172,7 +170,6 @@ extern void java_destroy_lexer PARAMS ((java_lexer *));
#define DCONST0 0
#define REAL_VALUE_TYPE int
#define SET_FLOAT_HANDLER(H)
#define GET_IDENTIFIER(S) xstrdup ((S))
#define REAL_VALUE_ATOF(LIT,MODE) 0
#define REAL_VALUE_ISINF(VALUE) 0
......@@ -192,8 +189,6 @@ extern void java_destroy_lexer PARAMS ((java_lexer *));
#else
extern void set_float_handler PARAMS ((jmp_buf));
#define SET_FLOAT_HANDLER(H) set_float_handler ((H))
#define DCONST0 dconst0
#define GET_IDENTIFIER(S) get_identifier ((S))
#define SET_REAL_VALUE_ATOF(TARGET,SOURCE) (TARGET) = (SOURCE)
......
......@@ -161,6 +161,7 @@ static const char *decl_name PARAMS ((tree, int));
static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
static void set_float_handler PARAMS ((jmp_buf));
static void compile_file PARAMS ((const char *));
static void display_help PARAMS ((void));
static void display_target_options PARAMS ((void));
......@@ -1679,7 +1680,7 @@ float_signal (signo)
/* Specify where to longjmp to when a floating arithmetic error happens.
If HANDLER is 0, it means don't handle the errors any more. */
void
static void
set_float_handler (handler)
jmp_buf handler;
{
......
......@@ -102,9 +102,6 @@ extern void error_for_asm PARAMS ((struct rtx_def *,
extern void warning_for_asm PARAMS ((struct rtx_def *,
const char *, ...))
ATTRIBUTE_PRINTF_2;
#if defined (_JBLEN) || defined (setjmp)
extern void set_float_handler PARAMS ((jmp_buf));
#endif
extern int do_float_handler PARAMS ((void (*) (PTR), PTR));
#ifdef BUFSIZ
......
......@@ -29,7 +29,6 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include <setjmp.h>
#include "rtl.h"
#include "tree.h"
#include "flags.h"
......@@ -138,6 +137,7 @@ tree last_assemble_variable_decl;
static const char *strip_reg_name PARAMS ((const char *));
static int contains_pointers_p PARAMS ((tree));
static void assemble_real_1 PARAMS ((PTR));
static void decode_addr_const PARAMS ((tree, struct addr_const *));
static int const_hash PARAMS ((tree));
static int compare_constant PARAMS ((tree,
......@@ -1798,68 +1798,74 @@ assemble_integer (x, size, force)
}
/* Assemble the floating-point constant D into an object of size MODE. */
void
assemble_real (d, mode)
REAL_VALUE_TYPE d;
enum machine_mode mode;
struct assemble_real_args
{
jmp_buf output_constant_handler;
if (setjmp (output_constant_handler))
{
error ("floating point trap outputting a constant");
#ifdef REAL_IS_NOT_DOUBLE
memset ((char *) &d, 0, sizeof d);
d = dconst0;
#else
d = 0;
#endif
}
REAL_VALUE_TYPE *d;
enum machine_mode mode;
};
set_float_handler (output_constant_handler);
static void
assemble_real_1 (p)
PTR p;
{
struct assemble_real_args *args = (struct assemble_real_args *) p;
REAL_VALUE_TYPE *d = args->d;
enum machine_mode mode = args->mode;
switch (mode)
{
#ifdef ASM_OUTPUT_BYTE_FLOAT
case QFmode:
ASM_OUTPUT_BYTE_FLOAT (asm_out_file, d);
ASM_OUTPUT_BYTE_FLOAT (asm_out_file, *d);
break;
#endif
#ifdef ASM_OUTPUT_SHORT_FLOAT
case HFmode:
ASM_OUTPUT_SHORT_FLOAT (asm_out_file, d);
ASM_OUTPUT_SHORT_FLOAT (asm_out_file, *d);
break;
#endif
#ifdef ASM_OUTPUT_THREE_QUARTER_FLOAT
case TQFmode:
ASM_OUTPUT_THREE_QUARTER_FLOAT (asm_out_file, d);
ASM_OUTPUT_THREE_QUARTER_FLOAT (asm_out_file, *d);
break;
#endif
#ifdef ASM_OUTPUT_FLOAT
case SFmode:
ASM_OUTPUT_FLOAT (asm_out_file, d);
ASM_OUTPUT_FLOAT (asm_out_file, *d);
break;
#endif
#ifdef ASM_OUTPUT_DOUBLE
case DFmode:
ASM_OUTPUT_DOUBLE (asm_out_file, d);
ASM_OUTPUT_DOUBLE (asm_out_file, *d);
break;
#endif
#ifdef ASM_OUTPUT_LONG_DOUBLE
case XFmode:
case TFmode:
ASM_OUTPUT_LONG_DOUBLE (asm_out_file, d);
ASM_OUTPUT_LONG_DOUBLE (asm_out_file, *d);
break;
#endif
default:
abort ();
}
}
void
assemble_real (d, mode)
REAL_VALUE_TYPE d;
enum machine_mode mode;
{
struct assemble_real_args args;
args.d = &d;
args.mode = mode;
if (do_float_handler (assemble_real_1, (PTR) &args))
return;
set_float_handler (NULL);
internal_error ("floating point trap outputting a constant");
}
/* Here we combine duplicate floating constants to make
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment