Commit 0ee6fdb5 by Richard Henderson Committed by Richard Henderson

real.h (enum real_value_class, [...]): Move from real.c.

        * real.h (enum real_value_class, SIGNIFICAND_BITS, EXP_BITS,
        MAX_EXP, SIGSZ, SIG_MSB, struct real_value): Move from real.c.
        (struct realvaluetype): Remove.
        (REAL_VALUE_TYPE): Use struct real_value.
        (REAL_VALUE_TYPE_SIZE): Use SIGNIFICAND_BITS.
        (test_real_width): New.
        * real.c: Global replace struct real_value with REAL_VALUE_TYPE.
        (real_arithmetic): Avoid hoops for REAL_VALUE_TYPE parameters.
        (real_compare, real_exponent, real_ldexp, real_isinf, real_isnan,
        real_isneg, real_isnegzero, real_identical, exact_real_inverse,
        real_to_integer, real_to_integer2, real_to_decimal,
        real_to_hexadecimal, real_from_string, real_from_integer,
        real_inf, real_nan, real_2expN, real_convert, real_to_target,
        real_from_target): Likewise.
        * tree.h (struct tree_real_cst): Use real_value not realvaluetype.
        * gengtype-yacc.y (bitfieldopt): Accept an ID as well.

From-SVN: r57343
parent 42449812
2002-09-20 Richard Henderson <rth@redhat.com>
* real.h (enum real_value_class, SIGNIFICAND_BITS, EXP_BITS,
MAX_EXP, SIGSZ, SIG_MSB, struct real_value): Move from real.c.
(struct realvaluetype): Remove.
(REAL_VALUE_TYPE): Use struct real_value.
(REAL_VALUE_TYPE_SIZE): Use SIGNIFICAND_BITS.
(test_real_width): New.
* real.c: Global replace struct real_value with REAL_VALUE_TYPE.
(real_arithmetic): Avoid hoops for REAL_VALUE_TYPE parameters.
(real_compare, real_exponent, real_ldexp, real_isinf, real_isnan,
real_isneg, real_isnegzero, real_identical, exact_real_inverse,
real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_string, real_from_integer,
real_inf, real_nan, real_2expN, real_convert, real_to_target,
real_from_target): Likewise.
* tree.h (struct tree_real_cst): Use real_value not realvaluetype.
* gengtype-yacc.y (bitfieldopt): Accept an ID as well.
2002-09-20 Richard Henderson <rth@redhat.com>
* real.h (UNKNOWN_FLOAT_FORMAT, IEEE_FLOAT_FORMAT, VAX_FLOAT_FORMAT,
IBM_FLOAT_FORMAT, C4X_FLOAT_FORMAT, TARGET_FLOAT_FORMAT): Move ...
* defaults.h: ... here.
......@@ -214,6 +214,7 @@ struct_fields: { $$ = NULL; }
bitfieldopt: /* empty */
| ':' NUM
| ':' ID
;
type: SCALAR
......
......@@ -24,26 +24,47 @@
#include "machmode.h"
/* REAL_VALUE_TYPE is an array of the minimum number of HOST_WIDE_INTs
required to hold a 128-bit floating point type. This is true even
if the maximum precision floating point type on the target is smaller.
/* An expanded form of the represented number. */
/* Enumerate the special cases of numbers that we encounter. */
enum real_value_class {
rvc_zero,
rvc_normal,
rvc_inf,
rvc_nan
};
#define SIGNIFICAND_BITS 128
#define EXP_BITS (32 - 3)
#define MAX_EXP ((1 << (EXP_BITS - 1)) - 1)
#define SIGSZ (SIGNIFICAND_BITS / HOST_BITS_PER_LONG)
#define SIG_MSB ((unsigned long)1 << (HOST_BITS_PER_LONG - 1))
struct real_value GTY(())
{
enum real_value_class class : 2;
unsigned int sign : 1;
int exp : EXP_BITS;
unsigned long sig[SIGSZ];
};
The extra 32 bits are for storing the mode of the float. Ideally
we'd keep this elsewhere, but that's too drastic a change all at once. */
/* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it
needs to be a macro. We do need to continue to have a structure tag
so that other headers can forward declare it. */
#define REAL_VALUE_TYPE struct real_value
#define REAL_VALUE_TYPE_SIZE (128 + 32)
/* We store a REAL_VALUE_TYPE into an rtx, and we do this by putting it in
consecutive "w" slots. Moreover, we've got to compute the number of "w"
slots at preprocessor time, which means we can't use sizeof. Guess. */
#define REAL_VALUE_TYPE_SIZE (SIGNIFICAND_BITS + 32)
#define REAL_WIDTH \
(REAL_VALUE_TYPE_SIZE/HOST_BITS_PER_WIDE_INT \
+ (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
struct realvaluetype GTY(()) {
HOST_WIDE_INT r[REAL_WIDTH];
};
/* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it needs
to be a macro. realvaluetype cannot be a typedef as this interferes with
other headers declaring opaque pointers to it. */
#define REAL_VALUE_TYPE struct realvaluetype
/* Verify the guess. */
extern char test_real_width
[sizeof(REAL_VALUE_TYPE) <= REAL_WIDTH*sizeof(HOST_WIDE_INT) ? 1 : -1];
/* Calculate the format for CONST_DOUBLE. We need as many slots as
are necessary to overlay a REAL_VALUE_TYPE on them. This could be
......
......@@ -726,10 +726,10 @@ struct tree_int_cst GTY(())
#define TREE_CST_RTL(NODE) (CST_OR_CONSTRUCTOR_CHECK (NODE)->real_cst.rtl)
/* In a REAL_CST node. struct realvaluetype is an opaque entity, with
/* In a REAL_CST node. struct real_value is an opaque entity, with
manipulators defined in real.h. We don't want tree.h depending on
real.h and transitively on tm.h. */
struct realvaluetype;
struct real_value;
#define TREE_REAL_CST_PTR(NODE) (REAL_CST_CHECK (NODE)->real_cst.real_cst_ptr)
#define TREE_REAL_CST(NODE) (*TREE_REAL_CST_PTR (NODE))
......@@ -738,7 +738,7 @@ struct tree_real_cst GTY(())
{
struct tree_common common;
rtx rtl; /* acts as link to register transfer language (rtl) info */
struct realvaluetype * real_cst_ptr;
struct real_value * real_cst_ptr;
};
/* In a STRING_CST */
......
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