* 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 9cb03be..188fd8c 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 5b8f421..b0bc35b 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 df3f9f6..a5ca574 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 f1cdb3c..cc00e58 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 f254876..7b92cd7 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 1d50991..960e6df 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 0f92fdf..3b640f5 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 f2890dd..058b4a3 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 decc8e0..8b6d60b 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 4fac0ee..8cfd33b 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 db88df0..d054799 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 a188232..5d56de0 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,
@@ -3513,21 +3555,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)
 {
   struct type *t;
@@ -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 ce30b19..8cbd26c 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 6b14985..0597040 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 86de8ee..7aaa3a3 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 d4c2cc3..1f0cb8f 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 dfcc024..1aed60d 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 1c494da..dd3ff80 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 ac2ec77..55bb5b2 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 1810f77..77d1f23 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 5ce51b2..3da7522 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 99dd2f5..f25c8a1 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 63d0f2d..386fe70 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 5d4290c..ca465e2 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 89642b5..dc76a18 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 492efa7..74a1d33 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 00e802b..a55687f 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 6c16a9b..0b8d86e 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 222b95f..ef8c1c6 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 52d32b2..877e02d 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);