]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* doublest.c (floatformat_from_length): Use the right element from
authorDaniel Jacobowitz <drow@false.org>
Mon, 29 Jan 2007 17:31:06 +0000 (17:31 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 29 Jan 2007 17:31:06 +0000 (17:31 +0000)
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher.  Handle bit == -1.  Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.

* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c,  iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.

30 files changed:
gdb/ChangeLog
gdb/alpha-tdep.c
gdb/arch-utils.c
gdb/arch-utils.h
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/doublest.c
gdb/doublest.h
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/hppa-tdep.c
gdb/hppabsd-tdep.c
gdb/i386-tdep.c
gdb/ia64-tdep.c
gdb/iq2000-tdep.c
gdb/m68k-tdep.c
gdb/m88k-tdep.c
gdb/mips-linux-tdep.c
gdb/mips-tdep.c
gdb/mt-tdep.c
gdb/ppc-sysv-tdep.c
gdb/ppcobsd-tdep.c
gdb/sparc-linux-tdep.c
gdb/sparc-tdep.c
gdb/sparcnbsd-tdep.c
gdb/spu-tdep.c
gdb/vax-tdep.c

index 9cb03be2ca97d6192802aefac84aa533de669e78..188fd8c12f45992ea240d2331daf07612f194a4a 100644 (file)
@@ -1,3 +1,45 @@
+2007-01-29  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * doublest.c (floatformat_from_length): Use the right element from
+       gdbarch floatformats.
+       (floatformat_from_type, extract_typed_floating)
+       (store_typed_floating): Likewise.
+       * doublest.h: Remove declarations for undefined floatformat arrays.
+       * gdbarch.sh (float_format, double_format, long_double_format): Change
+       to pairs.
+       (pformat): Update for pairs.
+       * gdbarch.c, gdbarch.h: Regenerated.
+       * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
+       (floatformats_ieee_double_littlebyte_bigword)
+       (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
+       (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
+       (floatformats_vax_d): New variables.
+       (builtin_type_ieee_single, builtin_type_ieee_double)
+       (builtin_type_arm_ext, builtin_type_ia64_spill)
+       (builtin_type_ia64_quad): Replace arrays with individual types.
+       (builtin_type_ieee_single_big, builtin_type_ieee_single_little)
+       (builtin_type_ieee_double_big, builtin_type_ieee_double_little)
+       (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
+       (builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
+       (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
+       (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
+       (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
+       unused and endian-specific types.
+       (recursive_dump_type): Update for floatformat pairs.
+       (build_flt): Move higher.  Handle bit == -1.  Take a floatformat pair.
+       (build_gdbtypes): Use build_flt.
+       (_initialize_gdbtypes): Update set of initialized types.
+       * gdbtypes.h: Update declarations to match gdbtypes.c.
+       (struct main_type): Store a pointer to two floatformats.
+       * arch-utils.c (default_float_format, default_double_format): Delete.
+       * arch-utils.h (default_float_format, default_double_format): Delete.
+
+       * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
+       ia64-tdep.c,  iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
+       mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
+       sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
+       vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
+
 2007-01-29  Joel Brobecker  <brobecker@adacore.com>
 
        * target.c (maintenance_print_target_stack): New function.
index 5b8f4216ae126d531e3248e58d2ebaffba73fa7d..b0bc35b3aa808145cb5f5233dc0753a4cffea3df 100644 (file)
@@ -103,7 +103,7 @@ alpha_register_type (struct gdbarch *gdbarch, int regno)
   /* Don't need to worry about little vs big endian until 
      some jerk tries to port to alpha-unicosmk.  */
   if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31)
-    return builtin_type_ieee_double_little;
+    return builtin_type_ieee_double;
 
   return builtin_type_int64;
 }
@@ -319,7 +319,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
          if (accumulate_size < sizeof (arg_reg_buffer)
              && TYPE_LENGTH (arg_type) == 4)
            {
-             arg_type = builtin_type_ieee_double_little;
+             arg_type = builtin_type_ieee_double;
              arg = value_cast (arg_type, arg);
            }
          /* Tru64 5.1 has a 128-bit long double, and passes this by
index df3f9f67c1e727e9f7ac23fad07954e261798d68..a5ca574ac097cba56a3a710f92f572d1c5eed5f0 100644 (file)
@@ -143,42 +143,6 @@ core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
   return (lhs > rhs);
 }
 
-
-/* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */
-
-const struct floatformat *
-default_float_format (struct gdbarch *gdbarch)
-{
-  int byte_order = gdbarch_byte_order (gdbarch);
-  switch (byte_order)
-    {
-    case BFD_ENDIAN_BIG:
-      return &floatformat_ieee_single_big;
-    case BFD_ENDIAN_LITTLE:
-      return &floatformat_ieee_single_little;
-    default:
-      internal_error (__FILE__, __LINE__,
-                     _("default_float_format: bad byte order"));
-    }
-}
-
-
-const struct floatformat *
-default_double_format (struct gdbarch *gdbarch)
-{
-  int byte_order = gdbarch_byte_order (gdbarch);
-  switch (byte_order)
-    {
-    case BFD_ENDIAN_BIG:
-      return &floatformat_ieee_double_big;
-    case BFD_ENDIAN_LITTLE:
-      return &floatformat_ieee_double_little;
-    default:
-      internal_error (__FILE__, __LINE__,
-                     _("default_double_format: bad byte order"));
-    }
-}
-
 /* Misc helper functions for targets. */
 
 CORE_ADDR
index f1cdb3ce121d6faf20d0711b45295d51ad46449a..cc00e58ecd7b1e149cadf5b741102f39906c3a91 100644 (file)
@@ -52,10 +52,6 @@ extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer
 extern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs);
 extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
 
-/* Floating point values. */
-extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
-extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
-
 /* Identity functions on a CORE_ADDR.  Just return the "addr".  */
 
 extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
index f254876c0c78a498352395a8c9e9ea90ee9aa78f..7b92cd7975ce1d16b977183b49e6d325c2c163b9 100644 (file)
@@ -1334,12 +1334,7 @@ static struct type *
 arm_register_type (struct gdbarch *gdbarch, int regnum)
 {
   if (regnum >= ARM_F0_REGNUM && regnum < ARM_F0_REGNUM + NUM_FREGS)
-    {
-      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-       return builtin_type_arm_ext_big;
-      else
-       return builtin_type_arm_ext_littlebyte_bigword;
-    }
+    return builtin_type_arm_ext;
   else if (regnum == ARM_SP_REGNUM)
     return builtin_type_void_data_ptr;
   else if (regnum == ARM_PC_REGNUM)
@@ -2833,34 +2828,18 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     set_gdbarch_get_longjmp_target (gdbarch, arm_get_longjmp_target);
 
   /* Floating point sizes and format.  */
-  switch (info.byte_order)
+  set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+  if (fp_model == ARM_FLOAT_SOFT_FPA || fp_model == ARM_FLOAT_FPA)
     {
-    case BFD_ENDIAN_BIG:
-      set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
-      set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
-      set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
-      break;
-
-    case BFD_ENDIAN_LITTLE:
-      set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
-      if (fp_model == ARM_FLOAT_SOFT_FPA || fp_model == ARM_FLOAT_FPA)
-       {
-         set_gdbarch_double_format
-           (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
-         set_gdbarch_long_double_format
-           (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
-       }
-      else
-       {
-         set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little);
-         set_gdbarch_long_double_format (gdbarch,
-                                         &floatformat_ieee_double_little);
-       }
-      break;
-
-    default:
-      internal_error (__FILE__, __LINE__,
-                     _("arm_gdbarch_init: bad byte order for float format"));
+      set_gdbarch_double_format
+       (gdbarch, floatformats_ieee_double_littlebyte_bigword);
+      set_gdbarch_long_double_format
+       (gdbarch, floatformats_ieee_double_littlebyte_bigword);
+    }
+  else
+    {
+      set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+      set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
     }
 
   return gdbarch;
index 1d50991dd14fd249ffa2b5d1107d062e27f86f8c..960e6dff072b0e03370f2df980eaf1d60e759357 100644 (file)
@@ -1267,9 +1267,9 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
 
-  set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
-  set_gdbarch_double_format (gdbarch, &floatformat_ieee_single_little);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_single_little);
+  set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+  set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single);
 
   set_gdbarch_read_pc (gdbarch, avr_read_pc);
   set_gdbarch_write_pc (gdbarch, avr_write_pc);
index 0f92fdf49006212fbb7147a803dc77cfd7ae2a72..3b640f5519d0331f29492f9013130ad6d76d6b89 100644 (file)
@@ -689,19 +689,19 @@ floatformat_from_length (int len)
 {
   const struct floatformat *format;
   if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
-    format = TARGET_FLOAT_FORMAT;
+    format = TARGET_FLOAT_FORMAT[TARGET_BYTE_ORDER];
   else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
-    format = TARGET_DOUBLE_FORMAT;
+    format = TARGET_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
   else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
-    format = TARGET_LONG_DOUBLE_FORMAT;
+    format = TARGET_LONG_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
   /* On i386 the 'long double' type takes 96 bits,
      while the real number of used bits is only 80,
      both in processor and in memory.  
      The code below accepts the real bit size.  */ 
   else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) 
           && (len * TARGET_CHAR_BIT ==
-               TARGET_LONG_DOUBLE_FORMAT->totalsize))
-    format = TARGET_LONG_DOUBLE_FORMAT;
+               TARGET_LONG_DOUBLE_FORMAT[0]->totalsize))
+    format = TARGET_LONG_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
   else
     format = NULL;
   if (format == NULL)
@@ -715,7 +715,7 @@ floatformat_from_type (const struct type *type)
 {
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
   if (TYPE_FLOATFORMAT (type) != NULL)
-    return TYPE_FLOATFORMAT (type);
+    return TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER];
   else
     return floatformat_from_length (TYPE_LENGTH (type));
 }
@@ -776,7 +776,8 @@ extract_typed_floating (const void *addr, const struct type *type)
        specific code? stabs?) so handle that here as a special case.  */
     return extract_floating_by_length (addr, TYPE_LENGTH (type));
 
-  floatformat_to_doublest (TYPE_FLOATFORMAT (type), addr, &retval);
+  floatformat_to_doublest (TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER],
+                          addr, &retval);
   return retval;
 }
 
@@ -813,7 +814,8 @@ store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
        specific code? stabs?) so handle that here as a special case.  */
     store_floating_by_length (addr, TYPE_LENGTH (type), val);
   else
-    floatformat_from_doublest (TYPE_FLOATFORMAT (type), &val, addr);
+    floatformat_from_doublest (TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER],
+                              &val, addr);
 }
 
 /* Convert a floating-point number of type FROM_TYPE from a
index f2890dd23d98707daf7d9b93e03bea5435c2045d..058b4a34e68a307a3547c52482380f29da6873bb 100644 (file)
@@ -100,11 +100,4 @@ extern void convert_typed_floating (const void *from,
                                    const struct type *from_type,
                                     void *to, const struct type *to_type);
 
-/* Table of convenient float-formats.  */
-extern const struct floatformat *floatformat_ieee_single[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_ieee_double[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_ieee_quad[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_arm_ext[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_ia64_spill[BFD_ENDIAN_UNKNOWN];
-
 #endif
index decc8e04f52d4ba890efe28b10b518a4427813df..8b6d60b4a01d734196e880529756d1c24df03d3a 100644 (file)
@@ -69,12 +69,13 @@ show_gdbarch_debug (struct ui_file *file, int from_tty,
 }
 
 static const char *
-pformat (const struct floatformat *format)
+pformat (const struct floatformat **format)
 {
   if (format == NULL)
     return "(null)";
   else
-    return  format->name;
+    /* Just print out one of them - this is only for diagnostics.  */
+    return format[0]->name;
 }
 
 
@@ -136,11 +137,11 @@ struct gdbarch
   int long_bit;
   int long_long_bit;
   int float_bit;
-  const struct floatformat * float_format;
+  const struct floatformat ** float_format;
   int double_bit;
-  const struct floatformat * double_format;
+  const struct floatformat ** double_format;
   int long_double_bit;
-  const struct floatformat * long_double_format;
+  const struct floatformat ** long_double_format;
   int ptr_bit;
   int addr_bit;
   int bfd_vma_bit;
@@ -516,13 +517,13 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
   /* Skip verify of long_long_bit, invalid_p == 0 */
   /* Skip verify of float_bit, invalid_p == 0 */
   if (current_gdbarch->float_format == 0)
-    current_gdbarch->float_format = default_float_format (current_gdbarch);
+    current_gdbarch->float_format = floatformats_ieee_single;
   /* Skip verify of double_bit, invalid_p == 0 */
   if (current_gdbarch->double_format == 0)
-    current_gdbarch->double_format = default_double_format (current_gdbarch);
+    current_gdbarch->double_format = floatformats_ieee_double;
   /* Skip verify of long_double_bit, invalid_p == 0 */
   if (current_gdbarch->long_double_format == 0)
-    current_gdbarch->long_double_format = default_double_format (current_gdbarch);
+    current_gdbarch->long_double_format = floatformats_ieee_double;
   /* Skip verify of ptr_bit, invalid_p == 0 */
   if (current_gdbarch->addr_bit == 0)
     current_gdbarch->addr_bit = TARGET_PTR_BIT;
@@ -1740,7 +1741,7 @@ set_gdbarch_float_bit (struct gdbarch *gdbarch,
   gdbarch->float_bit = float_bit;
 }
 
-const struct floatformat *
+const struct floatformat **
 gdbarch_float_format (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -1751,7 +1752,7 @@ gdbarch_float_format (struct gdbarch *gdbarch)
 
 void
 set_gdbarch_float_format (struct gdbarch *gdbarch,
-                          const struct floatformat * float_format)
+                          const struct floatformat ** float_format)
 {
   gdbarch->float_format = float_format;
 }
@@ -1773,7 +1774,7 @@ set_gdbarch_double_bit (struct gdbarch *gdbarch,
   gdbarch->double_bit = double_bit;
 }
 
-const struct floatformat *
+const struct floatformat **
 gdbarch_double_format (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -1784,7 +1785,7 @@ gdbarch_double_format (struct gdbarch *gdbarch)
 
 void
 set_gdbarch_double_format (struct gdbarch *gdbarch,
-                           const struct floatformat * double_format)
+                           const struct floatformat ** double_format)
 {
   gdbarch->double_format = double_format;
 }
@@ -1806,7 +1807,7 @@ set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
   gdbarch->long_double_bit = long_double_bit;
 }
 
-const struct floatformat *
+const struct floatformat **
 gdbarch_long_double_format (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -1817,7 +1818,7 @@ gdbarch_long_double_format (struct gdbarch *gdbarch)
 
 void
 set_gdbarch_long_double_format (struct gdbarch *gdbarch,
-                                const struct floatformat * long_double_format)
+                                const struct floatformat ** long_double_format)
 {
   gdbarch->long_double_format = long_double_format;
 }
index 4fac0eec2173e53e387fe7f5d7a5f1c72fcde540..8cfd33b18d7bf27931562d279268ccf3117737ab 100644 (file)
@@ -141,7 +141,9 @@ extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bi
 
 /* The ABI default bit-size and format for "float", "double", and "long
    double".  These bit/format pairs should eventually be combined into
-   a single object.  For the moment, just initialize them as a pair. */
+   a single object.  For the moment, just initialize them as a pair.
+   Each format describes both the big and little endian layouts (if
+   useful). */
 
 extern int gdbarch_float_bit (struct gdbarch *gdbarch);
 extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
@@ -152,8 +154,8 @@ extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
 #define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch))
 #endif
 
-extern const struct floatformat * gdbarch_float_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat * float_format);
+extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format);
 #if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_FORMAT)
 #error "Non multi-arch definition of TARGET_FLOAT_FORMAT"
 #endif
@@ -170,8 +172,8 @@ extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
 #define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch))
 #endif
 
-extern const struct floatformat * gdbarch_double_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat * double_format);
+extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format);
 #if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_FORMAT)
 #error "Non multi-arch definition of TARGET_DOUBLE_FORMAT"
 #endif
@@ -188,8 +190,8 @@ extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_doubl
 #define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch))
 #endif
 
-extern const struct floatformat * gdbarch_long_double_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat * long_double_format);
+extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format);
 #if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_FORMAT)
 #error "Non multi-arch definition of TARGET_LONG_DOUBLE_FORMAT"
 #endif
index db88df0f9a47eed0d9e29f5609908377fb303f1f..d0547991bc4fb7ca527004d18813f0e780460c4b 100755 (executable)
@@ -391,13 +391,15 @@ v:TARGET_LONG_LONG_BIT:int:long_long_bit:::8 * sizeof (LONGEST):2*TARGET_LONG_BI
 # The ABI default bit-size and format for "float", "double", and "long
 # double".  These bit/format pairs should eventually be combined into
 # a single object.  For the moment, just initialize them as a pair.
+# Each format describes both the big and little endian layouts (if
+# useful).
 
 v:TARGET_FLOAT_BIT:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0
-v:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format:::::default_float_format (current_gdbarch)::pformat (current_gdbarch->float_format)
+v:TARGET_FLOAT_FORMAT:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (current_gdbarch->float_format)
 v:TARGET_DOUBLE_BIT:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0
-v:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format:::::default_double_format (current_gdbarch)::pformat (current_gdbarch->double_format)
+v:TARGET_DOUBLE_FORMAT:const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (current_gdbarch->double_format)
 v:TARGET_LONG_DOUBLE_BIT:int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
-v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format:::::default_double_format (current_gdbarch)::pformat (current_gdbarch->long_double_format)
+v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (current_gdbarch->long_double_format)
 
 # For most targets, a pointer on the target and its representation as an
 # address in GDB have the same size and "look the same".  For such a
@@ -1204,12 +1206,13 @@ show_gdbarch_debug (struct ui_file *file, int from_tty,
 }
 
 static const char *
-pformat (const struct floatformat *format)
+pformat (const struct floatformat **format)
 {
   if (format == NULL)
     return "(null)";
   else
-    return  format->name;
+    /* Just print out one of them - this is only for diagnostics.  */
+    return format[0]->name;
 }
 
 EOF
index a188232128ca40a2ee2c34863699d419a9acb3e7..5d56de06afe2e1f66348b686da518b5ebd0f74a2 100644 (file)
@@ -98,27 +98,57 @@ struct type *builtin_type_v4hi;
 struct type *builtin_type_v2si;
 struct type *builtin_type_vec64;
 struct type *builtin_type_vec128;
-struct type *builtin_type_ieee_single[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ieee_single_big;
-struct type *builtin_type_ieee_single_little;
-struct type *builtin_type_ieee_double[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ieee_double_big;
-struct type *builtin_type_ieee_double_little;
-struct type *builtin_type_ieee_double_littlebyte_bigword;
+
+/* Floatformat pairs.  */
+const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_ieee_single_big,
+  &floatformat_ieee_single_little
+};
+const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_ieee_double_big,
+  &floatformat_ieee_double_little
+};
+const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_ieee_double_big,
+  &floatformat_ieee_double_littlebyte_bigword
+};
+const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_i387_ext,
+  &floatformat_i387_ext
+};
+const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_m68881_ext,
+  &floatformat_m68881_ext
+};
+const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_arm_ext_big,
+  &floatformat_arm_ext_littlebyte_bigword
+};
+const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_ia64_spill_big,
+  &floatformat_ia64_spill_little
+};
+const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_ia64_quad_big,
+  &floatformat_ia64_quad_little
+};
+const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_vax_f,
+  &floatformat_vax_f
+};
+const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_vax_d,
+  &floatformat_vax_d
+};
+
+struct type *builtin_type_ieee_single;
+struct type *builtin_type_ieee_double;
 struct type *builtin_type_i387_ext;
 struct type *builtin_type_m68881_ext;
-struct type *builtin_type_i960_ext;
-struct type *builtin_type_m88110_ext;
-struct type *builtin_type_m88110_harris_ext;
-struct type *builtin_type_arm_ext[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_arm_ext_big;
-struct type *builtin_type_arm_ext_littlebyte_bigword;
-struct type *builtin_type_ia64_spill[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ia64_spill_big;
-struct type *builtin_type_ia64_spill_little;
-struct type *builtin_type_ia64_quad[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ia64_quad_big;
-struct type *builtin_type_ia64_quad_little;
+struct type *builtin_type_arm_ext;
+struct type *builtin_type_ia64_spill;
+struct type *builtin_type_ia64_quad;
+
 struct type *builtin_type_void_data_ptr;
 struct type *builtin_type_void_func_ptr;
 struct type *builtin_type_CORE_ADDR;
@@ -3148,11 +3178,26 @@ recursive_dump_type (struct type *type, int spaces)
 
     case TYPE_CODE_FLT:
       printfi_filtered (spaces, "floatformat ");
-      if (TYPE_FLOATFORMAT (type) == NULL
-         || TYPE_FLOATFORMAT (type)->name == NULL)
+      if (TYPE_FLOATFORMAT (type) == NULL)
        puts_filtered ("(null)");
       else
-       puts_filtered (TYPE_FLOATFORMAT (type)->name);
+       {
+         puts_filtered ("{ ");
+         if (TYPE_FLOATFORMAT (type)[0] == NULL
+             || TYPE_FLOATFORMAT (type)[0]->name == NULL)
+           puts_filtered ("(null)");
+         else
+           puts_filtered (TYPE_FLOATFORMAT (type)[0]->name);
+
+         puts_filtered (", ");
+         if (TYPE_FLOATFORMAT (type)[1] == NULL
+             || TYPE_FLOATFORMAT (type)[1]->name == NULL)
+           puts_filtered ("(null)");
+         else
+           puts_filtered (TYPE_FLOATFORMAT (type)[1]->name);
+
+         puts_filtered (" }");
+       }
       puts_filtered ("\n");
       break;
 
@@ -3315,6 +3360,24 @@ copy_type_recursive (struct objfile *objfile, struct type *type,
   return new_type;
 }
 
+static struct type *
+build_flt (int bit, char *name, const struct floatformat **floatformats)
+{
+  struct type *t;
+
+  if (bit == -1)
+    {
+      gdb_assert (floatformats != NULL);
+      gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
+      bit = floatformats[0]->totalsize;
+    }
+  gdb_assert (bit >= 0);
+
+  t = init_type (TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, 0, name, NULL);
+  TYPE_FLOATFORMAT (t) = floatformats;
+  return t;
+}
+
 static void
 build_gdbtypes (void)
 {
@@ -3371,35 +3434,14 @@ build_gdbtypes (void)
     init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
               TYPE_FLAG_UNSIGNED,
               "unsigned long long", (struct objfile *) NULL);
-  builtin_type_float =
-    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-              0,
-              "float", (struct objfile *) NULL);
-/* vinschen@redhat.com 2002-02-08:
-   The below lines are disabled since they are doing the wrong
-   thing for non-multiarch targets.  They are setting the correct
-   type of floats for the target but while on multiarch targets
-   this is done everytime the architecture changes, it's done on
-   non-multiarch targets only on startup, leaving the wrong values
-   in even if the architecture changes (eg. from big-endian to
-   little-endian).  */
-#if 0
-  TYPE_FLOATFORMAT (builtin_type_float) = TARGET_FLOAT_FORMAT;
-#endif
-  builtin_type_double =
-    init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-              0,
-              "double", (struct objfile *) NULL);
-#if 0
-  TYPE_FLOATFORMAT (builtin_type_double) = TARGET_DOUBLE_FORMAT;
-#endif
-  builtin_type_long_double =
-    init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
-              0,
-              "long double", (struct objfile *) NULL);
-#if 0
-  TYPE_FLOATFORMAT (builtin_type_long_double) = TARGET_LONG_DOUBLE_FORMAT;
-#endif
+
+  builtin_type_float = build_flt (TARGET_FLOAT_BIT, "float",
+                                 TARGET_FLOAT_FORMAT);
+  builtin_type_double = build_flt (TARGET_DOUBLE_BIT, "double",
+                                  TARGET_DOUBLE_FORMAT);
+  builtin_type_long_double = build_flt (TARGET_LONG_DOUBLE_BIT, "long double",
+                                       TARGET_LONG_DOUBLE_FORMAT);
+
   builtin_type_complex =
     init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
               0,
@@ -3512,21 +3554,6 @@ builtin_type (struct gdbarch *gdbarch)
 }
 
 
-static struct type *
-build_flt (int bit, char *name, const struct floatformat *floatformat)
-{
-  struct type *t;
-  if (bit <= 0 || floatformat == NULL)
-    {
-      gdb_assert (builtin_type_error != NULL);
-      return builtin_type_error;
-    }
-  t = init_type (TYPE_CODE_FLT, bit / TARGET_CHAR_BIT,
-                0, name, (struct objfile *) NULL);
-  TYPE_FLOATFORMAT (t) = floatformat;
-  return t;
-}
-
 static struct type *
 build_complex (int bit, char *name, struct type *target_type)
 {
@@ -3777,110 +3804,20 @@ _initialize_gdbtypes (void)
   /* Note: These types do not need to be swapped - they are target
      neutral.  FIXME: Are you sure?  See the comment above the calls
      to DEPRECATED_REGISTER_GDBARCH_SWAP above.  */
-  builtin_type_ieee_single_big =
-    init_type (TYPE_CODE_FLT, floatformat_ieee_single_big.totalsize / 8,
-              0, "builtin_type_ieee_single_big", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ieee_single_big) = &floatformat_ieee_single_big;
-  builtin_type_ieee_single_little =
-    init_type (TYPE_CODE_FLT, floatformat_ieee_single_little.totalsize / 8,
-              0, "builtin_type_ieee_single_little", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ieee_single_little) = &floatformat_ieee_single_little;
-  builtin_type_ieee_single[BFD_ENDIAN_BIG]
-    = build_flt (floatformat_ieee_single_big.totalsize,
-                "builtin_type_ieee_single_big",
-                &floatformat_ieee_single_big);
-  builtin_type_ieee_single[BFD_ENDIAN_LITTLE]
-    = build_flt (floatformat_ieee_single_little.totalsize,
-                "builtin_type_ieee_single_little",
-                &floatformat_ieee_single_little);
-  builtin_type_ieee_double_big =
-    init_type (TYPE_CODE_FLT, floatformat_ieee_double_big.totalsize / 8,
-              0, "builtin_type_ieee_double_big", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ieee_double_big) = &floatformat_ieee_double_big;
-  builtin_type_ieee_double_little =
-    init_type (TYPE_CODE_FLT, floatformat_ieee_double_little.totalsize / 8,
-              0, "builtin_type_ieee_double_little", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ieee_double_little) = &floatformat_ieee_double_little;
-  builtin_type_ieee_double[BFD_ENDIAN_BIG]
-    = build_flt (floatformat_ieee_double_big.totalsize,
-                "builtin_type_ieee_double_big",
-                &floatformat_ieee_double_big);
-  builtin_type_ieee_double[BFD_ENDIAN_LITTLE]
-    = build_flt (floatformat_ieee_double_little.totalsize,
-                "builtin_type_ieee_double_little",
-                &floatformat_ieee_double_little);
-  builtin_type_ieee_double_littlebyte_bigword =
-    init_type (TYPE_CODE_FLT, floatformat_ieee_double_littlebyte_bigword.totalsize / 8,
-              0, "builtin_type_ieee_double_littlebyte_bigword", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ieee_double_littlebyte_bigword) = &floatformat_ieee_double_littlebyte_bigword;
-  builtin_type_i387_ext =
-    init_type (TYPE_CODE_FLT, floatformat_i387_ext.totalsize / 8,
-              0, "builtin_type_i387_ext", NULL);
-  TYPE_FLOATFORMAT (builtin_type_i387_ext) = &floatformat_i387_ext;
-  builtin_type_m68881_ext =
-    init_type (TYPE_CODE_FLT, floatformat_m68881_ext.totalsize / 8,
-              0, "builtin_type_m68881_ext", NULL);
-  TYPE_FLOATFORMAT (builtin_type_m68881_ext) = &floatformat_m68881_ext;
-  builtin_type_i960_ext =
-    init_type (TYPE_CODE_FLT, floatformat_i960_ext.totalsize / 8,
-              0, "builtin_type_i960_ext", NULL);
-  TYPE_FLOATFORMAT (builtin_type_i960_ext) = &floatformat_i960_ext;
-  builtin_type_m88110_ext =
-    init_type (TYPE_CODE_FLT, floatformat_m88110_ext.totalsize / 8,
-              0, "builtin_type_m88110_ext", NULL);
-  TYPE_FLOATFORMAT (builtin_type_m88110_ext) = &floatformat_m88110_ext;
-  builtin_type_m88110_harris_ext =
-    init_type (TYPE_CODE_FLT, floatformat_m88110_harris_ext.totalsize / 8,
-              0, "builtin_type_m88110_harris_ext", NULL);
-  TYPE_FLOATFORMAT (builtin_type_m88110_harris_ext) = &floatformat_m88110_harris_ext;
-  builtin_type_arm_ext_big =
-    init_type (TYPE_CODE_FLT, floatformat_arm_ext_big.totalsize / 8,
-              0, "builtin_type_arm_ext_big", NULL);
-  TYPE_FLOATFORMAT (builtin_type_arm_ext_big) = &floatformat_arm_ext_big;
-  builtin_type_arm_ext_littlebyte_bigword =
-    init_type (TYPE_CODE_FLT, floatformat_arm_ext_littlebyte_bigword.totalsize / 8,
-              0, "builtin_type_arm_ext_littlebyte_bigword", NULL);
-  TYPE_FLOATFORMAT (builtin_type_arm_ext_littlebyte_bigword) = &floatformat_arm_ext_littlebyte_bigword;
-  builtin_type_arm_ext[BFD_ENDIAN_BIG]
-    = build_flt (floatformat_arm_ext_big.totalsize,
-                "builtin_type_arm_ext_big",
-                &floatformat_arm_ext_big);
-  builtin_type_arm_ext[BFD_ENDIAN_LITTLE]
-    = build_flt (floatformat_arm_ext_littlebyte_bigword.totalsize,
-                "builtin_type_arm_ext_littlebyte_bigword",
-                &floatformat_arm_ext_littlebyte_bigword);
-  builtin_type_ia64_spill_big =
-    init_type (TYPE_CODE_FLT, floatformat_ia64_spill_big.totalsize / 8,
-              0, "builtin_type_ia64_spill_big", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ia64_spill_big) = &floatformat_ia64_spill_big;
-  builtin_type_ia64_spill_little =
-    init_type (TYPE_CODE_FLT, floatformat_ia64_spill_little.totalsize / 8,
-              0, "builtin_type_ia64_spill_little", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ia64_spill_little) = &floatformat_ia64_spill_little;
-  builtin_type_ia64_spill[BFD_ENDIAN_BIG]
-    = build_flt (floatformat_ia64_spill_big.totalsize,
-                "builtin_type_ia64_spill_big",
-                &floatformat_ia64_spill_big);
-  builtin_type_ia64_spill[BFD_ENDIAN_LITTLE]
-    = build_flt (floatformat_ia64_spill_little.totalsize,
-                "builtin_type_ia64_spill_little",
-                &floatformat_ia64_spill_little);
-  builtin_type_ia64_quad_big =
-    init_type (TYPE_CODE_FLT, floatformat_ia64_quad_big.totalsize / 8,
-              0, "builtin_type_ia64_quad_big", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ia64_quad_big) = &floatformat_ia64_quad_big;
-  builtin_type_ia64_quad_little =
-    init_type (TYPE_CODE_FLT, floatformat_ia64_quad_little.totalsize / 8,
-              0, "builtin_type_ia64_quad_little", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ia64_quad_little) = &floatformat_ia64_quad_little;
-  builtin_type_ia64_quad[BFD_ENDIAN_BIG]
-    = build_flt (floatformat_ia64_quad_big.totalsize,
-                "builtin_type_ia64_quad_big",
-                &floatformat_ia64_quad_big);
-  builtin_type_ia64_quad[BFD_ENDIAN_LITTLE]
-    = build_flt (floatformat_ia64_quad_little.totalsize,
-                "builtin_type_ia64_quad_little",
-                &floatformat_ia64_quad_little);
+  builtin_type_ieee_single
+    = build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single);
+  builtin_type_ieee_double
+    = build_flt (-1, "builtin_type_ieee_double", floatformats_ieee_double);
+  builtin_type_i387_ext
+    = build_flt (-1, "builtin_type_i387_ext", floatformats_i387_ext);
+  builtin_type_m68881_ext
+    = build_flt (-1, "builtin_type_m68881_ext", floatformats_m68881_ext);
+  builtin_type_arm_ext
+    = build_flt (-1, "builtin_type_arm_ext", floatformats_arm_ext);
+  builtin_type_ia64_spill
+    = build_flt (-1, "builtin_type_ia64_spill", floatformats_ia64_spill);
+  builtin_type_ia64_quad
+    = build_flt (-1, "builtin_type_ia64_quad", floatformats_ia64_quad);
 
   add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\
 Set debugging of C++ overloading."), _("\
index ce30b1971e6cc9e01533f45545dd5d13a9c8b2ef..8cbd26ce49ea59f1d55b9fd48d6ec3cdc4480741 100644 (file)
@@ -497,11 +497,12 @@ struct main_type
 
     struct cplus_struct_type *cplus_stuff;
 
-    /* FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to the
-       floatformat object that describes the floating-point value
-       that resides within the type.  */
+    /* FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to two
+       floatformat objects that describe the floating-point value
+       that resides within the type.  The first is for big endian
+       targets and the second is for little endian targets.  */
 
-    const struct floatformat *floatformat;
+    const struct floatformat **floatformat;
   } type_specific;
 };
 
@@ -1105,27 +1106,24 @@ extern struct type *builtin_type_v16_int8;
 extern struct type *builtin_type_vec128;
 
 /* Explicit floating-point formats.  See "floatformat.h".  */
-extern struct type *builtin_type_ieee_single[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ieee_single_big;
-extern struct type *builtin_type_ieee_single_little;
-extern struct type *builtin_type_ieee_double[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ieee_double_big;
-extern struct type *builtin_type_ieee_double_little;
-extern struct type *builtin_type_ieee_double_littlebyte_bigword;
+extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
+
+extern struct type *builtin_type_ieee_single;
+extern struct type *builtin_type_ieee_double;
 extern struct type *builtin_type_i387_ext;
 extern struct type *builtin_type_m68881_ext;
-extern struct type *builtin_type_i960_ext;
-extern struct type *builtin_type_m88110_ext;
-extern struct type *builtin_type_m88110_harris_ext;
-extern struct type *builtin_type_arm_ext[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_arm_ext_big;
-extern struct type *builtin_type_arm_ext_littlebyte_bigword;
-extern struct type *builtin_type_ia64_spill[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ia64_spill_big;
-extern struct type *builtin_type_ia64_spill_little;
-extern struct type *builtin_type_ia64_quad[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ia64_quad_big;
-extern struct type *builtin_type_ia64_quad_little;
+extern struct type *builtin_type_arm_ext;
+extern struct type *builtin_type_ia64_spill;
+extern struct type *builtin_type_ia64_quad;
 
 /* We use this for the '/c' print format, because builtin_type_char is
    just a one-byte integral type, which languages less laid back than
index 6b149852cc538dd79df002d0a504ed5d2c8d98ed..059704080f9f5e329a4ebeed6bcb60a7f59d0583 100644 (file)
@@ -2635,7 +2635,7 @@ hppa32_register_type (struct gdbarch *gdbarch, int regnum)
    if (regnum < HPPA_FP4_REGNUM)
      return builtin_type_uint32;
    else
-     return builtin_type_ieee_single_big;
+     return builtin_type_ieee_single;
 }
 
 static struct type *
@@ -2644,7 +2644,7 @@ hppa64_register_type (struct gdbarch *gdbarch, int regnum)
    if (regnum < HPPA64_FP4_REGNUM)
      return builtin_type_uint64;
    else
-     return builtin_type_ieee_double_big;
+     return builtin_type_ieee_double;
 }
 
 /* Return non-zero if REGNUM is not a register available to the user
@@ -3085,7 +3085,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      and LP64, but might show differences some day.  */
   set_gdbarch_long_long_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
 
   /* The following gdbarch vector elements do not depend on the address
      size, or in any other gdbarch element previously set.  */
index 86de8eebf8a1a6ee2a714a25bef14b60dfb2a32a..7aaa3a32f029bb914b7a81b90376c686c1480967 100644 (file)
@@ -171,7 +171,7 @@ hppabsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   /* OpenBSD and NetBSD have a 64-bit 'long double'.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   /* Core file support.  */
   set_gdbarch_regset_from_core_section
index d4c2cc3506f44162f09e7877afa89bf7675dad0a..1f0cb8f3809d0e9123e7df085adeb8b08d5759ee 100644 (file)
@@ -2333,7 +2333,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      the i387 extended floating-point format.  In fact, of all targets
      in the GCC 2.95 tree, only OSF/1 does it different, and insists
      on having a `long double' that's not `long' at all.  */
-  set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
+  set_gdbarch_long_double_format (gdbarch, floatformats_i387_ext);
 
   /* Although the i387 extended floating-point has only 80 significant
      bits, a `long double' actually takes up 96, probably to enforce
index dfcc024acd88949241dbd7094ca8f634df344347..1aed60d99820598548a48a0a226cd63c1e13d3b8 100644 (file)
@@ -336,6 +336,12 @@ const struct floatformat floatformat_ia64_ext =
   floatformat_intbit_yes, "floatformat_ia64_ext", floatformat_valid
 };
 
+const struct floatformat *floatformats_ia64_ext[2] =
+{
+  &floatformat_ia64_ext,
+  &floatformat_ia64_ext
+};
+
 
 /* Extract ``len'' bits from an instruction bundle starting at
    bit ``from''.  */
@@ -3574,7 +3580,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   builtin_type_ia64_ext =
     init_type (TYPE_CODE_FLT, 128 / 8,
                0, "builtin_type_ia64_ext", NULL);
-  TYPE_FLOATFORMAT (builtin_type_ia64_ext) = &floatformat_ia64_ext;
+  TYPE_FLOATFORMAT (builtin_type_ia64_ext) = floatformats_ia64_ext;
 
   /* According to the ia64 specs, instructions that store long double
      floats in memory use a long-double format different than that
@@ -3584,7 +3590,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      format for storing long doubles (e.g. HPUX).  In the latter case,
      the setting of the format may be moved/overridden in an
      OS-specific tdep file.  */
-  set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
+  set_gdbarch_long_double_format (gdbarch, floatformats_i387_ext);
 
   set_gdbarch_short_bit (gdbarch, 16);
   set_gdbarch_int_bit (gdbarch, 32);
index 1c494daebe61679ebd2fe96527d836a89562d546..dd3ff80e2d63f5a719843141b0cb775cf2dfe994 100644 (file)
@@ -837,9 +837,9 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_float_bit            (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_double_bit           (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_long_double_bit      (gdbarch, 8 * TARGET_CHAR_BIT);
-  set_gdbarch_float_format         (gdbarch, & floatformat_ieee_single_big);
-  set_gdbarch_double_format        (gdbarch, & floatformat_ieee_double_big);
-  set_gdbarch_long_double_format   (gdbarch, & floatformat_ieee_double_big);
+  set_gdbarch_float_format         (gdbarch, floatformats_ieee_single);
+  set_gdbarch_double_format        (gdbarch, floatformats_ieee_double);
+  set_gdbarch_long_double_format   (gdbarch, floatformats_ieee_double);
   set_gdbarch_return_value        (gdbarch, iq2000_return_value);
   set_gdbarch_breakpoint_from_pc   (gdbarch, iq2000_breakpoint_from_pc);
   set_gdbarch_frame_args_skip      (gdbarch, 0);
index ac2ec77282944e468ce574cb78c8aab8554c591f..55bb5b21fa86a221e702544bb92be365593bfdcd 100644 (file)
@@ -1157,7 +1157,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext);
+  set_gdbarch_long_double_format (gdbarch, floatformats_m68881_ext);
   set_gdbarch_long_double_bit (gdbarch, 96);
 
   set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
index 1810f770953803e102daccf85d2f9ad43f6ae006..77d1f2331e2665b18cde880a98caa376f0fdfe44 100644 (file)
@@ -845,7 +845,7 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* There is no real `long double'.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   set_gdbarch_num_regs (gdbarch, M88K_NUM_REGS);
   set_gdbarch_register_name (gdbarch, m88k_register_name);
index 5ce51b25096270c2faba92ef9ae255e11cdf0637..3da7522b79ce78e16152d5702c6b5cb34e049838 100644 (file)
@@ -1154,10 +1154,7 @@ mips_linux_init_abi (struct gdbarch_info info,
           the same 128-bit IEEE floating point format that IA-64 uses,
           except that the quiet/signalling NaN bit is reversed (GDB
           does not distinguish between quiet and signalling NaNs).  */
-       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
-         set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
-       else
-         set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_little);
+       set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
        tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
        break;
       case MIPS_ABI_N64:
@@ -1171,10 +1168,7 @@ mips_linux_init_abi (struct gdbarch_info info,
           the same 128-bit IEEE floating point format that IA-64 uses,
           except that the quiet/signalling NaN bit is reversed (GDB
           does not distinguish between quiet and signalling NaNs).  */
-       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
-         set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
-       else
-         set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_little);
+       set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
        tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
        break;
       default:
index 99dd2f5794559dc43cddb2275c048158313c6607..f25c8a15bfb9ca9444f457029069bdba3a1c1747 100644 (file)
@@ -179,10 +179,16 @@ static const struct floatformat floatformat_n32n64_long_double_big =
 {
   floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
   floatformat_intbit_no,
-  "floatformat_ieee_double_big",
+  "floatformat_n32n64_long_double_big",
   n32n64_floatformat_always_valid
 };
 
+static const struct floatformat *floatformats_n32n64_long[BFD_ENDIAN_UNKNOWN] =
+{
+  &floatformat_n32n64_long_double_big,
+  &floatformat_n32n64_long_double_big
+};
+
 const struct mips_regnum *
 mips_regnum (struct gdbarch *gdbarch)
 {
@@ -701,22 +707,10 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
     {
       /* The floating-point registers raw, or cooked, always match
          mips_isa_regsize(), and also map 1:1, byte for byte.  */
-      switch (gdbarch_byte_order (gdbarch))
-       {
-       case BFD_ENDIAN_BIG:
-         if (mips_isa_regsize (gdbarch) == 4)
-           return builtin_type_ieee_single_big;
-         else
-           return builtin_type_ieee_double_big;
-       case BFD_ENDIAN_LITTLE:
-         if (mips_isa_regsize (gdbarch) == 4)
-           return builtin_type_ieee_single_little;
-         else
-           return builtin_type_ieee_double_little;
-       case BFD_ENDIAN_UNKNOWN:
-       default:
-         internal_error (__FILE__, __LINE__, _("bad switch"));
-       }
+      if (mips_isa_regsize (gdbarch) == 4)
+       return builtin_type_ieee_single;
+      else
+       return builtin_type_ieee_double;
     }
   else if (regnum < NUM_REGS)
     {
@@ -3867,19 +3861,13 @@ mips_o64_return_value (struct gdbarch *gdbarch,
 static struct type *
 mips_float_register_type (void)
 {
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-    return builtin_type_ieee_single_big;
-  else
-    return builtin_type_ieee_single_little;
+  return builtin_type_ieee_single;
 }
 
 static struct type *
 mips_double_register_type (void)
 {
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-    return builtin_type_ieee_double_big;
-  else
-    return builtin_type_ieee_double_little;
+  return builtin_type_ieee_double;
 }
 
 /* Copy a 32-bit single-precision value from the current frame
@@ -5077,8 +5065,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_ptr_bit (gdbarch, 32);
       set_gdbarch_long_long_bit (gdbarch, 64);
       set_gdbarch_long_double_bit (gdbarch, 128);
-      set_gdbarch_long_double_format (gdbarch,
-                                      &floatformat_n32n64_long_double_big);
+      set_gdbarch_long_double_format (gdbarch, floatformats_n32n64_long);
       break;
     case MIPS_ABI_N64:
       set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
@@ -5090,8 +5077,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_ptr_bit (gdbarch, 64);
       set_gdbarch_long_long_bit (gdbarch, 64);
       set_gdbarch_long_double_bit (gdbarch, 128);
-      set_gdbarch_long_double_format (gdbarch,
-                                      &floatformat_n32n64_long_double_big);
+      set_gdbarch_long_double_format (gdbarch, floatformats_n32n64_long);
       break;
     default:
       internal_error (__FILE__, __LINE__, _("unknown ABI in switch"));
index 63d0f2da6f162274af0d69dc7d0b0c14e883b2ef..386fe709bbcd29b2576dcd71566580a6146df06c 100644 (file)
@@ -1118,23 +1118,9 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      provided.  */
   gdbarch = gdbarch_alloc (&info, NULL);
 
-  switch (info.byte_order)
-    {
-    case BFD_ENDIAN_BIG:
-      set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
-      set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
-      set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
-      break;
-    case BFD_ENDIAN_LITTLE:
-      set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
-      set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little);
-      set_gdbarch_long_double_format (gdbarch,
-                                     &floatformat_ieee_double_little);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__,
-                     _("mt_gdbarch_init: bad byte order for float format"));
-    }
+  set_gdbarch_float_format (gdbarch, floatformats_ieee_single_big);
+  set_gdbarch_double_format (gdbarch, floatformats_ieee_double_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double_big);
 
   set_gdbarch_register_name (gdbarch, mt_register_name);
   set_gdbarch_num_regs (gdbarch, MT_NUM_REGS);
index 5d4290cef6afcb39f90a5680dfa2e601e8add0a3..ca465e2e0edeb1d261c02767ecb65d99c9c3ac14 100644 (file)
@@ -132,19 +132,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                  if (write_pass)
                    {
                      char memval[8];
-                     struct type *memtype;
-                     switch (TARGET_BYTE_ORDER)
-                       {
-                       case BFD_ENDIAN_BIG:
-                         memtype = builtin_type_ieee_double_big;
-                         break;
-                       case BFD_ENDIAN_LITTLE:
-                         memtype = builtin_type_ieee_double_little;
-                         break;
-                       default:
-                         internal_error (__FILE__, __LINE__, _("bad switch"));
-                       }
-                     convert_typed_floating (val, type, memval, memtype);
+                     convert_typed_floating (val, type, memval,
+                                             builtin_type_ieee_double);
                      write_memory (sp + argoffset, val, len);
                    }
                  argoffset += 8;
index 89642b55cf59ded3dc54392f17de59f9200c36db..dc76a1855e2c3ece8d1e59cd25b102276132da02 100644 (file)
@@ -280,7 +280,7 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   /* OpenBSD doesn't support the 128-bit `long double' from the psABI.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   /* OpenBSD currently uses a broken GCC.  */
   set_gdbarch_return_value (gdbarch, ppc_sysv_abi_broken_return_value);
index 492efa7e29fe9fa49159779cbe3f91dfdfbee376..74a1d33c00b9ffba097ce0bc3f1c91a915a58919 100644 (file)
@@ -246,7 +246,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   /* GNU/Linux doesn't support the 128-bit `long double' from the psABI.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
index 00e802bf5b78462cf4ec5486fe85142da061ea0c..a55687f03fc2d94f3648e8cc88f864761c327b91 100644 (file)
@@ -65,7 +65,7 @@ struct regset;
 
 /* The SPARC Floating-Point Quad-Precision format is similar to
    big-endian IA-64 Quad-recision format.  */
-#define floatformat_sparc_quad floatformat_ia64_quad_big
+#define floatformats_sparc_quad floatformats_ia64_quad
 
 /* The stack pointer is offset from the stack frame by a BIAS of 2047
    (0x7ff) for 64-bit code.  BIAS is likely to be defined on SPARC
@@ -1296,7 +1296,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep->step_trap = sparc_step_trap;
 
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_sparc_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_sparc_quad);
 
   set_gdbarch_num_regs (gdbarch, SPARC32_NUM_REGS);
   set_gdbarch_register_name (gdbarch, sparc32_register_name);
index 6c16a9bb57a2e9c2584b06055d6839d3c827d5c8..0b8d86ef85dd53a272ec7fff46e7dac626cbaed9 100644 (file)
@@ -293,7 +293,7 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   /* NetBSD doesn't support the 128-bit `long double' from the psABI.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   tdep->gregset = regset_alloc (gdbarch, sparc32nbsd_supply_gregset, NULL);
   tdep->sizeof_gregset = 20 * 4;
index 222b95f8f1bec8aef73413c689263217c12b91f1..ef8c1c65c95183d40f23b2919d23e28b5ab5a11a 100644 (file)
@@ -1053,9 +1053,9 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_float_bit (gdbarch, 32);
   set_gdbarch_double_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
-  set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+  set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   /* Inferior function calls.  */
   set_gdbarch_push_dummy_call (gdbarch, spu_push_dummy_call);
index 52d32b211fc056283bdb3f1571b8bd5dd475e85d..877e02dd3b73fe6f53c7f9690e0b5f22e80c2ca3 100644 (file)
@@ -477,10 +477,10 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   gdbarch = gdbarch_alloc (&info, NULL);
 
-  set_gdbarch_float_format (gdbarch, &floatformat_vax_f);
-  set_gdbarch_double_format (gdbarch, &floatformat_vax_d);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_vax_d);
-  set_gdbarch_long_double_bit(gdbarch, 64);
+  set_gdbarch_float_format (gdbarch, floatformats_vax_f);
+  set_gdbarch_double_format (gdbarch, floatformats_vax_d);
+  set_gdbarch_long_double_format (gdbarch, floatformats_vax_d);
+  set_gdbarch_long_double_bit (gdbarch, 64);
 
   /* Register info */
   set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);