From c6fbd98bed167d79e49c0d4a38b5432853f11799 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Fri, 12 Apr 1996 16:53:08 +0000 Subject: [PATCH] * defs.h: Define TARGET_{FLOAT DOUBLE LONG_DOUBLE}_FORMAT defaults for bi-endian targets. Replace function pointers for floatformat routines with macros. No need for these to be runtime selectable. * findvar.c: Get rid of floatformat function pointers. Use macros in extract_floating and store_floating. * remote-nindy.c (nindy_fetch_registers nindy_store_registers): Use floatformat macros. --- gdb/ChangeLog | 11 +++++++++++ gdb/defs.h | 32 ++++++++++++++------------------ gdb/findvar.c | 28 ++++++---------------------- gdb/remote-nindy.c | 8 ++++---- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 52001c05572..94e1ebac110 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +Fri Apr 12 09:45:29 1996 Stu Grossman (grossman@critters.cygnus.com) + + * defs.h: Define TARGET_{FLOAT DOUBLE LONG_DOUBLE}_FORMAT + defaults for bi-endian targets. Replace function pointers for + floatformat routines with macros. No need for these to be runtime + selectable. + * findvar.c: Get rid of floatformat function pointers. Use + macros in extract_floating and store_floating. + * remote-nindy.c (nindy_fetch_registers nindy_store_registers): + Use floatformat macros. + Thu Apr 11 21:28:02 1996 Fred Fish From: Miles Bader diff --git a/gdb/defs.h b/gdb/defs.h index ce36938bdb2..d11c6b1232e 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -874,21 +874,23 @@ extern const struct floatformat floatformat_unknown; # define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_little # endif # endif -# ifndef TARGET_LONG_DOUBLE_FORMAT -# define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown -# endif #else /* TARGET_BYTE_ORDER_SELECTABLE */ # ifndef TARGET_FLOAT_FORMAT - Need a definition for target float format +# define TARGET_FLOAT_FORMAT (target_byte_order == BIG_ENDIAN \ + ? &floatformat_ieee_single_big \ + : &floatformat_ieee_single_little) # endif # ifndef TARGET_DOUBLE_FORMAT - Need a definition for target double format -# endif -# ifndef TARGET_LONG_DOUBLE_FORMAT - Need a definition for target long double format +# define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \ + ? &floatformat_ieee_double_big \ + : &floatformat_ieee_double_little) # endif #endif +#ifndef TARGET_LONG_DOUBLE_FORMAT +# define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown +#endif + /* Use `long double' if the host compiler supports it. (Note that this is not necessarily any longer than `double'. On SunOS/gcc, it's the same as double.) This is necessary because GDB internally converts all floating @@ -904,20 +906,14 @@ extern void floatformat_to_long_double PARAMS ((const struct floatformat *, char *, DOUBLEST *)); extern void floatformat_from_long_double PARAMS ((const struct floatformat *, DOUBLEST *, char *)); +#define FLOATFORMAT_TO_DOUBLEST floatformat_to_long_double +#define FLOATFORMAT_FROM_DOUBLEST floatformat_from_long_double #else typedef double DOUBLEST; +#define FLOATFORMAT_TO_DOUBLEST floatformat_to_double +#define FLOATFORMAT_FROM_DOUBLEST floatformat_from_double #endif -/* Pointer to appropriate conversion routine to convert between target floating - point format and DOUBLEST. */ - -extern void -(*floatformat_to_doublest) PARAMS ((const struct floatformat *, - char *, DOUBLEST *)); -extern void -(*floatformat_from_doublest) PARAMS ((const struct floatformat *, - DOUBLEST *, char *)); - extern DOUBLEST extract_floating PARAMS ((void *, int)); extern void store_floating PARAMS ((void *, int, DOUBLEST)); diff --git a/gdb/findvar.c b/gdb/findvar.c index 7764a21815a..6cb7d37cab8 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -34,22 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ const struct floatformat floatformat_unknown; -#ifdef HAVE_LONG_DOUBLE -void (*floatformat_to_doublest) - PARAMS ((const struct floatformat *, - char *, DOUBLEST *)) = floatformat_to_long_double; -void (*floatformat_from_doublest) - PARAMS ((const struct floatformat *, - DOUBLEST *, char *)) = floatformat_from_long_double; -#else -void (*floatformat_to_doublest) - PARAMS ((const struct floatformat *, - char *, DOUBLEST *)) = floatformat_to_double; -void (*floatformat_from_doublest) - PARAMS ((const struct floatformat *, - DOUBLEST *, char *)) = floatformat_from_double; -#endif - /* Registers we shouldn't try to store. */ #if !defined (CANNOT_STORE_REGISTER) #define CANNOT_STORE_REGISTER(regno) 0 @@ -320,7 +304,7 @@ extract_floating (addr, len) return retval; } else - floatformat_to_doublest (TARGET_FLOAT_FORMAT, addr, &dretval); + FLOATFORMAT_TO_DOUBLEST (TARGET_FLOAT_FORMAT, addr, &dretval); } else if (len == sizeof (double)) { @@ -332,7 +316,7 @@ extract_floating (addr, len) return retval; } else - floatformat_to_doublest (TARGET_DOUBLE_FORMAT, addr, &dretval); + FLOATFORMAT_TO_DOUBLEST (TARGET_DOUBLE_FORMAT, addr, &dretval); } else if (len == sizeof (DOUBLEST)) { @@ -344,7 +328,7 @@ extract_floating (addr, len) return retval; } else - floatformat_to_doublest (TARGET_LONG_DOUBLE_FORMAT, addr, &dretval); + FLOATFORMAT_TO_DOUBLEST (TARGET_LONG_DOUBLE_FORMAT, addr, &dretval); } else { @@ -369,7 +353,7 @@ store_floating (addr, len, val) memcpy (addr, &floatval, sizeof (floatval)); } else - floatformat_from_doublest (TARGET_FLOAT_FORMAT, &val, addr); + FLOATFORMAT_FROM_DOUBLEST (TARGET_FLOAT_FORMAT, &val, addr); } else if (len == sizeof (double)) { @@ -380,14 +364,14 @@ store_floating (addr, len, val) memcpy (addr, &doubleval, sizeof (doubleval)); } else - floatformat_from_doublest (TARGET_DOUBLE_FORMAT, &val, addr); + FLOATFORMAT_FROM_DOUBLEST (TARGET_DOUBLE_FORMAT, &val, addr); } else if (len == sizeof (DOUBLEST)) { if (HOST_LONG_DOUBLE_FORMAT == TARGET_LONG_DOUBLE_FORMAT) memcpy (addr, &val, sizeof (val)); else - floatformat_from_doublest (TARGET_LONG_DOUBLE_FORMAT, &val, addr); + FLOATFORMAT_FROM_DOUBLEST (TARGET_LONG_DOUBLE_FORMAT, &val, addr); } else { diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c index cb223a24f6c..29e59230ebc 100644 --- a/gdb/remote-nindy.c +++ b/gdb/remote-nindy.c @@ -454,8 +454,8 @@ nindy_fetch_registers(regno) &nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)], &inv); /* dub now in host byte order */ - floatformat_from_double (&floatformat_i960_ext, &dub, - ®isters[REGISTER_BYTE (regnum)]); + FLOATFORMAT_FROM_DOUBLEST (&floatformat_i960_ext, &dub, + ®isters[REGISTER_BYTE (regnum)]); } registers_fetched (); @@ -483,8 +483,8 @@ nindy_store_registers(regno) memcpy (nindy_regs.tcw, ®isters[REGISTER_BYTE (TCW_REGNUM)], 1*4); for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++) { - floatformat_to_double (&floatformat_i960_ext, - ®isters[REGISTER_BYTE (regnum)], &dub); + FLOATFORMAT_TO_DOUBLEST (&floatformat_i960_ext, + ®isters[REGISTER_BYTE (regnum)], &dub); store_floating (&nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)], REGISTER_VIRTUAL_SIZE (regnum), dub); -- 2.30.2