* mips-tdep.c: Include "floatformat.h".
authorJoel Brobecker <brobecker@gnat.com>
Mon, 9 Aug 2004 05:45:20 +0000 (05:45 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Mon, 9 Aug 2004 05:45:20 +0000 (05:45 +0000)
        (n32n64_floatformat_always_valid): New function.
        (floatformat_n32n64_long_double_big): New constant.
        (mips_gdbarch_init): Set size and format of long double
        for N32 and N64 ABIs.
        * Makefile.in (mips-tdep.o): Update dependencies.

gdb/ChangeLog
gdb/mips-tdep.c

index b3adc5e20adee894dd585c396d5ecb8d8c826a1d..62a5b482c363f4803793fedae984106c2a59357c 100644 (file)
@@ -1,3 +1,12 @@
+2004-08-08  Joel Brobecker  <brobecker@gnat.com>
+
+       * mips-tdep.c: Include "floatformat.h".
+       (n32n64_floatformat_always_valid): New function.
+       (floatformat_n32n64_long_double_big): New constant.
+       (mips_gdbarch_init): Set size and format of long double
+       for N32 and N64 ABIs.
+       * Makefile.in (mips-tdep.o): Update dependencies.
+
 2004-08-08  Andrew Cagney  <cagney@gnu.org>
 
        * gdbarch.sh: Delete "fmt" and "attrib" fields.  Always use %s to
index f6c568a5d3e4d75af58ce8e2a01d3c625423fee8..e02202cc93750c769305a83d196208c98cdbd0bb 100644 (file)
@@ -54,6 +54,7 @@
 #include "frame-base.h"
 #include "trad-frame.h"
 #include "infcall.h"
+#include "floatformat.h"
 
 static const struct objfile_data *mips_pdr_data;
 
@@ -149,6 +150,32 @@ struct gdbarch_tdep
   const char **mips_processor_reg_names;
 };
 
+static int
+n32n64_floatformat_always_valid (const struct floatformat *fmt,
+                                 const char *from)
+{
+  return 1;
+}
+
+/* FIXME: brobecker/2004-08-08: Long Double values are 128 bit long.
+   They are implemented as a pair of 64bit doubles where the high
+   part holds the result of the operation rounded to double, and
+   the low double holds the difference between the exact result and
+   the rounded result.  So "high" + "low" contains the result with
+   added precision.  Unfortunately, the floatformat structure used
+   by GDB is not powerful enough to describe this format.  As a temporary
+   measure, we define a 128bit floatformat that only uses the high part.
+   We lose a bit of precision but that's probably the best we can do
+   for now with the current infrastructure.  */
+
+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",
+  n32n64_floatformat_always_valid
+};
+
 const struct mips_regnum *
 mips_regnum (struct gdbarch *gdbarch)
 {
@@ -6323,6 +6350,9 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_long_bit (gdbarch, 32);
       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);
       break;
     case MIPS_ABI_N64:
       set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
@@ -6333,6 +6363,9 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_long_bit (gdbarch, 64);
       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);
       break;
     default:
       internal_error (__FILE__, __LINE__, "unknown ABI in switch");
This page took 0.032732 seconds and 4 git commands to generate.