* defs.h, findvar.c (extract_floating, store_floating): New functions.

* Move SWAP_TARGET_AND_HOST from defs.h to findvar.c because it is
	now used only by extract_floating and store_floating.
	* valprint.c (print_floating): Use unsigned arithmetic.  Use
	extract_unsigned_integer instead of SWAP_TARGET_AND_HOST.
	Change sizeof (float) to 4 and sizeof (double) to 8 (those are always
	the relevant sizes for this code, which is in #ifdef IEEE_FLOAT).
	* values.c (unpack_long, unpack_double, value_from_double),
	valarith.c (value_binop), stabsread.c (define_symbol):
	Use extract_floating and store_floating instead of
	SWAP_TARGET_AND_HOST.
	* config/m68k/tm-m68k.h, config/i960/tm-i960.h (REGISTER_CONVERT_*):
	Use extract_floating and store_floating.
	* config/m88k/tm-m88k.h: Add comments (it should be doing the same).
	* i386-tdep.c (i386_extract_return_value),
	* remote-nindy.c (nindy_store_registers): Use store_floating.
This commit is contained in:
Jim Kingdon 1993-10-29 18:16:33 +00:00
parent e1ec9f078f
commit bf5c0d6448
7 changed files with 96 additions and 108 deletions

View file

@ -613,11 +613,13 @@ define_symbol (valu, string, desc, type, objfile)
double d = atof (p);
char *dbl_valu;
/* FIXME-if-picky-about-floating-accuracy: Should be using
target arithmetic to get the value. real.c in GCC
probably has the necessary code. */
/* FIXME: lookup_fundamental_type is a hack. We should be
creating a type especially for the type of float constants.
Problem is, what type should it be? We currently have to
read this in host floating point format, but what type
represents a host format "double"?
Problem is, what type should it be?
Also, what should the name of this type be? Should we
be using 'S' constants (see stabs.texinfo) instead? */
@ -625,11 +627,9 @@ define_symbol (valu, string, desc, type, objfile)
SYMBOL_TYPE (sym) = lookup_fundamental_type (objfile,
FT_DBL_PREC_FLOAT);
dbl_valu = (char *)
obstack_alloc (&objfile -> symbol_obstack, sizeof (double));
memcpy (dbl_valu, &d, sizeof (double));
/* Put it in target byte order, but it's still in host
floating point format. */
SWAP_TARGET_AND_HOST (dbl_valu, sizeof (double));
obstack_alloc (&objfile -> symbol_obstack,
TYPE_LENGTH (SYMBOL_TYPE (sym)));
store_floating (dbl_valu, TYPE_LENGTH (SYMBOL_TYPE (sym)));
SYMBOL_VALUE_BYTES (sym) = dbl_valu;
SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
}