]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/sh64-tdep.c
Complete tdep move to convert_typed_floating
[thirdparty/binutils-gdb.git] / gdb / sh64-tdep.c
index 5aeb235b077c29306ad9905f684cde7f2c2f3c8f..586490b14961fb47dff4cb938768a6a3085b4984 100644 (file)
@@ -58,8 +58,23 @@ enum sh_abi
 struct gdbarch_tdep
   {
     enum sh_abi sh_abi;
+    /* ISA-specific data types.  */
+    struct type *sh_littlebyte_bigword_type;
   };
 
+struct type *
+sh64_littlebyte_bigword_type (struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (tdep->sh_littlebyte_bigword_type == NULL)
+    tdep->sh_littlebyte_bigword_type
+      = arch_float_type (gdbarch, -1, "builtin_type_sh_littlebyte_bigword",
+                         floatformats_ieee_double_littlebyte_bigword);
+
+  return tdep->sh_littlebyte_bigword_type;
+}
+
 struct sh64_frame_cache
 {
   /* Base address.  */
@@ -1240,18 +1255,11 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache,
       else if (len == 8)
        {
          /* return value stored in DR0_REGNUM.  */
-         DOUBLEST val;
          gdb_byte buf[8];
-
          regcache_cooked_read (regcache, DR0_REGNUM, buf);
          
-         if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
-           floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
-                                    buf, &val);
-         else
-           floatformat_to_doublest (&floatformat_ieee_double_big,
-                                    buf, &val);
-         store_typed_floating (valbuf, type, val);
+         convert_typed_floating (buf, sh64_littlebyte_bigword_type (gdbarch),
+                                 valbuf, type);
        }
     }
   else
@@ -1460,12 +1468,8 @@ sh64_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
        && regnum <= DR_LAST_REGNUM)
       || (regnum >= DR0_C_REGNUM 
          && regnum <= DR_LAST_C_REGNUM))
-    {
-      DOUBLEST val;
-      floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, 
-                              from, &val);
-      store_typed_floating (to, type, val);
-    }
+    convert_typed_floating (from, sh64_littlebyte_bigword_type (gdbarch),
+                           to, type);
   else
     error (_("sh64_register_convert_to_virtual "
             "called with non DR register number"));
@@ -1486,11 +1490,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))
-    {
-      DOUBLEST val = extract_typed_floating (from, type);
-      floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, 
-                                &val, to);
-    }
+    convert_typed_floating (from, type,
+                           to, sh64_littlebyte_bigword_type (gdbarch));
   else
     error (_("sh64_register_convert_to_raw called "
             "with non DR register number"));