Index: ChangeLog 2002-01-19 Andrew Cagney * doublest.h (floatformat_from_type): Declare. * doublest.c (floatformat_from_type): New function. (convert_typed_floating): Use. * valprint.c (print_floating): Replace checks for IEEE_FLOAT with call to function floatformat_from_type. * gdbarch.sh (IEEE_FLOAT): Delete. * gdbarch.h, gdbarch.c: Re-generate. * config/i960/tm-i960.h (IEEE_FLOAT): Delete macro. * config/i386/tm-i386.h (IEEE_FLOAT): Ditto. * config/z8k/tm-z8k.h (IEEE_FLOAT): Ditto. * config/sparc/tm-sparc.h (IEEE_FLOAT): Ditto. * config/pa/tm-hppa.h (IEEE_FLOAT): Ditto. * config/m88k/tm-m88k.h (IEEE_FLOAT): Ditto. * config/m68k/tm-m68k.h (IEEE_FLOAT): Ditto. * config/h8500/tm-h8500.h (IEEE_FLOAT): Ditto. * config/h8300/tm-h8300.h (IEEE_FLOAT): Ditto. * config/fr30/tm-fr30.h (IEEE_FLOAT): Ditto. * config/arm/tm-arm.h (IEEE_FLOAT): Ditto. * config/arc/tm-arc.h (IEEE_FLOAT): Ditto. * config/alpha/tm-alpha.h (IEEE_FLOAT): Ditto. * s390-tdep.c (s390_gdbarch_init): Do not set ieee_float. * x86-64-tdep.c (i386_gdbarch_init): Ditto. * sparc-tdep.c (sparc_gdbarch_init): Ditto. * sh-tdep.c (sh_gdbarch_init): Ditto. * mips-tdep.c (mips_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. Index: doc/ChangeLog 2002-01-19 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Remove definition of IEEE_FLOAT. Index: cris-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/cris-tdep.c,v retrieving revision 1.10 diff -u -r1.10 cris-tdep.c --- cris-tdep.c 2002/01/05 04:30:16 1.10 +++ cris-tdep.c 2002/01/19 20:58:16 @@ -4154,9 +4154,6 @@ which means we have to set this explicitly. */ set_gdbarch_long_double_bit (gdbarch, 64); - /* Floating point is IEEE compatible. */ - set_gdbarch_ieee_float (gdbarch, 1); - /* There are 32 registers (some of which may not be implemented). */ set_gdbarch_num_regs (gdbarch, 32); set_gdbarch_sp_regnum (gdbarch, 14); Index: doublest.c =================================================================== RCS file: /cvs/src/src/gdb/doublest.c,v retrieving revision 1.6 diff -u -r1.6 doublest.c --- doublest.c 2001/10/29 23:35:37 1.6 +++ doublest.c 2002/01/19 20:58:18 @@ -619,7 +619,7 @@ target-dependent code, the format of floating-point types is known, but not passed on by GDB. This should be fixed. */ -static const struct floatformat * +const struct floatformat * floatformat_from_length (int len) { if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT) @@ -632,6 +632,16 @@ return NULL; } +const struct floatformat * +floatformat_from_type (const struct type *type) +{ + gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + if (TYPE_FLOATFORMAT (type) != NULL) + return TYPE_FLOATFORMAT (type); + else + return floatformat_from_length (TYPE_LENGTH (type)); +} + /* If the host doesn't define NAN, use zero instead. */ #ifndef NAN #define NAN 0.0 @@ -732,18 +742,11 @@ convert_typed_floating (const void *from, const struct type *from_type, void *to, const struct type *to_type) { - const struct floatformat *from_fmt = TYPE_FLOATFORMAT (from_type); - const struct floatformat *to_fmt = TYPE_FLOATFORMAT (to_type); + const struct floatformat *from_fmt = floatformat_from_type (from_type); + const struct floatformat *to_fmt = floatformat_from_type (to_type); gdb_assert (TYPE_CODE (from_type) == TYPE_CODE_FLT); gdb_assert (TYPE_CODE (to_type) == TYPE_CODE_FLT); - - /* If the floating-point format of FROM_TYPE or TO_TYPE isn't known, - try to guess it from the type's length. */ - if (from_fmt == NULL) - from_fmt = floatformat_from_length (TYPE_LENGTH (from_type)); - if (to_fmt == NULL) - to_fmt = floatformat_from_length (TYPE_LENGTH (to_type)); if (from_fmt == NULL || to_fmt == NULL) { Index: doublest.h =================================================================== RCS file: /cvs/src/src/gdb/doublest.h,v retrieving revision 1.7 diff -u -r1.7 doublest.h --- doublest.h 2001/10/29 23:35:37 1.7 +++ doublest.h 2002/01/19 20:58:19 @@ -68,6 +68,12 @@ extern DOUBLEST extract_floating (const void *addr, int len); extern void store_floating (void *addr, int len, DOUBLEST val); +/* Given TYPE, return its floatformat. TYPE_FLOATFORMAT() may return + NULL. type_floatformat() detects that and returns a floatformat + based on the type size when FLOATFORMAT is NULL. */ + +const struct floatformat *floatformat_from_type (const struct type *type); + extern DOUBLEST extract_typed_floating (const void *addr, const struct type *type); extern void store_typed_floating (void *addr, const struct type *type, Index: gdbarch.sh =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.sh,v retrieving revision 1.103 diff -u -r1.103 gdbarch.sh --- gdbarch.sh 2002/01/05 04:30:17 1.103 +++ gdbarch.sh 2002/01/19 20:58:40 @@ -403,8 +403,6 @@ # One if \`char' acts like \`signed char', zero if \`unsigned char'. v::TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1:::: # -v::IEEE_FLOAT:int:ieee_float::::0:0::0::: -# f::TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0 f::TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0 f::TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0 Index: m68hc11-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v retrieving revision 1.15 diff -u -r1.15 m68hc11-tdep.c --- m68hc11-tdep.c 2001/07/22 12:37:02 1.15 +++ m68hc11-tdep.c 2002/01/19 20:58:45 @@ -1157,7 +1157,6 @@ set_gdbarch_stack_align (gdbarch, m68hc11_stack_align); set_gdbarch_believe_pcc_promotion (gdbarch, 1); - set_gdbarch_ieee_float (gdbarch, 1); return gdbarch; } Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.63 diff -u -r1.63 mips-tdep.c --- mips-tdep.c 2002/01/05 04:30:17 1.63 +++ mips-tdep.c 2002/01/19 20:59:16 @@ -4283,7 +4283,6 @@ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc); set_gdbarch_decr_pc_after_break (gdbarch, 0); - set_gdbarch_ieee_float (gdbarch, 1); set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue); set_gdbarch_saved_pc_after_call (gdbarch, mips_saved_pc_after_call); Index: s390-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/s390-tdep.c,v retrieving revision 1.39 diff -u -r1.39 s390-tdep.c --- s390-tdep.c 2001/12/20 08:55:31 1.39 +++ s390-tdep.c 2002/01/19 20:59:21 @@ -1785,7 +1785,6 @@ but not always. */ set_gdbarch_decr_pc_after_break (gdbarch, 2); set_gdbarch_pop_frame (gdbarch, s390_pop_frame); - set_gdbarch_ieee_float (gdbarch, 1); /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Offset from address of function to start of its code. Index: sh-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/sh-tdep.c,v retrieving revision 1.44 diff -u -r1.44 sh-tdep.c --- sh-tdep.c 2002/01/12 16:38:47 1.44 +++ sh-tdep.c 2002/01/19 20:59:25 @@ -2123,7 +2123,6 @@ set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_believe_pcc_promotion (gdbarch, 1); - set_gdbarch_ieee_float (gdbarch, 1); return gdbarch; } Index: sparc-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-tdep.c,v retrieving revision 1.20 diff -u -r1.20 sparc-tdep.c --- sparc-tdep.c 2001/12/30 17:00:43 1.20 +++ sparc-tdep.c 2002/01/19 20:59:30 @@ -2963,7 +2963,6 @@ set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); set_gdbarch_get_saved_register (gdbarch, sparc_get_saved_register); - set_gdbarch_ieee_float (gdbarch, 1); set_gdbarch_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); Index: valprint.c =================================================================== RCS file: /cvs/src/src/gdb/valprint.c,v retrieving revision 1.20 diff -u -r1.20 valprint.c --- valprint.c 2002/01/05 04:30:20 1.20 +++ valprint.c 2002/01/19 20:59:35 @@ -548,21 +548,9 @@ { DOUBLEST doub; int inv; - const struct floatformat *fmt = &floatformat_unknown; + const struct floatformat *fmt = floatformat_from_type (type); unsigned len = TYPE_LENGTH (type); - /* FIXME: kettenis/2001-01-20: The check for IEEE_FLOAT is probably - still necessary since GDB by default assumes that the target uses - the IEEE 754 representation for its floats and doubles. Of - course this is all crock and should be cleaned up. */ - - if (len == TARGET_FLOAT_BIT / TARGET_CHAR_BIT && IEEE_FLOAT) - fmt = TARGET_FLOAT_FORMAT; - else if (len == TARGET_DOUBLE_BIT / TARGET_CHAR_BIT && IEEE_FLOAT) - fmt = TARGET_DOUBLE_FORMAT; - else if (len == TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT) - fmt = TARGET_LONG_DOUBLE_FORMAT; - if (floatformat_is_nan (fmt, valaddr)) { if (floatformat_is_negative (fmt, valaddr)) @@ -575,6 +563,13 @@ return; } + /* FIXME: cagney/2002-01-15: The simpler extract_typed_floating() + routine could be used here only that routine has no way of + indicating that the floating point it extracted was invalid (As + indicated by INVALID_FLOAT). Instead, this code here could call + something like floating_invalid() to check for an invalid + floating point. */ + doub = unpack_double (type, valaddr, &inv); if (inv) { @@ -584,6 +579,10 @@ /* FIXME: kettenis/2001-01-20: The following code makes too much assumptions about the host and target floating point format. */ + + /* FIXME: cagney/2002-01-15: The floatformat pointed to by FMT + should contain all the information needed to print the + floating-point value without host dependencies. */ if (len < sizeof (double)) fprintf_filtered (stream, "%.9g", (double) doub); Index: x86-64-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v retrieving revision 1.6 diff -u -r1.6 x86-64-tdep.c --- x86-64-tdep.c 2001/12/27 15:22:27 1.6 +++ x86-64-tdep.c 2002/01/19 20:59:36 @@ -834,8 +834,6 @@ set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); - set_gdbarch_ieee_float (gdbarch, 1); - set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS); set_gdbarch_register_name (gdbarch, x86_64_register_name); Index: config/alpha/tm-alpha.h =================================================================== RCS file: /cvs/src/src/gdb/config/alpha/tm-alpha.h,v retrieving revision 1.12 diff -u -r1.12 tm-alpha.h --- tm-alpha.h 2002/01/19 20:22:28 1.12 +++ tm-alpha.h 2002/01/19 20:59:43 @@ -43,9 +43,6 @@ #define TARGET_LONG_LONG_BIT 64 #define TARGET_PTR_BIT 64 -/* Floating point is IEEE compliant */ -#define IEEE_FLOAT (1) - /* Number of traps that happen between exec'ing the shell * to run an inferior, and when we finally get to * the inferior code. This is 2 on most implementations. Index: config/arc/tm-arc.h =================================================================== RCS file: /cvs/src/src/gdb/config/arc/tm-arc.h,v retrieving revision 1.7 diff -u -r1.7 tm-arc.h --- tm-arc.h 2001/03/21 18:31:48 1.7 +++ tm-arc.h 2002/01/19 20:59:43 @@ -27,9 +27,6 @@ /* Byte order is selectable. */ #define TARGET_BYTE_ORDER_SELECTABLE -/* We have IEEE floating point, if we have any float at all. */ -#define IEEE_FLOAT (1) - /* Offset from address of function to start of its code. Zero on most machines. */ #define FUNCTION_START_OFFSET 0 Index: config/arm/tm-arm.h =================================================================== RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v retrieving revision 1.13 diff -u -r1.13 tm-arm.h --- tm-arm.h 2002/01/09 18:39:37 1.13 +++ tm-arm.h 2002/01/19 20:59:47 @@ -35,7 +35,6 @@ #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE /* IEEE format floating point. */ -#define IEEE_FLOAT (1) #define TARGET_DOUBLE_FORMAT (target_byte_order == BFD_ENDIAN_BIG \ ? &floatformat_ieee_double_big \ : &floatformat_ieee_double_littlebyte_bigword) Index: config/fr30/tm-fr30.h =================================================================== RCS file: /cvs/src/src/gdb/config/fr30/tm-fr30.h,v retrieving revision 1.7 diff -u -r1.7 tm-fr30.h --- tm-fr30.h 2002/01/05 04:30:28 1.7 +++ tm-fr30.h 2002/01/19 20:59:47 @@ -187,9 +187,6 @@ /* Define this for Wingdb */ #define TARGET_FR30 -/* IEEE format floating point */ -#define IEEE_FLOAT (1) - /* Define other aspects of the stack frame. */ /* An expression that tells us whether the function invocation represented Index: config/h8300/tm-h8300.h =================================================================== RCS file: /cvs/src/src/gdb/config/h8300/tm-h8300.h,v retrieving revision 1.8 diff -u -r1.8 tm-h8300.h --- tm-h8300.h 2002/01/05 04:30:29 1.8 +++ tm-h8300.h 2002/01/19 20:59:48 @@ -58,7 +58,6 @@ extern void h8300_init_extra_frame_info (); -#define IEEE_FLOAT (1) /* Define the bit, byte, and word ordering of the machine. */ #define TARGET_BYTE_ORDER BFD_ENDIAN_BIG #undef TARGET_INT_BIT Index: config/h8500/tm-h8500.h =================================================================== RCS file: /cvs/src/src/gdb/config/h8500/tm-h8500.h,v retrieving revision 1.8 diff -u -r1.8 tm-h8500.h --- tm-h8500.h 2002/01/05 04:30:30 1.8 +++ tm-h8500.h 2002/01/19 20:59:48 @@ -25,8 +25,6 @@ #define GDB_TARGET_IS_H8500 -#define IEEE_FLOAT (1) - /* Define the bit, byte, and word ordering of the machine. */ #define TARGET_BYTE_ORDER BFD_ENDIAN_BIG Index: config/i386/tm-i386.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/tm-i386.h,v retrieving revision 1.27 diff -u -r1.27 tm-i386.h --- tm-i386.h 2001/12/27 15:22:27 1.27 +++ tm-i386.h 2002/01/19 20:59:48 @@ -47,11 +47,6 @@ #define TARGET_LONG_DOUBLE_BIT 96 -/* Used for example in valprint.c:print_floating() to enable checking - for NaN's */ - -#define IEEE_FLOAT (1) - /* Number of traps that happen between exec'ing the shell to run an inferior, and when we finally get to the inferior code. This is 2 on most implementations. */ Index: config/i960/tm-i960.h =================================================================== RCS file: /cvs/src/src/gdb/config/i960/tm-i960.h,v retrieving revision 1.6 diff -u -r1.6 tm-i960.h --- tm-i960.h 2001/12/15 16:53:23 1.6 +++ tm-i960.h 2002/01/19 20:59:48 @@ -41,10 +41,6 @@ /* Byte order is configurable, but this machine runs little-endian. */ #define TARGET_BYTE_ORDER BFD_ENDIAN_LITTLE -/* We have IEEE floating point, if we have any float at all. */ - -#define IEEE_FLOAT (1) - /* Offset from address of function to start of its code. Zero on most machines. */ Index: config/m68k/tm-m68k.h =================================================================== RCS file: /cvs/src/src/gdb/config/m68k/tm-m68k.h,v retrieving revision 1.8 diff -u -r1.8 tm-m68k.h --- tm-m68k.h 2002/01/05 04:30:34 1.8 +++ tm-m68k.h 2002/01/19 20:59:49 @@ -23,8 +23,6 @@ /* Generic 68000 stuff, to be included by other tm-*.h files. */ -#define IEEE_FLOAT (1) - /* Define the bit, byte, and word ordering of the machine. */ #define TARGET_BYTE_ORDER BFD_ENDIAN_BIG Index: config/m88k/tm-m88k.h =================================================================== RCS file: /cvs/src/src/gdb/config/m88k/tm-m88k.h,v retrieving revision 1.10 diff -u -r1.10 tm-m88k.h --- tm-m88k.h 2002/01/05 04:30:36 1.10 +++ tm-m88k.h 2002/01/19 20:59:49 @@ -47,8 +47,6 @@ init_extra_frame_info (fromleaf, fi) extern void init_extra_frame_info (); -#define IEEE_FLOAT (1) - /* Offset from address of function to start of its code. Zero on most machines. */ Index: config/pa/tm-hppa.h =================================================================== RCS file: /cvs/src/src/gdb/config/pa/tm-hppa.h,v retrieving revision 1.12 diff -u -r1.12 tm-hppa.h --- tm-hppa.h 2002/01/15 02:06:47 1.12 +++ tm-hppa.h 2002/01/19 20:59:50 @@ -54,10 +54,6 @@ ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1)) #endif -/* Watch out for NaNs */ - -#define IEEE_FLOAT (1) - /* On the PA, any pass-by-value structure > 8 bytes is actually passed via a pointer regardless of its type or the compiler used. */ Index: config/sparc/tm-sparc.h =================================================================== RCS file: /cvs/src/src/gdb/config/sparc/tm-sparc.h,v retrieving revision 1.10 diff -u -r1.10 tm-sparc.h --- tm-sparc.h 2002/01/05 04:30:39 1.10 +++ tm-sparc.h 2002/01/19 20:59:53 @@ -298,9 +298,6 @@ #define STACK_ALIGN(ADDR) sparc32_stack_align (ADDR) extern CORE_ADDR sparc32_stack_align (CORE_ADDR addr); -/* Floating point is IEEE compatible. */ -#define IEEE_FLOAT (1) - /* The Sparc returns long doubles on the stack. */ #define RETURN_VALUE_ON_STACK(TYPE) \ Index: config/z8k/tm-z8k.h =================================================================== RCS file: /cvs/src/src/gdb/config/z8k/tm-z8k.h,v retrieving revision 1.6 diff -u -r1.6 tm-z8k.h --- tm-z8k.h 2002/01/05 04:30:40 1.6 +++ tm-z8k.h 2002/01/19 20:59:54 @@ -19,8 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define IEEE_FLOAT (1) - #undef TARGET_INT_BIT #undef TARGET_LONG_BIT #undef TARGET_SHORT_BIT Index: doc/gdbint.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v retrieving revision 1.56 diff -u -r1.56 gdbint.texinfo --- gdbint.texinfo 2002/01/18 04:51:10 1.56 +++ gdbint.texinfo 2002/01/19 21:00:13 @@ -3075,10 +3075,6 @@ @samp{$} or @samp{$$}. For example, @code{$$dyncall} is a millicode routine that handles inter-space procedure calls on PA-RISC. -@item IEEE_FLOAT -@findex IEEE_FLOAT -Define this if the target system uses IEEE-format floating point numbers. - @item INIT_EXTRA_FRAME_INFO (@var{fromleaf}, @var{frame}) @findex INIT_EXTRA_FRAME_INFO If additional information about the frame is required this should be