+2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
+ builtin_type_int16, builtin_type_uint16, builtin_type_int32,
+ builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
+ builtin_type_int128, builtin_type_uint128): Remove.
+ (struct builtin_type): New members builtin_int0, builtin_int8,
+ builtin_uint8, builtin_int16, builtin_uint16, builtin_int32,
+ builtin_uint32, builtin_int64, builtin_uint64, builtin_int128,
+ and builtin_uint128.
+ * gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
+ builtin_type_int16, builtin_type_uint16, builtin_type_int32,
+ builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
+ builtin_type_int128, builtin_type_uint128): Remove.
+ (_initialize_gdbtypes): Do not initialize them.
+ (gdbtypes_post_init): Initialize fixed-size integer types.
+
+ * dwarf2expr.c (unsigned_address_type, signed_address_type): Add
+ GDBARCH argument. Return platform-specific type.
+ (dwarf2_read_address, execute_stack_op): Update calls.
+
+ * target-descriptions.c (tdesc_gdb_type): Use platform-specific types
+ instead of global builtin_int_... variables.
+ * mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
+ * printcmd.c (do_examine): Likewise.
+ * jv-exp.y (parse_number): Likewise.
+
+ * alpha-tdep.c (alpha_register_type, alpha_push_dummy_call,
+ alpha_store_return_value): Likewise.
+ * amd64-linux-tdep.c (amd64_linux_register_type): Likewise.
+ * amd64-tdep.c (amd64_register_type): Likewise.
+ * arm-tdep.c (arm_register_type): Likewise.
+ * avr-tdep.c (avr_register_type): Likewise.
+ * cris-tdep.c (cris_register_type, crisv32_register_type): Likewise.
+ * frv-tdep.c (frv_register_type): Likewise.
+ * h8300-tdep.c h8300_register_type): Likewise.
+ * hppa-tdep.c (hppa64_push_dummy_call, hppa32_register_type,
+ hppa64_register_type): Likewise.
+ * i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise.
+ * iq2000-tdep.c (iq2000_register_type): Likewise.
+ * lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise.
+ * m32r-tdep.c (m32r_register_type): Likewise.
+ * m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read,
+ m68hc11_pseudo_register_write): Likewise.
+ * m68k-tdep.c (m68k_register_type): Likewise.
+ * m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise.
+ * mep-tdep.c (mep_register_type): Likewise.
+ * mips-tdep.c (mips_register_type, mips_pseudo_register_type,
+ mips_print_fp_register): Likewise.
+ * moxie-tdep.c (moxie_register_type): Likewise.
+ * mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise.
+ * rs6000-tdep.c (rs6000_builtin_type_vec64,
+ rs6000_builtin_type_vec128): Likewise.
+ * score-tdep.c (score_register_type): Likewise.
+ * sparc-tdep.c (sparc32_register_type, sparc32_store_arguments):
+ Likewise.
+ * sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments):
+ Likewise.
+ * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise.
+ * v850-tdep.c (v850_register_type): Likewise.
+ * xstormy16-tdep.c (xstormy16_register_type): Likewise.
+ * xtensa-tdep.c (xtensa_register_type): Likewise.
+
+ * mt-tdep.c (struct gdbarch_tdep): New data structure.
+ (mt_gdbarch_init): Alloc TDEP structures.
+ (mt_register_type): Cache coprocessor type in TDEP instead of
+ static global variable.
+
+ * xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member.
+ * xtensa-tdep.c (type_entries): Remove.
+ (xtensa_register_type): Cache fixed-size types in TDEP instead
+ of in global variable.
+
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
* gdbtypes.h (builtin_type_true_char): Remove.
if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31)
return builtin_type_ieee_double;
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
}
/* Is REGNUM a member of REGGROUP? */
{
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
- arg_type = builtin_type_int32;
+ arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg);
}
if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE)
{
- arg_type = builtin_type_int64;
+ arg_type = builtin_type (gdbarch)->builtin_int64;
arg = value_cast (arg_type, arg);
}
break;
alpha_store_return_value (struct type *valtype, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
if (length == 4)
- valtype = builtin_type_int32;
+ valtype = builtin_type (gdbarch)->builtin_int32;
l = unpack_long (valtype, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
break;
amd64_linux_register_type (struct gdbarch *gdbarch, int reg)
{
if (reg == AMD64_LINUX_ORIG_RAX_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
return amd64_register_type (gdbarch, reg);
}
amd64_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_RDI_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == AMD64_RBP_REGNUM || regnum == AMD64_RSP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == AMD64_RIP_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == AMD64_EFLAGS_REGNUM)
return i386_eflags_type;
if (regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
if (regnum >= AMD64_ST0_REGNUM && regnum <= AMD64_ST0_REGNUM + 7)
return builtin_type_i387_ext;
if (regnum >= AMD64_FCTRL_REGNUM && regnum <= AMD64_FCTRL_REGNUM + 7)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
return i386_sse_type (gdbarch);
if (regnum == AMD64_MXCSR_REGNUM)
else if (regnum >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply
an XML description. */
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
else
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
/* Map a DWARF register REGNUM onto the appropriate GDB register
avr_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == AVR_PC_REGNUM)
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
if (reg_nr == AVR_SP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
}
/* Instruction address checks and convertions. */
else if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
|| (regno >= MOF_REGNUM && regno <= USP_REGNUM))
/* Note: R8 taken care of previous clause. */
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else if (regno >= P4_REGNUM && regno <= CCR_REGNUM)
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
else if (regno >= P0_REGNUM && regno <= VR_REGNUM)
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else
/* Invalid (unimplemented) register. */
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
}
static struct type *
|| (regno == PID_REGNUM)
|| (regno >= S0_REGNUM && regno <= S15_REGNUM))
/* Note: R8 and SP taken care of by previous clause. */
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else if (regno == WZ_REGNUM)
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
else if (regno == BZ_REGNUM || regno == VR_REGNUM || regno == SRS_REGNUM)
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else
{
/* Invalid (unimplemented) register. Should not happen as there are
no unimplemented CRISv32 registers. */
warning (_("crisv32_register_type: unknown regno %d"), regno);
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
}
}
static void execute_stack_op (struct dwarf_expr_context *,
gdb_byte *, gdb_byte *);
-static struct type *unsigned_address_type (int);
+static struct type *unsigned_address_type (struct gdbarch *, int);
/* Create a new context for the expression evaluator. */
if (gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address
- (gdbarch, unsigned_address_type (addr_size), buf);
+ (gdbarch, unsigned_address_type (gdbarch, addr_size), buf);
return extract_unsigned_integer (buf, addr_size);
}
for unsigned arithmetic. */
static struct type *
-unsigned_address_type (int addr_size)
+unsigned_address_type (struct gdbarch *gdbarch, int addr_size)
{
switch (addr_size)
{
case 2:
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
case 4:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case 8:
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
default:
internal_error (__FILE__, __LINE__,
_("Unsupported address size.\n"));
for signed arithmetic. */
static struct type *
-signed_address_type (int addr_size)
+signed_address_type (struct gdbarch *gdbarch, int addr_size)
{
switch (addr_size)
{
case 2:
- return builtin_type_int16;
+ return builtin_type (gdbarch)->builtin_int16;
case 4:
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
case 8:
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
default:
internal_error (__FILE__, __LINE__,
_("Unsupported address size.\n"));
CORE_ADDR first, second;
enum exp_opcode binop;
struct value *val1, *val2;
+ struct type *stype, *utype;
second = dwarf_expr_fetch (ctx, 0);
dwarf_expr_pop (ctx);
first = dwarf_expr_fetch (ctx, 0);
dwarf_expr_pop (ctx);
- val1 = value_from_longest
- (unsigned_address_type (ctx->addr_size), first);
- val2 = value_from_longest
- (unsigned_address_type (ctx->addr_size), second);
+ utype = unsigned_address_type (ctx->gdbarch, ctx->addr_size);
+ stype = signed_address_type (ctx->gdbarch, ctx->addr_size);
+ val1 = value_from_longest (utype, first);
+ val2 = value_from_longest (utype, second);
switch (op)
{
break;
case DW_OP_shra:
binop = BINOP_RSH;
- val1 = value_from_longest
- (signed_address_type (ctx->addr_size), first);
+ val1 = value_from_longest (stype, first);
break;
case DW_OP_xor:
binop = BINOP_BITWISE_XOR;
if (reg >= first_fpr_regnum && reg <= last_fpr_regnum)
return builtin_type (gdbarch)->builtin_float;
else if (reg == iacc0_regnum)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
else
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static void
#include "gdb_assert.h"
#include "hashtab.h"
-/* These variables point to the objects
- representing the predefined C data types. */
-
-struct type *builtin_type_int0;
-struct type *builtin_type_int8;
-struct type *builtin_type_uint8;
-struct type *builtin_type_int16;
-struct type *builtin_type_uint16;
-struct type *builtin_type_int32;
-struct type *builtin_type_uint32;
-struct type *builtin_type_int64;
-struct type *builtin_type_uint64;
-struct type *builtin_type_int128;
-struct type *builtin_type_uint128;
/* Floatformat pairs. */
const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = {
TYPE_FLAG_UNSIGNED,
"true character", (struct objfile *) NULL);
+ /* Fixed-size integer types. */
+ builtin_type->builtin_int0 =
+ init_type (TYPE_CODE_INT, 0 / 8,
+ 0,
+ "int0_t", (struct objfile *) NULL);
+ builtin_type->builtin_int8 =
+ init_type (TYPE_CODE_INT, 8 / 8,
+ TYPE_FLAG_NOTTEXT,
+ "int8_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint8 =
+ init_type (TYPE_CODE_INT, 8 / 8,
+ TYPE_FLAG_UNSIGNED | TYPE_FLAG_NOTTEXT,
+ "uint8_t", (struct objfile *) NULL);
+ builtin_type->builtin_int16 =
+ init_type (TYPE_CODE_INT, 16 / 8,
+ 0,
+ "int16_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint16 =
+ init_type (TYPE_CODE_INT, 16 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint16_t", (struct objfile *) NULL);
+ builtin_type->builtin_int32 =
+ init_type (TYPE_CODE_INT, 32 / 8,
+ 0,
+ "int32_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint32 =
+ init_type (TYPE_CODE_INT, 32 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint32_t", (struct objfile *) NULL);
+ builtin_type->builtin_int64 =
+ init_type (TYPE_CODE_INT, 64 / 8,
+ 0,
+ "int64_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint64 =
+ init_type (TYPE_CODE_INT, 64 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint64_t", (struct objfile *) NULL);
+ builtin_type->builtin_int128 =
+ init_type (TYPE_CODE_INT, 128 / 8,
+ 0,
+ "int128_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint128 =
+ init_type (TYPE_CODE_INT, 128 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint128_t", (struct objfile *) NULL);
+
/* Default data/code pointer types. */
builtin_type->builtin_data_ptr =
make_pointer_type (builtin_type->builtin_void, NULL);
caching pointer or reference types that *are* architecture
dependent. */
- builtin_type_int0 =
- init_type (TYPE_CODE_INT, 0 / 8,
- 0,
- "int0_t", (struct objfile *) NULL);
- builtin_type_int8 =
- init_type (TYPE_CODE_INT, 8 / 8,
- TYPE_FLAG_NOTTEXT,
- "int8_t", (struct objfile *) NULL);
- builtin_type_uint8 =
- init_type (TYPE_CODE_INT, 8 / 8,
- TYPE_FLAG_UNSIGNED | TYPE_FLAG_NOTTEXT,
- "uint8_t", (struct objfile *) NULL);
- builtin_type_int16 =
- init_type (TYPE_CODE_INT, 16 / 8,
- 0,
- "int16_t", (struct objfile *) NULL);
- builtin_type_uint16 =
- init_type (TYPE_CODE_INT, 16 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint16_t", (struct objfile *) NULL);
- builtin_type_int32 =
- init_type (TYPE_CODE_INT, 32 / 8,
- 0,
- "int32_t", (struct objfile *) NULL);
- builtin_type_uint32 =
- init_type (TYPE_CODE_INT, 32 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint32_t", (struct objfile *) NULL);
- builtin_type_int64 =
- init_type (TYPE_CODE_INT, 64 / 8,
- 0,
- "int64_t", (struct objfile *) NULL);
- builtin_type_uint64 =
- init_type (TYPE_CODE_INT, 64 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint64_t", (struct objfile *) NULL);
- builtin_type_int128 =
- init_type (TYPE_CODE_INT, 128 / 8,
- 0,
- "int128_t", (struct objfile *) NULL);
- builtin_type_uint128 =
- init_type (TYPE_CODE_INT, 128 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint128_t", (struct objfile *) NULL);
-
builtin_type_ieee_single =
build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single);
builtin_type_ieee_double =
struct type *builtin_true_char;
struct type *builtin_true_unsigned_char;
+ /* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
+ is for when an architecture needs to describe a register that has
+ no size. */
+ struct type *builtin_int0;
+ struct type *builtin_int8;
+ struct type *builtin_uint8;
+ struct type *builtin_int16;
+ struct type *builtin_uint16;
+ struct type *builtin_int32;
+ struct type *builtin_uint32;
+ struct type *builtin_int64;
+ struct type *builtin_uint64;
+ struct type *builtin_int128;
+ struct type *builtin_uint128;
+
/* Pointer types. */
extern const struct objfile_type *objfile_type (struct objfile *objfile);
-/* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
- is for when an architecture needs to describe a register that has
- no size. */
-extern struct type *builtin_type_int0;
-extern struct type *builtin_type_int8;
-extern struct type *builtin_type_uint8;
-extern struct type *builtin_type_int16;
-extern struct type *builtin_type_uint16;
-extern struct type *builtin_type_int32;
-extern struct type *builtin_type_uint32;
-extern struct type *builtin_type_int64;
-extern struct type *builtin_type_uint64;
-extern struct type *builtin_type_int128;
-extern struct type *builtin_type_uint128;
-
/* Explicit floating-point formats. See "floatformat.h". */
extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
return builtin_type (gdbarch)->builtin_data_ptr;
default:
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else if (is_h8300hmode (gdbarch))
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
- return builtin_type_int16;
+ return builtin_type (gdbarch)->builtin_int16;
}
}
}
safely sign-extend them. */
if (len < 8)
{
- arg = value_cast (builtin_type_int64, arg);
+ arg = value_cast (builtin_type (gdbarch)->builtin_int64, arg);
len = 8;
}
}
hppa32_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum < HPPA_FP4_REGNUM)
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else
return builtin_type_ieee_single;
}
hppa64_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum < HPPA64_FP4_REGNUM)
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
else
return builtin_type_ieee_double;
}
if (!tdep->i386_mmx_type)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this: */
#if 0
union __gdb_builtin_type_vec64i
struct type *t;
t = init_composite_type ("__gdb_builtin_type_vec64i", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint64", builtin_type_int64);
+
+ append_composite_type_field (t, "uint64", bt->builtin_int64);
append_composite_type_field (t, "v2_int32",
- init_vector_type (builtin_type_int32, 2));
+ init_vector_type (bt->builtin_int32, 2));
append_composite_type_field (t, "v4_int16",
- init_vector_type (builtin_type_int16, 4));
+ init_vector_type (bt->builtin_int16, 4));
append_composite_type_field (t, "v8_int8",
- init_vector_type (builtin_type_int8, 8));
+ init_vector_type (bt->builtin_int8, 8));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec64i";
if (!tdep->i386_sse_type)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this: */
#if 0
union __gdb_builtin_type_vec128i
t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_float, 4));
+ init_vector_type (bt->builtin_float, 4));
append_composite_type_field (t, "v2_double",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_double, 2));
+ init_vector_type (bt->builtin_double, 2));
append_composite_type_field (t, "v16_int8",
- init_vector_type (builtin_type_int8, 16));
+ init_vector_type (bt->builtin_int8, 16));
append_composite_type_field (t, "v8_int16",
- init_vector_type (builtin_type_int16, 8));
+ init_vector_type (bt->builtin_int16, 8));
append_composite_type_field (t, "v4_int32",
- init_vector_type (builtin_type_int32, 4));
+ init_vector_type (bt->builtin_int32, 4));
append_composite_type_field (t, "v2_int64",
- init_vector_type (builtin_type_int64, 2));
- append_composite_type_field (t, "uint128", builtin_type_int128);
+ init_vector_type (bt->builtin_int64, 2));
+ append_composite_type_field (t, "uint128", bt->builtin_int128);
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec128i";
static struct type *
iq2000_register_type (struct gdbarch *gdbarch, int regnum)
{
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static CORE_ADDR
}
/* If the type is bigger than a 32-bit signed integer can be, implicitly
- promote to long. Java does not do this, so mark it as builtin_type_uint64
- rather than parse_java_type->builtin_long. 0x80000000 will become
- -0x80000000 instead of 0x80000000L, because we don't know the sign
- at this point. */
+ promote to long. Java does not do this, so mark it as
+ parse_type->builtin_uint64 rather than parse_java_type->builtin_long.
+ 0x80000000 will become -0x80000000 instead of 0x80000000L, because we
+ don't know the sign at this point. */
if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000)
- type = builtin_type_uint64;
+ type = parse_type->builtin_uint64;
putithere->typed_val_int.val = n;
putithere->typed_val_int.type = type;
static struct type *
lm32_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
/* Return non-zero if a register can't be written. */
case TYPE_CODE_ENUM:
if (TYPE_LENGTH (arg_type) < 4)
{
- arg_type = builtin_type_int32;
+ arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg);
}
break;
else if (reg_nr == M32R_SP_REGNUM || reg_nr == M32R_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
if (regno == M68HC12_HARD_PC_REGNUM)
{
ULONGEST pc;
- const int regsize = TYPE_LENGTH (builtin_type_uint32);
+ const int regsize = 4;
regcache_cooked_read_unsigned (regcache, HARD_PC_REGNUM, &pc);
if (pc >= 0x8000 && pc < 0xc000)
addressing mode. */
if (regno == M68HC12_HARD_PC_REGNUM)
{
- const int regsize = TYPE_LENGTH (builtin_type_uint32);
+ const int regsize = 4;
char *tmp = alloca (regsize);
CORE_ADDR pc;
case HARD_A_REGNUM:
case HARD_B_REGNUM:
case HARD_CCR_REGNUM:
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
case M68HC12_HARD_PC_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
default:
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
}
}
return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
else
{
if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM)
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
}
if (regnum == gdbarch_pc_regnum (gdbarch))
if (regnum == M68K_PS_REGNUM)
return m68k_ps_type;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static const char *m68k_register_names[] = {
if (regnum == M88K_R30_REGNUM || regnum == M88K_R31_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
\f
m88k_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_register_words = 0;
int num_stack_words = 0;
int i;
if (m88k_integral_or_pointer_p (type) && len < 4)
{
- args[i] = value_cast (builtin_type_int32, args[i]);
+ args[i] = value_cast (builtin_type (gdbarch)->builtin_int32,
+ args[i]);
type = value_type (args[i]);
len = TYPE_LENGTH (type);
}
keep the 'g' packet format fixed), and the pseudoregisters vary
in length. */
if (IS_RAW_CR_REGNUM (reg_nr))
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
/* Since GDB doesn't allow registers to change type, we have two
banks of pseudoregisters for the coprocessor general-purpose
if (mep_pseudo_cr_is_float (reg_nr))
return builtin_type (gdbarch)->builtin_float;
else
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
else if (size == 64)
{
if (mep_pseudo_cr_is_float (reg_nr))
return builtin_type (gdbarch)->builtin_double;
else
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
}
else
gdb_assert (0);
/* All other registers are 32 bits long. */
else
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
void
mi_cmd_data_read_memory (char *command, char **argv, int argc)
{
+ struct gdbarch *gdbarch = current_gdbarch;
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
CORE_ADDR addr;
long total_bytes;
switch (word_size)
{
case 1:
- word_type = builtin_type_int8;
+ word_type = builtin_type (gdbarch)->builtin_int8;
word_asize = 'b';
break;
case 2:
- word_type = builtin_type_int16;
+ word_type = builtin_type (gdbarch)->builtin_int16;
word_asize = 'h';
break;
case 4:
- word_type = builtin_type_int32;
+ word_type = builtin_type (gdbarch)->builtin_int32;
word_asize = 'w';
break;
case 8:
- word_type = builtin_type_int64;
+ word_type = builtin_type (gdbarch)->builtin_int64;
word_asize = 'g';
break;
default:
- word_type = builtin_type_int8;
+ word_type = builtin_type (gdbarch)->builtin_int8;
word_asize = 'b';
}
/* The number of rows. */
/* The raw or ISA registers. These are all sized according to
the ISA regsize. */
if (mips_isa_regsize (gdbarch) == 4)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
}
else
{
&& regnum <= gdbarch_num_regs (gdbarch) + MIPS_LAST_EMBED_REGNUM)
/* The pseudo/cooked view of the embedded registers is always
32-bit. The raw view is handled below. */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
/* The target, while possibly using a 64-bit register buffer,
is only transfering 32-bits of each integer register.
Reflect this in the cooked/pseudo (ABI) register value. */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else if (mips_abi_regsize (gdbarch) == 4)
/* The ABI is restricted to 32-bit registers (the ISA could be
32- or 64-bit). */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
/* 64-bit ABI. */
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
}
}
the necessary 32 bits, but older versions of GDB expected 64,
so allow the target to provide 64 bits without interfering
with the displayed type. */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
/* Use pointer types for registers if we can. For n32 we can not,
if (mips_abi_regsize (gdbarch) == 4 && TYPE_LENGTH (rawtype) == 8
&& rawnum >= MIPS_ZERO_REGNUM && rawnum <= MIPS_EMBED_PC_REGNUM)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
/* For all other registers, pass through the hardware type. */
return rawtype;
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
get_formatted_print_options (&opts, 'x');
- print_scalar_formatted (raw_buffer, builtin_type_uint32, &opts, 'w',
- file);
+ print_scalar_formatted (raw_buffer,
+ builtin_type (gdbarch)->builtin_uint32,
+ &opts, 'w', file);
fprintf_filtered (file, " flt: ");
if (inv1)
doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
get_formatted_print_options (&opts, 'x');
- print_scalar_formatted (raw_buffer, builtin_type_uint64, &opts, 'g',
- file);
+ print_scalar_formatted (raw_buffer,
+ builtin_type (gdbarch)->builtin_uint64,
+ &opts, 'g', file);
fprintf_filtered (file, " flt: ");
if (inv1)
else if (reg_nr == MOXIE_SP_REGNUM || reg_nr == MOXIE_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
/* Write into appropriate registers a function return value
* MT_COPRO_PSEUDOREG_DIM_2)
};
+/* The tdep structure. */
+struct gdbarch_tdep
+{
+ /* ISA-specific types. */
+ struct type *copro_type;
+};
+
+
/* Return name of register number specified by REGNUM. */
static const char *
case MT_QCHANNEL_REGNUM:
case MT_ISCRAMB_REGNUM:
case MT_QSCRAMB_REGNUM:
- return builtin_type_int32;
+ return builtin_type (arch)->builtin_int32;
case MT_BYPA_REGNUM:
case MT_BYPB_REGNUM:
case MT_BYPC_REGNUM:
case MT_OUT_REGNUM:
case MT_ZI2_REGNUM:
case MT_ZQ2_REGNUM:
- return builtin_type_int16;
+ return builtin_type (arch)->builtin_int16;
case MT_EXMAC_REGNUM:
case MT_MAC_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (arch)->builtin_uint32;
case MT_CONTEXT_REGNUM:
return builtin_type (arch)->builtin_long_long;
case MT_FLAG_REGNUM:
return builtin_type (arch)->builtin_unsigned_char;
default:
if (regnum >= MT_CPR0_REGNUM && regnum <= MT_CPR15_REGNUM)
- return builtin_type_int16;
+ return builtin_type (arch)->builtin_int16;
else if (regnum == MT_CPR0_REGNUM + MT_COPRO_PSEUDOREG_MAC_REGNUM)
{
if (gdbarch_bfd_arch_info (arch)->mach == bfd_mach_mrisc2
|| gdbarch_bfd_arch_info (arch)->mach == bfd_mach_ms2)
- return builtin_type_uint64;
+ return builtin_type (arch)->builtin_uint64;
else
- return builtin_type_uint32;
+ return builtin_type (arch)->builtin_uint32;
}
else
- return builtin_type_uint32;
+ return builtin_type (arch)->builtin_uint32;
}
}
static struct type *
mt_register_type (struct gdbarch *arch, int regnum)
{
- static struct type *copro_type = NULL;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
if (regnum >= 0 && regnum < MT_NUM_REGS + MT_NUM_PSEUDO_REGS)
{
- if (copro_type == NULL)
- copro_type = lookup_array_range_type (builtin_type_int16, 0, 1);
switch (regnum)
{
case MT_PC_REGNUM:
return builtin_type (arch)->builtin_data_ptr;
case MT_COPRO_REGNUM:
case MT_COPRO_PSEUDOREG_REGNUM:
- return copro_type;
+ if (tdep->copro_type == NULL)
+ {
+ struct type *elt = builtin_type (arch)->builtin_int16;
+ tdep->copro_type = lookup_array_range_type (elt, 0, 1);
+ }
+ return tdep->copro_type;
case MT_MAC_PSEUDOREG_REGNUM:
return mt_copro_register_type (arch,
MT_CPR0_REGNUM
+ MT_COPRO_PSEUDOREG_MAC_REGNUM);
default:
if (regnum >= MT_R0_REGNUM && regnum <= MT_R15_REGNUM)
- return builtin_type_int32;
+ return builtin_type (arch)->builtin_int32;
else if (regnum < MT_COPRO_PSEUDOREG_ARRAY)
return mt_copro_register_type (arch, regnum);
else
mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
+ struct gdbarch_tdep *tdep;
/* Find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
/* None found, create a new architecture from the information
provided. */
- gdbarch = gdbarch_alloc (&info, NULL);
+ tdep = XCALLOC (1, struct gdbarch_tdep);
+ gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
}
if (size == 'b')
- val_type = builtin_type_int8;
+ val_type = builtin_type (next_gdbarch)->builtin_int8;
else if (size == 'h')
- val_type = builtin_type_int16;
+ val_type = builtin_type (next_gdbarch)->builtin_int16;
else if (size == 'w')
- val_type = builtin_type_int32;
+ val_type = builtin_type (next_gdbarch)->builtin_int32;
else if (size == 'g')
- val_type = builtin_type_int64;
+ val_type = builtin_type (next_gdbarch)->builtin_int64;
maxelts = 8;
if (size == 'w')
if (!tdep->ppc_builtin_type_vec64)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this: */
#if 0
union __gdb_builtin_type_vec64
struct type *t;
t = init_composite_type ("__ppc_builtin_type_vec64", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint64", builtin_type_int64);
+ append_composite_type_field (t, "uint64", bt->builtin_int64);
append_composite_type_field (t, "v2_float",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_float, 2));
+ init_vector_type (bt->builtin_float, 2));
append_composite_type_field (t, "v2_int32",
- init_vector_type (builtin_type_int32, 2));
+ init_vector_type (bt->builtin_int32, 2));
append_composite_type_field (t, "v4_int16",
- init_vector_type (builtin_type_int16, 4));
+ init_vector_type (bt->builtin_int16, 4));
append_composite_type_field (t, "v8_int8",
- init_vector_type (builtin_type_int8, 8));
+ init_vector_type (bt->builtin_int8, 8));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec64";
if (!tdep->ppc_builtin_type_vec128)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this
type = union __ppc_builtin_type_vec128 {
struct type *t;
t = init_composite_type ("__ppc_builtin_type_vec128", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint128", builtin_type_uint128);
+ append_composite_type_field (t, "uint128", bt->builtin_uint128);
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type (gdbarch)->builtin_float, 4));
+ init_vector_type (bt->builtin_float, 4));
append_composite_type_field (t, "v4_int32",
- init_vector_type (builtin_type_int32, 4));
+ init_vector_type (bt->builtin_int32, 4));
append_composite_type_field (t, "v8_int16",
- init_vector_type (builtin_type_int16, 8));
+ init_vector_type (bt->builtin_int16, 8));
append_composite_type_field (t, "v16_int8",
- init_vector_type (builtin_type_int8, 16));
+ init_vector_type (bt->builtin_int8, 16));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec128";
score_register_type (struct gdbarch *gdbarch, int regnum)
{
gdb_assert (regnum >= 0 && regnum < SCORE_NUM_REGS);
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
static CORE_ADDR
if (regnum == SPARC32_FSR_REGNUM)
return sparc_fsr_type;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static void
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* Number of words in the "parameter array". */
int num_elements = 0;
int element = 0;
gdb_assert (sparc_integral_or_pointer_p (type));
if (len < 4)
- args[i] = value_cast (builtin_type_int32, args[i]);
+ args[i] = value_cast (builtin_type (gdbarch)->builtin_int32,
+ args[i]);
num_elements += ((len + 3) / 4);
}
}
if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= SPARC_G0_REGNUM && regnum <= SPARC_I7_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
return builtin_type (gdbarch)->builtin_float;
if (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)
/* This raw register contains the contents of %cwp, %pstate, %asi
and %ccr as laid out in a %tstate register. */
if (regnum == SPARC64_STATE_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_FSR_REGNUM)
return sparc64_fsr_type;
if (regnum == SPARC64_FPRS_REGNUM)
/* "Although Y is a 64-bit register, its high-order 32 bits are
reserved and always read as 0." */
if (regnum == SPARC64_Y_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
/* Pseudo registers. */
if (regnum == SPARC64_CWP_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_PSTATE_REGNUM)
return sparc64_pstate_type;
if (regnum == SPARC64_ASI_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_CCR_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
return builtin_type (gdbarch)->builtin_double;
if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
- args[i] = value_cast (builtin_type_int64, args[i]);
+ args[i] = value_cast (builtin_type (gdbarch)->builtin_int64,
+ args[i]);
num_elements++;
}
}
if (!tdep->spu_builtin_type_vec128)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
struct type *t;
t = init_composite_type ("__spu_builtin_type_vec128", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint128", builtin_type_int128);
+ append_composite_type_field (t, "uint128", bt->builtin_int128);
append_composite_type_field (t, "v2_int64",
- init_vector_type (builtin_type_int64, 2));
+ init_vector_type (bt->builtin_int64, 2));
append_composite_type_field (t, "v4_int32",
- init_vector_type (builtin_type_int32, 4));
+ init_vector_type (bt->builtin_int32, 4));
append_composite_type_field (t, "v8_int16",
- init_vector_type (builtin_type_int16, 8));
+ init_vector_type (bt->builtin_int16, 8));
append_composite_type_field (t, "v16_int8",
- init_vector_type (builtin_type_int8, 16));
+ init_vector_type (bt->builtin_int8, 16));
append_composite_type_field (t, "v2_double",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_double, 2));
+ init_vector_type (bt->builtin_double, 2));
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_float, 4));
+ init_vector_type (bt->builtin_float, 4));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "spu_builtin_type_vec128";
switch (reg_nr)
{
case SPU_ID_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_PC_REGNUM:
return builtin_type (gdbarch)->builtin_func_ptr;
return builtin_type (gdbarch)->builtin_data_ptr;
case SPU_FPSCR_REGNUM:
- return builtin_type_uint128;
+ return builtin_type (gdbarch)->builtin_uint128;
case SPU_SRR0_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_LSLR_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_DECR_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_DECR_STATUS_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
default:
internal_error (__FILE__, __LINE__, "invalid regnum");
{
/* Predefined types. */
case TDESC_TYPE_INT8:
- return builtin_type_int8;
+ return builtin_type (gdbarch)->builtin_int8;
case TDESC_TYPE_INT16:
- return builtin_type_int16;
+ return builtin_type (gdbarch)->builtin_int16;
case TDESC_TYPE_INT32:
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
case TDESC_TYPE_INT64:
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
case TDESC_TYPE_INT128:
- return builtin_type_int128;
+ return builtin_type (gdbarch)->builtin_int128;
case TDESC_TYPE_UINT8:
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
case TDESC_TYPE_UINT16:
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
case TDESC_TYPE_UINT32:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case TDESC_TYPE_UINT64:
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
case TDESC_TYPE_UINT128:
- return builtin_type_uint128;
+ return builtin_type (gdbarch)->builtin_uint128;
case TDESC_TYPE_CODE_PTR:
return builtin_type (gdbarch)->builtin_func_ptr;
if (reg == NULL)
/* Return "int0_t", since "void" has a misleading size of one. */
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
if (arch_reg->type == NULL)
{
{
if (regnum == E_PC_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static int
xstormy16_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == E_PC_REGNUM)
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
}
/* Function: xstormy16_type_is_scalar
/* Return the type of a register. Create a new type, if necessary. */
-static struct ctype_cache
-{
- struct ctype_cache *next;
- int size;
- struct type *virtual_type;
-} *type_entries = NULL;
-
static struct type *
xtensa_register_type (struct gdbarch *gdbarch, int regnum)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
/* Return signed integer for ARx and Ax registers. */
- if ((regnum >= gdbarch_tdep (gdbarch)->ar_base
- && regnum < gdbarch_tdep (gdbarch)->ar_base
- + gdbarch_tdep (gdbarch)->num_aregs)
- || (regnum >= gdbarch_tdep (gdbarch)->a0_base
- && regnum < gdbarch_tdep (gdbarch)->a0_base + 16))
+ if ((regnum >= tdep->ar_base
+ && regnum < tdep->ar_base + tdep->num_aregs)
+ || (regnum >= tdep->a0_base
+ && regnum < tdep->a0_base + 16))
return builtin_type (gdbarch)->builtin_int;
if (regnum == gdbarch_pc_regnum (gdbarch)
- || regnum == gdbarch_tdep (gdbarch)->a0_base + 1)
+ || regnum == tdep->a0_base + 1)
return builtin_type (gdbarch)->builtin_data_ptr;
/* Return the stored type for all other registers. */
else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch))
{
- xtensa_register_t* reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
+ xtensa_register_t* reg = &tdep->regmap[regnum];
/* Set ctype for this register (only the first time). */
switch (size)
{
case 1:
- reg->ctype = builtin_type_uint8;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint8;
break;
case 2:
- reg->ctype = builtin_type_uint16;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint16;
break;
case 4:
- reg->ctype = builtin_type_uint32;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint32;
break;
case 8:
- reg->ctype = builtin_type_uint64;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint64;
break;
case 16:
- reg->ctype = builtin_type_uint128;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint128;
break;
default:
- for (tp = type_entries; tp != NULL; tp = tp->next)
+ for (tp = tdep->type_entries; tp != NULL; tp = tp->next)
if (tp->size == size)
break;
{
char *name = xmalloc (16);
tp = xmalloc (sizeof (struct ctype_cache));
- tp->next = type_entries;
- type_entries = tp;
+ tp->next = tdep->type_entries;
+ tdep->type_entries = tp;
tp->size = size;
sprintf (name, "int%d", size * 8);
unsigned long *fp_layout; /* Layout of custom/TIE regs in 'FP' area. */
unsigned int fp_layout_bytes; /* Size of layout information (in bytes). */
unsigned long *gregmap;
+
+ /* Cached register types. */
+ struct ctype_cache
+ {
+ struct ctype_cache *next;
+ int size;
+ struct type *virtual_type;
+ } *type_entries;
};
/* Macro to instantiate a gdbarch_tdep structure. */