* 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.
This commit is contained in:
Stu Grossman 1996-04-12 16:53:08 +00:00
parent 9b1271617b
commit c6fbd98bed
4 changed files with 35 additions and 44 deletions

View File

@ -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 <fnf@cygnus.com>
From: Miles Bader <miles@gnu.ai.mit.edu>

View File

@ -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));

View File

@ -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
{

View File

@ -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,
&registers[REGISTER_BYTE (regnum)]);
FLOATFORMAT_FROM_DOUBLEST (&floatformat_i960_ext, &dub,
&registers[REGISTER_BYTE (regnum)]);
}
registers_fetched ();
@ -483,8 +483,8 @@ nindy_store_registers(regno)
memcpy (nindy_regs.tcw, &registers[REGISTER_BYTE (TCW_REGNUM)], 1*4);
for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++)
{
floatformat_to_double (&floatformat_i960_ext,
&registers[REGISTER_BYTE (regnum)], &dub);
FLOATFORMAT_TO_DOUBLEST (&floatformat_i960_ext,
&registers[REGISTER_BYTE (regnum)], &dub);
store_floating (&nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)],
REGISTER_VIRTUAL_SIZE (regnum),
dub);