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),
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_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;
}
/* 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))
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);
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
/* 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);
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);
"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
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;
\f
/* 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. */
= 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);
= 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. */
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 *);
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 *);
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
ia64_gdbarch_tdep *tdep = gdbarch_tdep<ia64_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;
}
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");
m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_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;
}
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;
/* 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;
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"));
*/
/* 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;
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);
sh_gdbarch_tdep *tdep = gdbarch_tdep<sh_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;
}
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);
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:
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:
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;
}