aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-27 19:05:21 +0200
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-27 19:05:21 +0200
commit96a5a1d3780a46b578842d9aeea3e98211dc20ec (patch)
tree1ea8a1e41e011af010bf0d36a50dca4117deb7c6 /gdb/arm-tdep.c
parent0db7851f9f490f0b60689df5a218ccce60896e3d (diff)
downloadbinutils-96a5a1d3780a46b578842d9aeea3e98211dc20ec.zip
binutils-96a5a1d3780a46b578842d9aeea3e98211dc20ec.tar.gz
binutils-96a5a1d3780a46b578842d9aeea3e98211dc20ec.tar.bz2
Complete tdep move to convert_typed_floating
Many tdep files need to perform conversions between two floating-point types, usually when accessing FP registers. Most targets now use the convert_typed_floating helper routine to do so. However, a small number still use the old method of converting via a DOUBLEST. Since we want to get rid of DOUBLEST, these targets need to be moved to the new method as well. The main obstacle is that for convert_typed_floating we need an actual *type*, not just a floatformat. In arm-tdep.c, this is very straightforward, since there is already a type using the ARM extended floatformat. For sh-tdep.c and sh64-tdep.c, no such type already exists, so I've added one to the gdbarch_tdep struct as done on other targets. gdb/ChangeLog 2017-09-27 Ulrich Weigand <uweigand@de.ibm.com> * arm-tdep.c: (convert_from_extended): Remove. (convert_to_extended): Likewise. (arm_extract_return_value): Use convert_typed_floating. (arm_store_return_value): Likewise. * sh-tdep.h (struct gdbarch_tdep): Add sh_littlebyte_bigword_type. * sh-tdep.c: Do not include "floatformat.h". (sh_littlebyte_bigword_type): New function. (sh_register_convert_to_virtual): Use convert_typed_floating. (sh_register_convert_to_raw): Likewise. * sh64-tdep.c: (struct gdbarch_tdep): Add sh_littlebyte_bigword_type. (sh64_littlebyte_bigword_type): New function. (sh64_extract_return_value): Use convert_typed_floating. (sh64_register_convert_to_virtual): Likewise. (sh64_register_convert_to_raw): Likewise.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 6b2fff4..2709321 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -226,11 +226,6 @@ static void show_disassembly_style_sfunc (struct ui_file *, int,
struct cmd_list_element *,
const char *);
-static void convert_from_extended (const struct floatformat *, const void *,
- void *, int);
-static void convert_to_extended (const struct floatformat *, void *,
- const void *, int);
-
static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum, gdb_byte *buf);
@@ -4211,39 +4206,6 @@ arm_register_sim_regno (struct gdbarch *gdbarch, int regnum)
internal_error (__FILE__, __LINE__, _("Bad REGNUM %d"), regnum);
}
-/* NOTE: cagney/2001-08-20: Both convert_from_extended() and
- convert_to_extended() use floatformat_arm_ext_littlebyte_bigword.
- It is thought that this is is the floating-point register format on
- little-endian systems. */
-
-static void
-convert_from_extended (const struct floatformat *fmt, const void *ptr,
- void *dbl, int endianess)
-{
- DOUBLEST d;
-
- if (endianess == BFD_ENDIAN_BIG)
- floatformat_to_doublest (&floatformat_arm_ext_big, ptr, &d);
- else
- floatformat_to_doublest (&floatformat_arm_ext_littlebyte_bigword,
- ptr, &d);
- floatformat_from_doublest (fmt, &d, dbl);
-}
-
-static void
-convert_to_extended (const struct floatformat *fmt, void *dbl, const void *ptr,
- int endianess)
-{
- DOUBLEST d;
-
- floatformat_to_doublest (fmt, ptr, &d);
- if (endianess == BFD_ENDIAN_BIG)
- floatformat_from_doublest (&floatformat_arm_ext_big, &d, dbl);
- else
- floatformat_from_doublest (&floatformat_arm_ext_littlebyte_bigword,
- &d, dbl);
-}
-
/* Given BUF, which is OLD_LEN bytes ending at ENDADDR, expand
the buffer to be NEW_LEN bytes ending at ENDADDR. Return
NULL if an error occurs. BUF is freed. */
@@ -7948,8 +7910,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_from_extended (floatformat_from_type (type), tmpbuf,
- valbuf, gdbarch_byte_order (gdbarch));
+ convert_typed_floating (tmpbuf, arm_ext_type (gdbarch),
+ valbuf, type);
}
break;
@@ -8153,8 +8115,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
{
case ARM_FLOAT_FPA:
- convert_to_extended (floatformat_from_type (type), buf, valbuf,
- gdbarch_byte_order (gdbarch));
+ convert_typed_floating (valbuf, type, buf, arm_ext_type (gdbarch));
regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
break;