aboutsummaryrefslogtreecommitdiff
path: root/gdb/ia64-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:48:54 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:48:54 +0000
commit270677457f363b213b10923759f4f96ed1aa868b (patch)
treec93737e0d4e97ae68205efbed645741eccae5089 /gdb/ia64-tdep.c
parentdf4df182b49ab6808495f557d3727b8dfd4b98da (diff)
downloadgdb-270677457f363b213b10923759f4f96ed1aa868b.zip
gdb-270677457f363b213b10923759f4f96ed1aa868b.tar.gz
gdb-270677457f363b213b10923759f4f96ed1aa868b.tar.bz2
* gdbtypes.h (builtin_type_ieee_single, builtin_type_ieee_double,
builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (init_float_type, init_complex_type): Add prototypes. * gdbtypes.c (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (_initialize_gdbtypes): Do not initialize them. (build_flt): Rename to ... (init_float_type): ... this. Make global. (build_complex): Rename to ... (init_complex_type): ... this. Make global. Remove BIT argument. (gdbtypes_post_init): Update calls. * ada-lang.c (ada_language_arch_info): Use init_float_type. * jv-lang.c (build_java_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * f-lang.c (build_fortran_types): Use init_float_type and init_complex_type. * target-descriptions.c (tdesc_gdb_type): Call init_float_type instead of using builtin_type_ieee_single, builtin_type_ieee_double, or builtin_type_arm_ext. * ia64-tdep.h (struct gdbarch_tdep): Add ia64_ext_type member. * ia64-tdep.c (builtin_type_ia64_ext): Remove. (_initialize_ia64_tdep): Do not initialize it. (floatformat_valid, floatformat_ia64_ext, floatformats_ia64_ext): Move up. (ia64_ext_type): New function. (ia64_register_reggroup_p, ia64_convert_register_p, ia64_register_to_value, ia64_value_to_register, ia64_extract_return_value, ia64_store_return_value): Use ia64_ext_type instead of builtin_type_ia64_ext. * i386-tdep.h (struct gdbarch_tdep): Add i387_ext_type member. (i387_ext_type): Add prototype. * i386-tdep.c (i387_ext_type): New function. (i386_extract_return_value, i386_store_return_value, i386_register_type): Use it instead of builtin_type_i387_ext. * amd64-tdep.c (amd64_register_type): Likewise. * i387-tdep.c (print_i387_value, i387_register_to_value, i387_value_to_register): Likewise. (print_i387_value, print_i387_ext): Add GDBARCH argument. (print_i387_ext, i387_print_float_info): Pass to subroutines. * m68k-tdep.h (struct gdbarch_tdep): Add m68881_ext_type member. * m68k-tdep.c (m68881_ext_type): New function. (m68k_register_type, m68k_convert_register_p): Use it instead of builtin_type_m68881_ext. * arm-tdep.h (struct gdbarch_tdep): Add arm_ext_type member. * arm-tdep.c (arm_ext_type): New function. (arm_register_type): Use it instead of builtin_type_arm_ext. * alpha-tdep.c (alpha_register_type): Use builtin types instead of builtin_type_ieee_double. * mips-tdep.c (mips_float_register_type, mips_double_register_type): Remove. (mips_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double. (mips_print_fp_register): Use builtin types instead of mips_float_register_type and mips_double_register_type. * hppa-tdep.c (hppa32_register_type, hppa64_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double.
Diffstat (limited to 'gdb/ia64-tdep.c')
-rw-r--r--gdb/ia64-tdep.c81
1 files changed, 44 insertions, 37 deletions
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index ef36061..6919650 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -125,8 +125,6 @@ static gdbarch_skip_prologue_ftype ia64_skip_prologue;
static struct type *is_float_or_hfa_type (struct type *t);
static CORE_ADDR ia64_find_global_pointer (CORE_ADDR faddr);
-static struct type *builtin_type_ia64_ext;
-
#define NUM_IA64_RAW_REGS 462
static int sp_regnum = IA64_GR12_REGNUM;
@@ -281,6 +279,37 @@ struct ia64_frame_cache
};
static int
+floatformat_valid (const struct floatformat *fmt, const void *from)
+{
+ return 1;
+}
+
+static const struct floatformat floatformat_ia64_ext =
+{
+ floatformat_little, 82, 0, 1, 17, 65535, 0x1ffff, 18, 64,
+ floatformat_intbit_yes, "floatformat_ia64_ext", floatformat_valid, NULL
+};
+
+static const struct floatformat *floatformats_ia64_ext[2] =
+{
+ &floatformat_ia64_ext,
+ &floatformat_ia64_ext
+};
+
+static struct type *
+ia64_ext_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->ia64_ext_type)
+ tdep->ia64_ext_type
+ = init_float_type (128, "builtin_type_ia64_ext",
+ floatformats_ia64_ext);
+
+ return tdep->ia64_ext_type;
+}
+
+static int
ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
@@ -313,7 +342,7 @@ struct type *
ia64_register_type (struct gdbarch *arch, int reg)
{
if (reg >= IA64_FR0_REGNUM && reg <= IA64_FR127_REGNUM)
- return builtin_type_ia64_ext;
+ return ia64_ext_type (arch);
else
return builtin_type (arch)->builtin_long;
}
@@ -326,24 +355,6 @@ ia64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
return reg;
}
-static int
-floatformat_valid (const struct floatformat *fmt, const void *from)
-{
- return 1;
-}
-
-const struct floatformat floatformat_ia64_ext =
-{
- floatformat_little, 82, 0, 1, 17, 65535, 0x1ffff, 18, 64,
- floatformat_intbit_yes, "floatformat_ia64_ext", floatformat_valid, NULL
-};
-
-const struct floatformat *floatformats_ia64_ext[2] =
-{
- &floatformat_ia64_ext,
- &floatformat_ia64_ext
-};
-
/* Extract ``len'' bits from an instruction bundle starting at
bit ``from''. */
@@ -1048,24 +1059,26 @@ static int
ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type)
{
return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM
- && type != builtin_type_ia64_ext);
+ && type != ia64_ext_type (gdbarch));
}
static void
ia64_register_to_value (struct frame_info *frame, int regnum,
struct type *valtype, gdb_byte *out)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char in[MAX_REGISTER_SIZE];
frame_register_read (frame, regnum, in);
- convert_typed_floating (in, builtin_type_ia64_ext, out, valtype);
+ convert_typed_floating (in, ia64_ext_type (gdbarch), out, valtype);
}
static void
ia64_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char out[MAX_REGISTER_SIZE];
- convert_typed_floating (in, valtype, out, builtin_type_ia64_ext);
+ convert_typed_floating (in, valtype, out, ia64_ext_type (gdbarch));
put_frame_register (frame, regnum, out);
}
@@ -2985,6 +2998,7 @@ static void
ia64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct type *float_elt_type;
float_elt_type = is_float_or_hfa_type (type);
@@ -2998,7 +3012,7 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
regcache_cooked_read (regcache, regnum, from);
- convert_typed_floating (from, builtin_type_ia64_ext,
+ convert_typed_floating (from, ia64_ext_type (gdbarch),
(char *)valbuf + offset, float_elt_type);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
@@ -3009,8 +3023,7 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
ULONGEST val;
int offset = 0;
int regnum = IA64_GR8_REGNUM;
- int reglen = TYPE_LENGTH (register_type (get_regcache_arch (regcache),
- IA64_GR8_REGNUM));
+ int reglen = TYPE_LENGTH (register_type (gdbarch, IA64_GR8_REGNUM));
int n = TYPE_LENGTH (type) / reglen;
int m = TYPE_LENGTH (type) % reglen;
@@ -3035,6 +3048,7 @@ static void
ia64_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct type *float_elt_type;
float_elt_type = is_float_or_hfa_type (type);
@@ -3048,7 +3062,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
convert_typed_floating ((char *)valbuf + offset, float_elt_type,
- to, builtin_type_ia64_ext);
+ to, ia64_ext_type (gdbarch));
regcache_cooked_write (regcache, regnum, to);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
@@ -3059,8 +3073,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
ULONGEST val;
int offset = 0;
int regnum = IA64_GR8_REGNUM;
- int reglen = TYPE_LENGTH (register_type (get_regcache_arch (regcache),
- IA64_GR8_REGNUM));
+ int reglen = TYPE_LENGTH (register_type (gdbarch, IA64_GR8_REGNUM));
int n = TYPE_LENGTH (type) / reglen;
int m = TYPE_LENGTH (type) % reglen;
@@ -3520,7 +3533,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
char to[MAX_REGISTER_SIZE];
convert_typed_floating (value_contents (arg) + argoffset, float_elt_type,
- to, builtin_type_ia64_ext);
+ to, ia64_ext_type (gdbarch));
regcache_cooked_write (regcache, floatreg, (void *)to);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);
@@ -3691,11 +3704,5 @@ extern initialize_file_ftype _initialize_ia64_tdep; /* -Wmissing-prototypes */
void
_initialize_ia64_tdep (void)
{
- /* Define the ia64 floating-point format to gdb. */
- builtin_type_ia64_ext =
- init_type (TYPE_CODE_FLT, 128 / 8,
- 0, "builtin_type_ia64_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_ia64_ext) = floatformats_ia64_ext;
-
gdbarch_register (bfd_arch_ia64, ia64_gdbarch_init, NULL);
}