From 77c5f49648cc39d9e4b1bd0411998ec42375654b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 13 Mar 2023 11:30:08 -0600 Subject: Unify arch_float_type and init_float_type This unifies arch_float_type and init_float_type by using a type allocator. Reviewed-By: Simon Marchi --- gdb/ada-lang.c | 6 +++--- gdb/arm-tdep.c | 9 ++++++--- gdb/csky-tdep.c | 5 ++++- gdb/ctfread.c | 2 +- gdb/d-lang.c | 12 ++++++------ gdb/dwarf2/read.c | 2 +- gdb/f-lang.c | 8 ++++---- gdb/gdbtypes.c | 49 ++++++++++++----------------------------------- gdb/gdbtypes.h | 17 +++++++++++----- gdb/go-lang.c | 4 ++-- gdb/ia64-tdep.c | 9 ++++++--- gdb/m2-lang.c | 2 +- gdb/m68k-tdep.c | 9 ++++++--- gdb/mdebugread.c | 4 ++-- gdb/nds32-tdep.c | 7 +++++-- gdb/opencl-lang.c | 6 +++--- gdb/rs6000-tdep.c | 3 ++- gdb/rust-lang.c | 4 ++-- gdb/sh-tdep.c | 9 ++++++--- gdb/stabsread.c | 12 ++++++------ gdb/target-descriptions.c | 13 +++++++------ 21 files changed, 97 insertions(+), 95 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 07995f3..b1c8912 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13569,13 +13569,13 @@ public: add (char_type); add (init_character_type (alloc, 16, 1, "wide_character")); add (init_character_type (alloc, 32, 1, "wide_wide_character")); - add (arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), + add (init_float_type (alloc, gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch))); - add (arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), + add (init_float_type (alloc, gdbarch_double_bit (gdbarch), "long_float", gdbarch_double_format (gdbarch))); add (init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 0, "long_long_integer")); - add (arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), + add (init_float_type (alloc, gdbarch_long_double_bit (gdbarch), "long_long_float", gdbarch_long_double_format (gdbarch))); add (init_integer_type (alloc, gdbarch_int_bit (gdbarch), diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 883f8be..803596d 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -4904,9 +4904,12 @@ arm_ext_type (struct gdbarch *gdbarch) arm_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (!tdep->arm_ext_type) - tdep->arm_ext_type - = arch_float_type (gdbarch, -1, "builtin_type_arm_ext", - floatformats_arm_ext); + { + type_allocator alloc (gdbarch); + tdep->arm_ext_type + = init_float_type (alloc, -1, "builtin_type_arm_ext", + floatformats_arm_ext); + } return tdep->arm_ext_type; } diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index f704750..e1bafea 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -737,8 +737,11 @@ csky_register_type (struct gdbarch *gdbarch, int reg_nr) /* Float register has 64 bits, and only in ck810. */ if ((reg_nr >=CSKY_FR0_REGNUM) && (reg_nr <= CSKY_FR0_REGNUM + 15)) - return arch_float_type (gdbarch, 64, "builtin_type_csky_ext", + { + type_allocator alloc (gdbarch); + return init_float_type (alloc, 64, "builtin_type_csky_ext", floatformats_ieee_double); + } /* Profiling general register has 48 bits, we use 64bit. */ if ((reg_nr >= CSKY_PROFGR_REGNUM) && (reg_nr <= CSKY_PROFGR_REGNUM + 44)) diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 72cd8b7..ea55719 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -375,7 +375,7 @@ ctf_init_float_type (struct objfile *objfile, type_allocator alloc (objfile); format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits); if (format != nullptr) - type = init_float_type (objfile, bits, name, format); + type = init_float_type (alloc, bits, name, format); else type = alloc.new_type (TYPE_CODE_ERROR, bits, name); diff --git a/gdb/d-lang.c b/gdb/d-lang.c index a970281..8d1bdd0 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -226,13 +226,13 @@ build_d_types (struct gdbarch *gdbarch) builtin_d_type->builtin_ucent = init_integer_type (alloc, 128, 1, "ucent"); builtin_d_type->builtin_float - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), + = init_float_type (alloc, gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); builtin_d_type->builtin_double - = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_double_bit (gdbarch), "double", gdbarch_double_format (gdbarch)); builtin_d_type->builtin_real - = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_long_double_bit (gdbarch), "real", gdbarch_long_double_format (gdbarch)); builtin_d_type->builtin_byte->set_instance_flags @@ -245,13 +245,13 @@ build_d_types (struct gdbarch *gdbarch) /* Imaginary and complex types. */ builtin_d_type->builtin_ifloat - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), + = init_float_type (alloc, gdbarch_float_bit (gdbarch), "ifloat", gdbarch_float_format (gdbarch)); builtin_d_type->builtin_idouble - = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_double_bit (gdbarch), "idouble", gdbarch_double_format (gdbarch)); builtin_d_type->builtin_ireal - = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_long_double_bit (gdbarch), "ireal", gdbarch_long_double_format (gdbarch)); builtin_d_type->builtin_cfloat = init_complex_type ("cfloat", builtin_d_type->builtin_float); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ba65cf6..06aa4e3 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15014,7 +15014,7 @@ dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name, type_allocator alloc (objfile); format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits); if (format) - type = init_float_type (objfile, bits, name, format, byte_order); + type = init_float_type (alloc, bits, name, format, byte_order); else type = alloc.new_type (TYPE_CODE_ERROR, bits, name); diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 482ae68..3fc4334 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1759,20 +1759,20 @@ build_fortran_types (struct gdbarch *gdbarch) "integer*8"); builtin_f_type->builtin_real - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), + = init_float_type (alloc, gdbarch_float_bit (gdbarch), "real*4", gdbarch_float_format (gdbarch)); builtin_f_type->builtin_real_s8 - = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_double_bit (gdbarch), "real*8", gdbarch_double_format (gdbarch)); auto fmt = gdbarch_floatformat_for_type (gdbarch, "real(kind=16)", 128); if (fmt != nullptr) builtin_f_type->builtin_real_s16 - = arch_float_type (gdbarch, 128, "real*16", fmt); + = init_float_type (alloc, 128, "real*16", fmt); else if (gdbarch_long_double_bit (gdbarch) == 128) builtin_f_type->builtin_real_s16 - = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_long_double_bit (gdbarch), "real*16", gdbarch_long_double_format (gdbarch)); else builtin_f_type->builtin_real_s16 diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index cf2862f..02711e0 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3451,29 +3451,24 @@ init_boolean_type (type_allocator &alloc, return t; } -/* Allocate a TYPE_CODE_FLT type structure associated with OBJFILE. - BIT is the type size in bits; if BIT equals -1, the size is - determined by the floatformat. NAME is the type name. Set the - TYPE_FLOATFORMAT from FLOATFORMATS. BYTE_ORDER is the byte order - to use. If it is BFD_ENDIAN_UNKNOWN (the default), then the byte - order of the objfile's architecture is used. */ +/* See gdbtypes.h. */ struct type * -init_float_type (struct objfile *objfile, +init_float_type (type_allocator &alloc, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order) { if (byte_order == BFD_ENDIAN_UNKNOWN) { - struct gdbarch *gdbarch = objfile->arch (); + struct gdbarch *gdbarch = alloc.arch (); byte_order = gdbarch_byte_order (gdbarch); } const struct floatformat *fmt = floatformats[byte_order]; struct type *t; bit = verify_floatformat (bit, fmt); - t = type_allocator (objfile).new_type (TYPE_CODE_FLT, bit, name); + t = alloc.new_type (TYPE_CODE_FLT, bit, name); TYPE_FLOATFORMAT (t) = fmt; return t; @@ -5746,26 +5741,6 @@ copy_type (const struct type *type) /* Helper functions to initialize architecture-specific types. */ -/* Allocate a TYPE_CODE_FLT type structure associated with GDBARCH. - BIT is the type size in bits; if BIT equals -1, the size is - determined by the floatformat. NAME is the type name. Set the - TYPE_FLOATFORMAT from FLOATFORMATS. */ - -struct type * -arch_float_type (struct gdbarch *gdbarch, - int bit, const char *name, - const struct floatformat **floatformats) -{ - const struct floatformat *fmt = floatformats[gdbarch_byte_order (gdbarch)]; - struct type *t; - - bit = verify_floatformat (bit, fmt); - t = type_allocator (gdbarch).new_type (TYPE_CODE_FLT, bit, name); - TYPE_FLOATFORMAT (t) = fmt; - - return t; -} - /* Allocate a TYPE_CODE_DECFLOAT type structure associated with GDBARCH. BIT is the type size in bits. NAME is the type name. */ @@ -6063,19 +6038,19 @@ create_gdbtypes_data (struct gdbarch *gdbarch) = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 1, "unsigned long long"); builtin_type->builtin_half - = arch_float_type (gdbarch, gdbarch_half_bit (gdbarch), + = init_float_type (alloc, gdbarch_half_bit (gdbarch), "half", gdbarch_half_format (gdbarch)); builtin_type->builtin_float - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), + = init_float_type (alloc, gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); builtin_type->builtin_bfloat16 - = arch_float_type (gdbarch, gdbarch_bfloat16_bit (gdbarch), + = init_float_type (alloc, gdbarch_bfloat16_bit (gdbarch), "bfloat16", gdbarch_bfloat16_format (gdbarch)); builtin_type->builtin_double - = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_double_bit (gdbarch), "double", gdbarch_double_format (gdbarch)); builtin_type->builtin_long_double - = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_long_double_bit (gdbarch), "long double", gdbarch_long_double_format (gdbarch)); builtin_type->builtin_complex = init_complex_type ("complex", builtin_type->builtin_float); @@ -6240,13 +6215,13 @@ objfile_type (struct objfile *objfile) = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 1, "unsigned long long"); objfile_type->builtin_float - = init_float_type (objfile, gdbarch_float_bit (gdbarch), + = init_float_type (alloc, gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); objfile_type->builtin_double - = init_float_type (objfile, gdbarch_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_double_bit (gdbarch), "double", gdbarch_double_format (gdbarch)); objfile_type->builtin_long_double - = init_float_type (objfile, gdbarch_long_double_bit (gdbarch), + = init_float_type (alloc, gdbarch_long_double_bit (gdbarch), "long double", gdbarch_long_double_format (gdbarch)); /* This type represents a type that was unrecognized in symbol read-in. */ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 9dcd0e5..a819f50 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2315,9 +2315,18 @@ extern struct type *init_character_type (type_allocator &alloc, int bit, extern struct type *init_boolean_type (type_allocator &alloc, int bit, int unsigned_p, const char *name); -extern struct type *init_float_type (struct objfile *, int, const char *, - const struct floatformat **, - enum bfd_endian = BFD_ENDIAN_UNKNOWN); +/* Allocate a TYPE_CODE_FLT type structure using ALLOC. + BIT is the type size in bits; if BIT equals -1, the size is + determined by the floatformat. NAME is the type name. Set the + TYPE_FLOATFORMAT from FLOATFORMATS. BYTE_ORDER is the byte order + to use. If it is BFD_ENDIAN_UNKNOWN (the default), then the byte + order of the objfile's architecture is used. */ + +extern struct type *init_float_type + (type_allocator &alloc, int bit, const char *name, + const struct floatformat **floatformats, + enum bfd_endian byte_order = BFD_ENDIAN_UNKNOWN); + extern struct type *init_decfloat_type (struct objfile *, int, const char *); extern bool can_create_complex_type (struct type *); extern struct type *init_complex_type (const char *, struct type *); @@ -2327,8 +2336,6 @@ extern struct type *init_fixed_point_type (struct objfile *, int, int, const char *); /* Helper functions to construct architecture-owned types. */ -extern struct type *arch_float_type (struct gdbarch *, int, const char *, - const struct floatformat **); extern struct type *arch_decfloat_type (struct gdbarch *, int, const char *); extern struct type *arch_pointer_type (struct gdbarch *, int, const char *, struct type *); diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 4b6027d..7561450 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -512,9 +512,9 @@ build_go_types (struct gdbarch *gdbarch) builtin_go_type->builtin_uint64 = init_integer_type (alloc, 64, 1, "uint64"); builtin_go_type->builtin_float32 - = arch_float_type (gdbarch, 32, "float32", floatformats_ieee_single); + = init_float_type (alloc, 32, "float32", floatformats_ieee_single); builtin_go_type->builtin_float64 - = arch_float_type (gdbarch, 64, "float64", floatformats_ieee_double); + = init_float_type (alloc, 64, "float64", floatformats_ieee_double); builtin_go_type->builtin_complex64 = init_complex_type ("complex64", builtin_go_type->builtin_float32); builtin_go_type->builtin_complex128 diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index f714c98..37e5ce9 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -313,9 +313,12 @@ ia64_ext_type (struct gdbarch *gdbarch) ia64_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (!tdep->ia64_ext_type) - tdep->ia64_ext_type - = arch_float_type (gdbarch, 128, "builtin_type_ia64_ext", - floatformats_ia64_ext); + { + type_allocator alloc (gdbarch); + tdep->ia64_ext_type + = init_float_type (alloc, 128, "builtin_type_ia64_ext", + floatformats_ia64_ext); + } return tdep->ia64_ext_type; } diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 03c5753..e966fb4 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -289,7 +289,7 @@ build_m2_types (struct gdbarch *gdbarch) builtin_m2_type->builtin_card = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "CARDINAL"); builtin_m2_type->builtin_real - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", + = init_float_type (alloc, gdbarch_float_bit (gdbarch), "REAL", gdbarch_float_format (gdbarch)); builtin_m2_type->builtin_char = init_character_type (alloc, TARGET_CHAR_BIT, 1, "CHAR"); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index cbd7976..5b2a29a 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -102,9 +102,12 @@ m68881_ext_type (struct gdbarch *gdbarch) m68k_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (!tdep->m68881_ext_type) - tdep->m68881_ext_type - = arch_float_type (gdbarch, -1, "builtin_type_m68881_ext", - floatformats_m68881_ext); + { + type_allocator alloc (gdbarch); + tdep->m68881_ext_type + = init_float_type (alloc, -1, "builtin_type_m68881_ext", + floatformats_m68881_ext); + } return tdep->m68881_ext_type; } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 14f7d30..64884ac 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1433,12 +1433,12 @@ basic_type (int bt, struct objfile *objfile) break; case btFloat: - tp = init_float_type (objfile, gdbarch_float_bit (gdbarch), + tp = init_float_type (alloc, gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); break; case btDouble: - tp = init_float_type (objfile, gdbarch_double_bit (gdbarch), + tp = init_float_type (alloc, gdbarch_double_bit (gdbarch), "double", gdbarch_double_format (gdbarch)); break; diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index c65bc1a..a81b5fd 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -403,8 +403,11 @@ nds32_pseudo_register_type (struct gdbarch *gdbarch, int regnum) /* Currently, only FSRs could be defined as pseudo registers. */ if (regnum < gdbarch_num_pseudo_regs (gdbarch)) - return arch_float_type (gdbarch, -1, "builtin_type_ieee_single", - floatformats_ieee_single); + { + type_allocator alloc (gdbarch); + return init_float_type (alloc, -1, "builtin_type_ieee_single", + floatformats_ieee_single); + } warning (_("Unknown nds32 pseudo register %d."), regnum); return NULL; diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 9a3c6d7..47f6554 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -926,11 +926,11 @@ public: BUILD_OCL_VTYPES (long, el_type); el_type = add (init_integer_type (alloc, 64, 1, "ulong")); BUILD_OCL_VTYPES (ulong, el_type); - el_type = add (arch_float_type (gdbarch, 16, "half", floatformats_ieee_half)); + el_type = add (init_float_type (alloc, 16, "half", floatformats_ieee_half)); BUILD_OCL_VTYPES (half, el_type); - el_type = add (arch_float_type (gdbarch, 32, "float", floatformats_ieee_single)); + el_type = add (init_float_type (alloc, 32, "float", floatformats_ieee_single)); BUILD_OCL_VTYPES (float, el_type); - el_type = add (arch_float_type (gdbarch, 64, "double", floatformats_ieee_double)); + el_type = add (init_float_type (alloc, 64, "double", floatformats_ieee_double)); BUILD_OCL_VTYPES (double, el_type); add (init_boolean_type (alloc, 8, 1, "bool")); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 9859a7d..52dcc89 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2432,8 +2432,9 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch) */ /* PPC specific type for IEEE 128-bit float field */ + type_allocator alloc (gdbarch); struct type *t_float128 - = arch_float_type (gdbarch, 128, "float128_t", floatformats_ieee_quad); + = init_float_type (alloc, 128, "float128_t", floatformats_ieee_quad); struct type *t; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 2029232..cb128f1 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1613,8 +1613,8 @@ rust_language::language_arch_info (struct gdbarch *gdbarch, struct type *usize_type = add (init_integer_type (alloc, length, 1, "usize")); - add (arch_float_type (gdbarch, 32, "f32", floatformats_ieee_single)); - add (arch_float_type (gdbarch, 64, "f64", floatformats_ieee_double)); + add (init_float_type (alloc, 32, "f32", floatformats_ieee_single)); + add (init_float_type (alloc, 64, "f64", floatformats_ieee_double)); add (init_integer_type (alloc, 0, 1, "()")); struct type *tem = make_cv_type (1, 0, u8_type, NULL); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 60f15f1..babf85e 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1516,9 +1516,12 @@ sh_littlebyte_bigword_type (struct gdbarch *gdbarch) sh_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (tdep->sh_littlebyte_bigword_type == NULL) - tdep->sh_littlebyte_bigword_type - = arch_float_type (gdbarch, -1, "builtin_type_sh_littlebyte_bigword", - floatformats_ieee_double_littlebyte_bigword); + { + type_allocator alloc (gdbarch); + tdep->sh_littlebyte_bigword_type + = init_float_type (alloc, -1, "builtin_type_sh_littlebyte_bigword", + floatformats_ieee_double_littlebyte_bigword); + } return tdep->sh_littlebyte_bigword_type; } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index fc02c98..7ed0ebf 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -374,7 +374,7 @@ dbx_init_float_type (struct objfile *objfile, int bits) format = gdbarch_floatformat_for_type (gdbarch, NULL, bits); type_allocator alloc (objfile); if (format) - type = init_float_type (objfile, bits, NULL, format); + type = init_float_type (alloc, bits, NULL, format); else type = alloc.new_type (TYPE_CODE_ERROR, bits, NULL); @@ -2125,19 +2125,19 @@ rs6000_builtin_type (int typenum, struct objfile *objfile) break; case 12: /* IEEE single precision (32 bit). */ - rettype = init_float_type (objfile, 32, "float", + rettype = init_float_type (alloc, 32, "float", floatformats_ieee_single); break; case 13: /* IEEE double precision (64 bit). */ - rettype = init_float_type (objfile, 64, "double", + rettype = init_float_type (alloc, 64, "double", floatformats_ieee_double); break; case 14: /* This is an IEEE double on the RS/6000, and different machines with different sizes for "long double" should use different negative type numbers. See stabs.texinfo. */ - rettype = init_float_type (objfile, 64, "long double", + rettype = init_float_type (alloc, 64, "long double", floatformats_ieee_double); break; case 15: @@ -2147,11 +2147,11 @@ rs6000_builtin_type (int typenum, struct objfile *objfile) rettype = init_boolean_type (alloc, 32, 1, "boolean"); break; case 17: - rettype = init_float_type (objfile, 32, "short real", + rettype = init_float_type (alloc, 32, "short real", floatformats_ieee_single); break; case 18: - rettype = init_float_type (objfile, 64, "real", + rettype = init_float_type (alloc, 64, "real", floatformats_ieee_double); break; case 19: diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 7af3875..7ae9058 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -116,34 +116,35 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype) if (m_type != NULL) return; + type_allocator alloc (m_gdbarch); switch (e->kind) { case TDESC_TYPE_IEEE_HALF: - m_type = arch_float_type (m_gdbarch, -1, "builtin_type_ieee_half", + m_type = init_float_type (alloc, -1, "builtin_type_ieee_half", floatformats_ieee_half); return; case TDESC_TYPE_IEEE_SINGLE: - m_type = arch_float_type (m_gdbarch, -1, "builtin_type_ieee_single", + m_type = init_float_type (alloc, -1, "builtin_type_ieee_single", floatformats_ieee_single); return; case TDESC_TYPE_IEEE_DOUBLE: - m_type = arch_float_type (m_gdbarch, -1, "builtin_type_ieee_double", + m_type = init_float_type (alloc, -1, "builtin_type_ieee_double", floatformats_ieee_double); return; case TDESC_TYPE_ARM_FPA_EXT: - m_type = arch_float_type (m_gdbarch, -1, "builtin_type_arm_ext", + m_type = init_float_type (alloc, -1, "builtin_type_arm_ext", floatformats_arm_ext); return; case TDESC_TYPE_I387_EXT: - m_type = arch_float_type (m_gdbarch, -1, "builtin_type_i387_ext", + m_type = init_float_type (alloc, -1, "builtin_type_i387_ext", floatformats_i387_ext); return; case TDESC_TYPE_BFLOAT16: - m_type = arch_float_type (m_gdbarch, -1, "builtin_type_bfloat16", + m_type = init_float_type (alloc, -1, "builtin_type_bfloat16", floatformats_bfloat16); return; } -- cgit v1.1