Target FP: Remove convert_typed_floating from tdep files

This patch mechanically replaces convert_typed_floating with the
equivalent target_float_convert throughout tdep files, to prepare
for the removal of doublest.{c,h}.

No functional change intended.

gdb/ChangeLog:
2017-11-06  Ulrich Weigand  <uweigand@de.ibm.com>

	* i386-tdep.c: Include "target-float.h".  Do not include "doublest.h".
	(i386_extract_return_value): Use target_float_convert.
	(i386_store_return_value): Likewise.
	* i387-tdep.c (i387_register_to_value): Use target_float_convert.
	(i387_value_to_register): Likewise.
	* ia64-tdep.c: Include "target-float.h".  Do not include "doublest.h".
	(ia64_register_to_value): Use target_float_convert.
	(ia64_value_to_register): Likewise.
	(ia64_extract_return_value): Likewise.
	(ia64_store_return_value): Likewise.
	(ia64_push_dummy_call): Likewise.
	* m68k-tdep.c: Include "target-float.h".
	(m68k_register_to_value): Use target_float_convert.
	(m68k_value_to_register): Likewise.
	(m68k_svr4_extract_return_value): Likewise.
	(m68k_svr4_store_return_value): Likewise.
	* ppc-sysv-tdep.c: Include "target-float.h".
	(ppc_sysv_abi_push_dummy_call): Use target_float_convert.
	(do_ppc_sysv_return_value): Likewise.
	(ppc64_sysv_abi_push_freg): Likewise.
	(ppc64_sysv_abi_return_value_base): Likewise.
	* rs6000-aix-tdep.c: Include "target-float.h".
	(rs6000_push_dummy_call): Use target_float_convert.
	(rs6000_return_value): Likewise.
	* rs6000-lynx178-tdep.c: Include "target-float.h".
	(rs6000_lynx178_push_dummy_call): Use target_float_convert.
	(rs6000_lynx178_return_value): Likewise.
	* rs6000-tdep.c: Include "target-float.h".  Do not include "doublest.h".
	(rs6000_register_to_value): Use target_float_convert.
	(rs6000_value_to_register): Likewise.
	* arm-tdep.c: Include "target-float.h".  Do not include "doublest.h".
	(arm_extract_return_value): Use target_float_convert.
	(arm_store_return_value): Likewise.
	* sh-tdep.c: Include "target-float.h".  Do not include "doublest.h".
	(sh_register_convert_to_virtual): Use target_float_convert.
	(sh_register_convert_to_raw): Likewise.
	* sh64-tdep.c: Include "target-float.h".
	(sh64_extract_return_value): Use target_float_convert.
	(sh64_register_convert_to_virtual): Likewise.
	(sh64_register_convert_to_raw): Likewise.  Fix argument types.
This commit is contained in:
Ulrich Weigand 2017-11-06 16:01:37 +01:00
parent 14ad931172
commit 3b2ca8248c
12 changed files with 106 additions and 60 deletions

View File

@ -1,3 +1,46 @@
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* i386-tdep.c: Include "target-float.h". Do not include "doublest.h".
(i386_extract_return_value): Use target_float_convert.
(i386_store_return_value): Likewise.
* i387-tdep.c (i387_register_to_value): Use target_float_convert.
(i387_value_to_register): Likewise.
* ia64-tdep.c: Include "target-float.h". Do not include "doublest.h".
(ia64_register_to_value): Use target_float_convert.
(ia64_value_to_register): Likewise.
(ia64_extract_return_value): Likewise.
(ia64_store_return_value): Likewise.
(ia64_push_dummy_call): Likewise.
* m68k-tdep.c: Include "target-float.h".
(m68k_register_to_value): Use target_float_convert.
(m68k_value_to_register): Likewise.
(m68k_svr4_extract_return_value): Likewise.
(m68k_svr4_store_return_value): Likewise.
* ppc-sysv-tdep.c: Include "target-float.h".
(ppc_sysv_abi_push_dummy_call): Use target_float_convert.
(do_ppc_sysv_return_value): Likewise.
(ppc64_sysv_abi_push_freg): Likewise.
(ppc64_sysv_abi_return_value_base): Likewise.
* rs6000-aix-tdep.c: Include "target-float.h".
(rs6000_push_dummy_call): Use target_float_convert.
(rs6000_return_value): Likewise.
* rs6000-lynx178-tdep.c: Include "target-float.h".
(rs6000_lynx178_push_dummy_call): Use target_float_convert.
(rs6000_lynx178_return_value): Likewise.
* rs6000-tdep.c: Include "target-float.h". Do not include "doublest.h".
(rs6000_register_to_value): Use target_float_convert.
(rs6000_value_to_register): Likewise.
* arm-tdep.c: Include "target-float.h". Do not include "doublest.h".
(arm_extract_return_value): Use target_float_convert.
(arm_store_return_value): Likewise.
* sh-tdep.c: Include "target-float.h". Do not include "doublest.h".
(sh_register_convert_to_virtual): Use target_float_convert.
(sh_register_convert_to_raw): Likewise.
* sh64-tdep.c: Include "target-float.h".
(sh64_extract_return_value): Use target_float_convert.
(sh64_register_convert_to_virtual): Likewise.
(sh64_register_convert_to_raw): Likewise. Fix argument types.
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c (floatformat_to_host_double): New function.

View File

@ -30,7 +30,7 @@
#include "disasm.h"
#include "regcache.h"
#include "reggroups.h"
#include "doublest.h"
#include "target-float.h"
#include "value.h"
#include "arch-utils.h"
#include "osabi.h"
@ -7902,8 +7902,8 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
bfd_byte tmpbuf[FP_REGISTER_SIZE];
regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf);
convert_typed_floating (tmpbuf, arm_ext_type (gdbarch),
valbuf, type);
target_float_convert (tmpbuf, arm_ext_type (gdbarch),
valbuf, type);
}
break;
@ -8107,7 +8107,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
{
case ARM_FLOAT_FPA:
convert_typed_floating (valbuf, type, buf, arm_ext_type (gdbarch));
target_float_convert (valbuf, type, buf, arm_ext_type (gdbarch));
regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
break;

View File

@ -23,7 +23,6 @@
#include "command.h"
#include "dummy-frame.h"
#include "dwarf2-frame.h"
#include "doublest.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
@ -40,6 +39,7 @@
#include "symfile.h"
#include "symtab.h"
#include "target.h"
#include "target-float.h"
#include "value.h"
#include "dis-asm.h"
#include "disasm.h"
@ -2802,7 +2802,7 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
exactly how it would happen on the target itself, but it is
the best we can do. */
regcache_raw_read (regcache, I386_ST0_REGNUM, buf);
convert_typed_floating (buf, i387_ext_type (gdbarch), valbuf, type);
target_float_convert (buf, i387_ext_type (gdbarch), valbuf, type);
}
else
{
@ -2857,7 +2857,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
floating-point format used by the FPU. This is probably
not exactly how it would happen on the target itself, but
it is the best we can do. */
convert_typed_floating (valbuf, type, buf, i387_ext_type (gdbarch));
target_float_convert (valbuf, type, buf, i387_ext_type (gdbarch));
regcache_raw_write (regcache, I386_ST0_REGNUM, buf);
/* Set the top of the floating-point register stack to 7. The

View File

@ -369,7 +369,7 @@ i387_register_to_value (struct frame_info *frame, int regnum,
from, optimizedp, unavailablep))
return 0;
convert_typed_floating (from, i387_ext_type (gdbarch), to, type);
target_float_convert (from, i387_ext_type (gdbarch), to, type);
*optimizedp = *unavailablep = 0;
return 1;
}
@ -395,7 +395,7 @@ i387_value_to_register (struct frame_info *frame, int regnum,
}
/* Convert from TYPE. */
convert_typed_floating (from, type, to, i387_ext_type (gdbarch));
target_float_convert (from, type, to, i387_ext_type (gdbarch));
put_frame_register (frame, regnum, to);
}

View File

@ -28,7 +28,7 @@
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
#include "doublest.h"
#include "target-float.h"
#include "value.h"
#include "objfiles.h"
#include "elf/common.h" /* for DT_PLTGOT value */
@ -1228,7 +1228,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum,
in, optimizedp, unavailablep))
return 0;
convert_typed_floating (in, ia64_ext_type (gdbarch), out, valtype);
target_float_convert (in, ia64_ext_type (gdbarch), out, valtype);
*optimizedp = *unavailablep = 0;
return 1;
}
@ -1239,7 +1239,7 @@ ia64_value_to_register (struct frame_info *frame, int regnum,
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte out[IA64_FP_REGISTER_SIZE];
convert_typed_floating (in, valtype, out, ia64_ext_type (gdbarch));
target_float_convert (in, valtype, out, ia64_ext_type (gdbarch));
put_frame_register (frame, regnum, out);
}
@ -3209,8 +3209,8 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
regcache_cooked_read (regcache, regnum, from);
convert_typed_floating (from, ia64_ext_type (gdbarch),
(char *)valbuf + offset, float_elt_type);
target_float_convert (from, ia64_ext_type (gdbarch),
valbuf + offset, float_elt_type);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
}
@ -3273,8 +3273,8 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
convert_typed_floating ((char *)valbuf + offset, float_elt_type,
to, ia64_ext_type (gdbarch));
target_float_convert (valbuf + offset, float_elt_type,
to, ia64_ext_type (gdbarch));
regcache_cooked_write (regcache, regnum, to);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
@ -3829,9 +3829,9 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
while (len > 0 && floatreg < IA64_FR16_REGNUM)
{
gdb_byte to[IA64_FP_REGISTER_SIZE];
convert_typed_floating (value_contents (arg) + argoffset,
float_elt_type, to,
ia64_ext_type (gdbarch));
target_float_convert (value_contents (arg) + argoffset,
float_elt_type, to,
ia64_ext_type (gdbarch));
regcache_cooked_write (regcache, floatreg, to);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);

View File

@ -33,6 +33,7 @@
#include "dis-asm.h"
#include "target-descriptions.h"
#include "floatformat.h"
#include "target-float.h"
#include "m68k-tdep.h"
@ -214,7 +215,7 @@ m68k_register_to_value (struct frame_info *frame, int regnum,
from, optimizedp, unavailablep))
return 0;
convert_typed_floating (from, fpreg_type, to, type);
target_float_convert (from, fpreg_type, to, type);
*optimizedp = *unavailablep = 0;
return 1;
}
@ -239,7 +240,7 @@ m68k_value_to_register (struct frame_info *frame, int regnum,
}
/* Convert from TYPE. */
convert_typed_floating (from, type, to, fpreg_type);
target_float_convert (from, type, to, fpreg_type);
put_frame_register (frame, regnum, to);
}
@ -311,7 +312,7 @@ m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache,
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
convert_typed_floating (buf, fpreg_type, valbuf, type);
target_float_convert (buf, fpreg_type, valbuf, type);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
@ -351,7 +352,7 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache,
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
convert_typed_floating (valbuf, type, buf, fpreg_type);
target_float_convert (valbuf, type, buf, fpreg_type);
regcache_raw_write (regcache, M68K_FP0_REGNUM, buf);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)

View File

@ -28,6 +28,7 @@
#include "objfiles.h"
#include "infcall.h"
#include "dwarf2.h"
#include "target-float.h"
#include <algorithm>
@ -137,7 +138,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
convert_typed_floating (val, type, regval, regtype);
target_float_convert (val, type, regval, regtype);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + freg,
regval);
@ -367,8 +368,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, regnum);
convert_typed_floating (elval, eltype,
regval, regtype);
target_float_convert (elval, eltype,
regval, regtype);
regcache_cooked_write (regcache, regnum, regval);
}
freg++;
@ -710,7 +711,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
struct type *regtype = register_type (gdbarch,
tdep->ppc_fp0_regnum + 1);
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
convert_typed_floating (regval, regtype, readbuf, type);
target_float_convert (regval, regtype, readbuf, type);
}
if (writebuf)
{
@ -718,7 +719,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
the register's "double" type. */
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
convert_typed_floating (writebuf, type, regval, regtype);
target_float_convert (writebuf, type, regval, regtype);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}
return RETURN_VALUE_REGISTER_CONVENTION;
@ -852,15 +853,15 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
if (writebuf != NULL)
{
convert_typed_floating (writebuf + offset, eltype,
regval, regtype);
target_float_convert (writebuf + offset, eltype,
regval, regtype);
regcache_cooked_write (regcache, regnum, regval);
}
if (readbuf != NULL)
{
regcache_cooked_read (regcache, regnum, regval);
convert_typed_floating (regval, regtype,
readbuf + offset, eltype);
target_float_convert (regval, regtype,
readbuf + offset, eltype);
}
}
else
@ -1371,7 +1372,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
struct type *regtype = register_type (gdbarch, regnum);
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
convert_typed_floating (val, type, regval, regtype);
target_float_convert (val, type, regval, regtype);
regcache_cooked_write (argpos->regcache, regnum, regval);
}
@ -1818,13 +1819,13 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
if (writebuf != NULL)
{
convert_typed_floating (writebuf, valtype, regval, regtype);
target_float_convert (writebuf, valtype, regval, regtype);
regcache_cooked_write (regcache, regnum, regval);
}
if (readbuf != NULL)
{
regcache_cooked_read (regcache, regnum, regval);
convert_typed_floating (regval, regtype, readbuf, valtype);
target_float_convert (regval, regtype, readbuf, valtype);
}
return 1;
}

View File

@ -36,6 +36,7 @@
#include "xcoffread.h"
#include "solib.h"
#include "solib-aix.h"
#include "target-float.h"
#include "xml-utils.h"
/* If the kernel has to deliver a signal, it pushes a sigcontext
@ -258,8 +259,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_assert (len <= 8);
convert_typed_floating (value_contents (arg), type,
reg_val, reg_type);
target_float_convert (value_contents (arg), type, reg_val, reg_type);
regcache_cooked_write (regcache, fp_regnum, reg_val);
++f_argno;
}
@ -463,11 +463,11 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
if (readbuf)
{
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
convert_typed_floating (regval, regtype, readbuf, valtype);
target_float_convert (regval, regtype, readbuf, valtype);
}
if (writebuf)
{
convert_typed_floating (writebuf, valtype, regval, regtype);
target_float_convert (writebuf, valtype, regval, regtype);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}

View File

@ -22,6 +22,7 @@
#include "gdbtypes.h"
#include "infcall.h"
#include "ppc-tdep.h"
#include "target-float.h"
#include "value.h"
#include "xcoffread.h"
@ -110,8 +111,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
gdb_assert (len <= 8);
convert_typed_floating (value_contents (arg), type,
reg_val, reg_type);
target_float_convert (value_contents (arg), type, reg_val, reg_type);
regcache_cooked_write (regcache, fp_regnum, reg_val);
++f_argno;
}
@ -314,11 +314,11 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function,
if (readbuf)
{
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
convert_typed_floating (regval, regtype, readbuf, valtype);
target_float_convert (regval, regtype, readbuf, valtype);
}
if (writebuf)
{
convert_typed_floating (writebuf, valtype, regval, regtype);
target_float_convert (writebuf, valtype, regval, regtype);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}

View File

@ -29,7 +29,7 @@
#include "arch-utils.h"
#include "regcache.h"
#include "regset.h"
#include "doublest.h"
#include "target-float.h"
#include "value.h"
#include "parser-defs.h"
#include "osabi.h"
@ -2622,8 +2622,8 @@ rs6000_register_to_value (struct frame_info *frame,
from, optimizedp, unavailablep))
return 0;
convert_typed_floating (from, builtin_type (gdbarch)->builtin_double,
to, type);
target_float_convert (from, builtin_type (gdbarch)->builtin_double,
to, type);
*optimizedp = *unavailablep = 0;
return 1;
}
@ -2639,8 +2639,8 @@ rs6000_value_to_register (struct frame_info *frame,
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
convert_typed_floating (from, type,
to, builtin_type (gdbarch)->builtin_double);
target_float_convert (from, type,
to, builtin_type (gdbarch)->builtin_double);
put_frame_register (frame, regnum, to);
}

View File

@ -34,7 +34,7 @@
#include "inferior.h"
#include "arch-utils.h"
#include "regcache.h"
#include "doublest.h"
#include "target-float.h"
#include "osabi.h"
#include "reggroups.h"
#include "regset.h"
@ -1576,8 +1576,8 @@ sh_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
}
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
convert_typed_floating (from, sh_littlebyte_bigword_type (gdbarch),
to, type);
target_float_convert (from, sh_littlebyte_bigword_type (gdbarch),
to, type);
else
error
("sh_register_convert_to_virtual called with non DR register number");
@ -1595,8 +1595,8 @@ sh_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
}
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
convert_typed_floating (from, type,
to, sh_littlebyte_bigword_type (gdbarch));
target_float_convert (from, type,
to, sh_littlebyte_bigword_type (gdbarch));
else
error (_("sh_register_convert_to_raw called with non DR register number"));
}

View File

@ -37,6 +37,7 @@
#include "osabi.h"
#include "target-float.h"
#include "valprint.h"
#include "target-float.h"
#include "elf-bfd.h"
@ -1259,8 +1260,8 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte buf[8];
regcache_cooked_read (regcache, DR0_REGNUM, buf);
convert_typed_floating (buf, sh64_littlebyte_bigword_type (gdbarch),
valbuf, type);
target_float_convert (buf, sh64_littlebyte_bigword_type (gdbarch),
valbuf, type);
}
}
else
@ -1469,8 +1470,8 @@ sh64_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
&& regnum <= DR_LAST_REGNUM)
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
convert_typed_floating (from, sh64_littlebyte_bigword_type (gdbarch),
to, type);
target_float_convert (from, sh64_littlebyte_bigword_type (gdbarch),
to, type);
else
error (_("sh64_register_convert_to_virtual "
"called with non DR register number"));
@ -1478,7 +1479,7 @@ sh64_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
static void
sh64_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
int regnum, const void *from, void *to)
int regnum, const gdb_byte *from, gdb_byte *to)
{
if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_LITTLE)
{
@ -1491,8 +1492,8 @@ sh64_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
&& regnum <= DR_LAST_REGNUM)
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
convert_typed_floating (from, type,
to, sh64_littlebyte_bigword_type (gdbarch));
target_float_convert (from, type,
to, sh64_littlebyte_bigword_type (gdbarch));
else
error (_("sh64_register_convert_to_raw called "
"with non DR register number"));