* 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.
This commit is contained in:
Ulrich Weigand 2009-07-02 12:46:19 +00:00
parent 69feb67608
commit df4df182b4
37 changed files with 353 additions and 263 deletions

View File

@ -1,3 +1,76 @@
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> 2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
* gdbtypes.h (builtin_type_true_char): Remove. * gdbtypes.h (builtin_type_true_char): Remove.

View File

@ -104,7 +104,7 @@ alpha_register_type (struct gdbarch *gdbarch, int regno)
if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31) if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31)
return builtin_type_ieee_double; return builtin_type_ieee_double;
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
} }
/* Is REGNUM a member of REGGROUP? */ /* Is REGNUM a member of REGGROUP? */
@ -298,12 +298,12 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
/* 32-bit values must be sign-extended to 64 bits /* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */ 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); arg = value_cast (arg_type, arg);
} }
if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE) 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); arg = value_cast (arg_type, arg);
} }
break; break;
@ -498,6 +498,7 @@ static void
alpha_store_return_value (struct type *valtype, struct regcache *regcache, alpha_store_return_value (struct type *valtype, struct regcache *regcache,
const gdb_byte *valbuf) const gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int length = TYPE_LENGTH (valtype); int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l; ULONGEST l;
@ -556,7 +557,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
/* 32-bit values must be sign-extended to 64 bits /* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */ even if the base data type is unsigned. */
if (length == 4) if (length == 4)
valtype = builtin_type_int32; valtype = builtin_type (gdbarch)->builtin_int32;
l = unpack_long (valtype, valbuf); l = unpack_long (valtype, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l); regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
break; break;

View File

@ -218,7 +218,7 @@ static struct type *
amd64_linux_register_type (struct gdbarch *gdbarch, int reg) amd64_linux_register_type (struct gdbarch *gdbarch, int reg)
{ {
if (reg == AMD64_LINUX_ORIG_RAX_REGNUM) if (reg == AMD64_LINUX_ORIG_RAX_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
return amd64_register_type (gdbarch, reg); return amd64_register_type (gdbarch, reg);
} }

View File

@ -90,21 +90,21 @@ struct type *
amd64_register_type (struct gdbarch *gdbarch, int regnum) amd64_register_type (struct gdbarch *gdbarch, int regnum)
{ {
if (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_RDI_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) if (regnum == AMD64_RBP_REGNUM || regnum == AMD64_RSP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM) if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
if (regnum == AMD64_RIP_REGNUM) if (regnum == AMD64_RIP_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr; return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == AMD64_EFLAGS_REGNUM) if (regnum == AMD64_EFLAGS_REGNUM)
return i386_eflags_type; return i386_eflags_type;
if (regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM) 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) if (regnum >= AMD64_ST0_REGNUM && regnum <= AMD64_ST0_REGNUM + 7)
return builtin_type_i387_ext; return builtin_type_i387_ext;
if (regnum >= AMD64_FCTRL_REGNUM && regnum <= AMD64_FCTRL_REGNUM + 7) 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) if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
return i386_sse_type (gdbarch); return i386_sse_type (gdbarch);
if (regnum == AMD64_MXCSR_REGNUM) if (regnum == AMD64_MXCSR_REGNUM)

View File

@ -1608,9 +1608,9 @@ arm_register_type (struct gdbarch *gdbarch, int regnum)
else if (regnum >= ARRAY_SIZE (arm_register_names)) else if (regnum >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply /* These registers are only supported on targets which supply
an XML description. */ an XML description. */
return builtin_type_int0; return builtin_type (gdbarch)->builtin_int0;
else else
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
} }
/* Map a DWARF register REGNUM onto the appropriate GDB register /* Map a DWARF register REGNUM onto the appropriate GDB register

View File

@ -212,11 +212,11 @@ static struct type *
avr_register_type (struct gdbarch *gdbarch, int reg_nr) avr_register_type (struct gdbarch *gdbarch, int reg_nr)
{ {
if (reg_nr == AVR_PC_REGNUM) if (reg_nr == AVR_PC_REGNUM)
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
if (reg_nr == AVR_SP_REGNUM) if (reg_nr == AVR_SP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
else else
return builtin_type_uint8; return builtin_type (gdbarch)->builtin_uint8;
} }
/* Instruction address checks and convertions. */ /* Instruction address checks and convertions. */

View File

@ -1657,14 +1657,14 @@ cris_register_type (struct gdbarch *gdbarch, int regno)
else if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch)) else if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
|| (regno >= MOF_REGNUM && regno <= USP_REGNUM)) || (regno >= MOF_REGNUM && regno <= USP_REGNUM))
/* Note: R8 taken care of previous clause. */ /* 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) 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) else if (regno >= P0_REGNUM && regno <= VR_REGNUM)
return builtin_type_uint8; return builtin_type (gdbarch)->builtin_uint8;
else else
/* Invalid (unimplemented) register. */ /* Invalid (unimplemented) register. */
return builtin_type_int0; return builtin_type (gdbarch)->builtin_int0;
} }
static struct type * static struct type *
@ -1680,17 +1680,17 @@ crisv32_register_type (struct gdbarch *gdbarch, int regno)
|| (regno == PID_REGNUM) || (regno == PID_REGNUM)
|| (regno >= S0_REGNUM && regno <= S15_REGNUM)) || (regno >= S0_REGNUM && regno <= S15_REGNUM))
/* Note: R8 and SP taken care of by previous clause. */ /* 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) 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) else if (regno == BZ_REGNUM || regno == VR_REGNUM || regno == SRS_REGNUM)
return builtin_type_uint8; return builtin_type (gdbarch)->builtin_uint8;
else else
{ {
/* Invalid (unimplemented) register. Should not happen as there are /* Invalid (unimplemented) register. Should not happen as there are
no unimplemented CRISv32 registers. */ no unimplemented CRISv32 registers. */
warning (_("crisv32_register_type: unknown regno %d"), regno); warning (_("crisv32_register_type: unknown regno %d"), regno);
return builtin_type_int0; return builtin_type (gdbarch)->builtin_int0;
} }
} }

View File

@ -33,7 +33,7 @@
static void execute_stack_op (struct dwarf_expr_context *, static void execute_stack_op (struct dwarf_expr_context *,
gdb_byte *, gdb_byte *); 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. */ /* Create a new context for the expression evaluator. */
@ -225,7 +225,7 @@ dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
if (gdbarch_integer_to_address_p (gdbarch)) if (gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address 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); return extract_unsigned_integer (buf, addr_size);
} }
@ -234,16 +234,16 @@ dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
for unsigned arithmetic. */ for unsigned arithmetic. */
static struct type * static struct type *
unsigned_address_type (int addr_size) unsigned_address_type (struct gdbarch *gdbarch, int addr_size)
{ {
switch (addr_size) switch (addr_size)
{ {
case 2: case 2:
return builtin_type_uint16; return builtin_type (gdbarch)->builtin_uint16;
case 4: case 4:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
case 8: case 8:
return builtin_type_uint64; return builtin_type (gdbarch)->builtin_uint64;
default: default:
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("Unsupported address size.\n")); _("Unsupported address size.\n"));
@ -254,16 +254,16 @@ unsigned_address_type (int addr_size)
for signed arithmetic. */ for signed arithmetic. */
static struct type * static struct type *
signed_address_type (int addr_size) signed_address_type (struct gdbarch *gdbarch, int addr_size)
{ {
switch (addr_size) switch (addr_size)
{ {
case 2: case 2:
return builtin_type_int16; return builtin_type (gdbarch)->builtin_int16;
case 4: case 4:
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
case 8: case 8:
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
default: default:
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("Unsupported address size.\n")); _("Unsupported address size.\n"));
@ -622,6 +622,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
CORE_ADDR first, second; CORE_ADDR first, second;
enum exp_opcode binop; enum exp_opcode binop;
struct value *val1, *val2; struct value *val1, *val2;
struct type *stype, *utype;
second = dwarf_expr_fetch (ctx, 0); second = dwarf_expr_fetch (ctx, 0);
dwarf_expr_pop (ctx); dwarf_expr_pop (ctx);
@ -629,10 +630,10 @@ execute_stack_op (struct dwarf_expr_context *ctx,
first = dwarf_expr_fetch (ctx, 0); first = dwarf_expr_fetch (ctx, 0);
dwarf_expr_pop (ctx); dwarf_expr_pop (ctx);
val1 = value_from_longest utype = unsigned_address_type (ctx->gdbarch, ctx->addr_size);
(unsigned_address_type (ctx->addr_size), first); stype = signed_address_type (ctx->gdbarch, ctx->addr_size);
val2 = value_from_longest val1 = value_from_longest (utype, first);
(unsigned_address_type (ctx->addr_size), second); val2 = value_from_longest (utype, second);
switch (op) switch (op)
{ {
@ -665,8 +666,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
break; break;
case DW_OP_shra: case DW_OP_shra:
binop = BINOP_RSH; binop = BINOP_RSH;
val1 = value_from_longest val1 = value_from_longest (stype, first);
(signed_address_type (ctx->addr_size), first);
break; break;
case DW_OP_xor: case DW_OP_xor:
binop = BINOP_BITWISE_XOR; binop = BINOP_BITWISE_XOR;

View File

@ -294,9 +294,9 @@ frv_register_type (struct gdbarch *gdbarch, int reg)
if (reg >= first_fpr_regnum && reg <= last_fpr_regnum) if (reg >= first_fpr_regnum && reg <= last_fpr_regnum)
return builtin_type (gdbarch)->builtin_float; return builtin_type (gdbarch)->builtin_float;
else if (reg == iacc0_regnum) else if (reg == iacc0_regnum)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
else else
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
static void static void

View File

@ -39,20 +39,6 @@
#include "gdb_assert.h" #include "gdb_assert.h"
#include "hashtab.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. */ /* Floatformat pairs. */
const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = { const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = {
@ -3196,6 +3182,52 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
TYPE_FLAG_UNSIGNED, TYPE_FLAG_UNSIGNED,
"true character", (struct objfile *) NULL); "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. */ /* Default data/code pointer types. */
builtin_type->builtin_data_ptr = builtin_type->builtin_data_ptr =
make_pointer_type (builtin_type->builtin_void, NULL); make_pointer_type (builtin_type->builtin_void, NULL);
@ -3375,51 +3407,6 @@ _initialize_gdbtypes (void)
caching pointer or reference types that *are* architecture caching pointer or reference types that *are* architecture
dependent. */ 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 = builtin_type_ieee_single =
build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single); build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single);
builtin_type_ieee_double = builtin_type_ieee_double =

View File

@ -990,6 +990,21 @@ struct builtin_type
struct type *builtin_true_char; struct type *builtin_true_char;
struct type *builtin_true_unsigned_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. */ /* Pointer types. */
@ -1056,21 +1071,6 @@ struct objfile_type
extern const struct objfile_type *objfile_type (struct objfile *objfile); 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". */ /* Explicit floating-point formats. See "floatformat.h". */
extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]; extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]; extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];

View File

@ -1119,13 +1119,13 @@ h8300_register_type (struct gdbarch *gdbarch, int regno)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
default: default:
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch)) 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)) else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
return builtin_type_uint8; return builtin_type (gdbarch)->builtin_uint8;
else if (is_h8300hmode (gdbarch)) else if (is_h8300hmode (gdbarch))
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
else else
return builtin_type_int16; return builtin_type (gdbarch)->builtin_int16;
} }
} }
} }

View File

@ -975,7 +975,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
safely sign-extend them. */ safely sign-extend them. */
if (len < 8) if (len < 8)
{ {
arg = value_cast (builtin_type_int64, arg); arg = value_cast (builtin_type (gdbarch)->builtin_int64, arg);
len = 8; len = 8;
} }
} }
@ -2610,7 +2610,7 @@ static struct type *
hppa32_register_type (struct gdbarch *gdbarch, int regnum) hppa32_register_type (struct gdbarch *gdbarch, int regnum)
{ {
if (regnum < HPPA_FP4_REGNUM) if (regnum < HPPA_FP4_REGNUM)
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
else else
return builtin_type_ieee_single; return builtin_type_ieee_single;
} }
@ -2619,7 +2619,7 @@ static struct type *
hppa64_register_type (struct gdbarch *gdbarch, int regnum) hppa64_register_type (struct gdbarch *gdbarch, int regnum)
{ {
if (regnum < HPPA64_FP4_REGNUM) if (regnum < HPPA64_FP4_REGNUM)
return builtin_type_uint64; return builtin_type (gdbarch)->builtin_uint64;
else else
return builtin_type_ieee_double; return builtin_type_ieee_double;
} }

View File

@ -2052,6 +2052,8 @@ i386_mmx_type (struct gdbarch *gdbarch)
if (!tdep->i386_mmx_type) if (!tdep->i386_mmx_type)
{ {
const struct builtin_type *bt = builtin_type (gdbarch);
/* The type we're building is this: */ /* The type we're building is this: */
#if 0 #if 0
union __gdb_builtin_type_vec64i union __gdb_builtin_type_vec64i
@ -2066,13 +2068,14 @@ i386_mmx_type (struct gdbarch *gdbarch)
struct type *t; struct type *t;
t = init_composite_type ("__gdb_builtin_type_vec64i", TYPE_CODE_UNION); 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", 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", 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", 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_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec64i"; TYPE_NAME (t) = "builtin_type_vec64i";
@ -2089,6 +2092,8 @@ i386_sse_type (struct gdbarch *gdbarch)
if (!tdep->i386_sse_type) if (!tdep->i386_sse_type)
{ {
const struct builtin_type *bt = builtin_type (gdbarch);
/* The type we're building is this: */ /* The type we're building is this: */
#if 0 #if 0
union __gdb_builtin_type_vec128i union __gdb_builtin_type_vec128i
@ -2107,20 +2112,18 @@ i386_sse_type (struct gdbarch *gdbarch)
t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION); t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
append_composite_type_field (t, "v4_float", append_composite_type_field (t, "v4_float",
init_vector_type (builtin_type (gdbarch) init_vector_type (bt->builtin_float, 4));
->builtin_float, 4));
append_composite_type_field (t, "v2_double", append_composite_type_field (t, "v2_double",
init_vector_type (builtin_type (gdbarch) init_vector_type (bt->builtin_double, 2));
->builtin_double, 2));
append_composite_type_field (t, "v16_int8", 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", 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", 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", 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, "uint128", builtin_type_int128); append_composite_type_field (t, "uint128", bt->builtin_int128);
TYPE_VECTOR (t) = 1; TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec128i"; TYPE_NAME (t) = "builtin_type_vec128i";

View File

@ -587,7 +587,7 @@ iq2000_return_value (struct gdbarch *gdbarch, struct type *func_type,
static struct type * static struct type *
iq2000_register_type (struct gdbarch *gdbarch, int regnum) iq2000_register_type (struct gdbarch *gdbarch, int regnum)
{ {
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
static CORE_ADDR static CORE_ADDR

View File

@ -795,12 +795,12 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
} }
/* If the type is bigger than a 32-bit signed integer can be, implicitly /* 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 promote to long. Java does not do this, so mark it as
rather than parse_java_type->builtin_long. 0x80000000 will become parse_type->builtin_uint64 rather than parse_java_type->builtin_long.
-0x80000000 instead of 0x80000000L, because we don't know the sign 0x80000000 will become -0x80000000 instead of 0x80000000L, because we
at this point. */ don't know the sign at this point. */
if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000) 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.val = n;
putithere->typed_val_int.type = type; putithere->typed_val_int.type = type;

View File

@ -111,7 +111,7 @@ lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
static struct type * static struct type *
lm32_register_type (struct gdbarch *gdbarch, int reg_nr) 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. */ /* Return non-zero if a register can't be written. */
@ -273,7 +273,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
case TYPE_CODE_ENUM: case TYPE_CODE_ENUM:
if (TYPE_LENGTH (arg_type) < 4) if (TYPE_LENGTH (arg_type) < 4)
{ {
arg_type = builtin_type_int32; arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg); arg = value_cast (arg_type, arg);
} }
break; break;

View File

@ -235,7 +235,7 @@ m32r_register_type (struct gdbarch *gdbarch, int reg_nr)
else if (reg_nr == M32R_SP_REGNUM || reg_nr == M32R_FP_REGNUM) else if (reg_nr == M32R_SP_REGNUM || reg_nr == M32R_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
else else
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }

View File

@ -289,7 +289,7 @@ m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
if (regno == M68HC12_HARD_PC_REGNUM) if (regno == M68HC12_HARD_PC_REGNUM)
{ {
ULONGEST pc; ULONGEST pc;
const int regsize = TYPE_LENGTH (builtin_type_uint32); const int regsize = 4;
regcache_cooked_read_unsigned (regcache, HARD_PC_REGNUM, &pc); regcache_cooked_read_unsigned (regcache, HARD_PC_REGNUM, &pc);
if (pc >= 0x8000 && pc < 0xc000) if (pc >= 0x8000 && pc < 0xc000)
@ -329,7 +329,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
addressing mode. */ addressing mode. */
if (regno == M68HC12_HARD_PC_REGNUM) if (regno == M68HC12_HARD_PC_REGNUM)
{ {
const int regsize = TYPE_LENGTH (builtin_type_uint32); const int regsize = 4;
char *tmp = alloca (regsize); char *tmp = alloca (regsize);
CORE_ADDR pc; CORE_ADDR pc;
@ -1239,13 +1239,13 @@ m68hc11_register_type (struct gdbarch *gdbarch, int reg_nr)
case HARD_A_REGNUM: case HARD_A_REGNUM:
case HARD_B_REGNUM: case HARD_B_REGNUM:
case HARD_CCR_REGNUM: case HARD_CCR_REGNUM:
return builtin_type_uint8; return builtin_type (gdbarch)->builtin_uint8;
case M68HC12_HARD_PC_REGNUM: case M68HC12_HARD_PC_REGNUM:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
default: default:
return builtin_type_uint16; return builtin_type (gdbarch)->builtin_uint16;
} }
} }

View File

@ -124,12 +124,12 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_func_ptr; return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM) if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM)
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
else else
{ {
if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM) 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 == gdbarch_pc_regnum (gdbarch))
@ -141,7 +141,7 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == M68K_PS_REGNUM) if (regnum == M68K_PS_REGNUM)
return m68k_ps_type; return m68k_ps_type;
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
static const char *m68k_register_names[] = { static const char *m68k_register_names[] = {

View File

@ -81,7 +81,7 @@ m88k_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == M88K_R30_REGNUM || regnum == M88K_R31_REGNUM) if (regnum == M88K_R30_REGNUM || regnum == M88K_R31_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
@ -258,6 +258,7 @@ static CORE_ADDR
m88k_store_arguments (struct regcache *regcache, int nargs, m88k_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp) struct value **args, CORE_ADDR sp)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_register_words = 0; int num_register_words = 0;
int num_stack_words = 0; int num_stack_words = 0;
int i; int i;
@ -269,7 +270,8 @@ m88k_store_arguments (struct regcache *regcache, int nargs,
if (m88k_integral_or_pointer_p (type) && len < 4) 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]); type = value_type (args[i]);
len = TYPE_LENGTH (type); len = TYPE_LENGTH (type);
} }

View File

@ -1084,7 +1084,7 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
keep the 'g' packet format fixed), and the pseudoregisters vary keep the 'g' packet format fixed), and the pseudoregisters vary
in length. */ in length. */
if (IS_RAW_CR_REGNUM (reg_nr)) 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 /* Since GDB doesn't allow registers to change type, we have two
banks of pseudoregisters for the coprocessor general-purpose banks of pseudoregisters for the coprocessor general-purpose
@ -1099,14 +1099,14 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
if (mep_pseudo_cr_is_float (reg_nr)) if (mep_pseudo_cr_is_float (reg_nr))
return builtin_type (gdbarch)->builtin_float; return builtin_type (gdbarch)->builtin_float;
else else
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
} }
else if (size == 64) else if (size == 64)
{ {
if (mep_pseudo_cr_is_float (reg_nr)) if (mep_pseudo_cr_is_float (reg_nr))
return builtin_type (gdbarch)->builtin_double; return builtin_type (gdbarch)->builtin_double;
else else
return builtin_type_uint64; return builtin_type (gdbarch)->builtin_uint64;
} }
else else
gdb_assert (0); gdb_assert (0);
@ -1114,7 +1114,7 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
/* All other registers are 32 bits long. */ /* All other registers are 32 bits long. */
else else
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
} }

View File

@ -828,6 +828,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
void void
mi_cmd_data_read_memory (char *command, char **argv, int argc) mi_cmd_data_read_memory (char *command, char **argv, int argc)
{ {
struct gdbarch *gdbarch = current_gdbarch;
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
CORE_ADDR addr; CORE_ADDR addr;
long total_bytes; long total_bytes;
@ -884,23 +885,23 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
switch (word_size) switch (word_size)
{ {
case 1: case 1:
word_type = builtin_type_int8; word_type = builtin_type (gdbarch)->builtin_int8;
word_asize = 'b'; word_asize = 'b';
break; break;
case 2: case 2:
word_type = builtin_type_int16; word_type = builtin_type (gdbarch)->builtin_int16;
word_asize = 'h'; word_asize = 'h';
break; break;
case 4: case 4:
word_type = builtin_type_int32; word_type = builtin_type (gdbarch)->builtin_int32;
word_asize = 'w'; word_asize = 'w';
break; break;
case 8: case 8:
word_type = builtin_type_int64; word_type = builtin_type (gdbarch)->builtin_int64;
word_asize = 'g'; word_asize = 'g';
break; break;
default: default:
word_type = builtin_type_int8; word_type = builtin_type (gdbarch)->builtin_int8;
word_asize = 'b'; word_asize = 'b';
} }
/* The number of rows. */ /* The number of rows. */

View File

@ -679,9 +679,9 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
/* The raw or ISA registers. These are all sized according to /* The raw or ISA registers. These are all sized according to
the ISA regsize. */ the ISA regsize. */
if (mips_isa_regsize (gdbarch) == 4) if (mips_isa_regsize (gdbarch) == 4)
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
else else
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
} }
else else
{ {
@ -692,19 +692,19 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
&& regnum <= gdbarch_num_regs (gdbarch) + MIPS_LAST_EMBED_REGNUM) && regnum <= gdbarch_num_regs (gdbarch) + MIPS_LAST_EMBED_REGNUM)
/* The pseudo/cooked view of the embedded registers is always /* The pseudo/cooked view of the embedded registers is always
32-bit. The raw view is handled below. */ 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) else if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
/* The target, while possibly using a 64-bit register buffer, /* The target, while possibly using a 64-bit register buffer,
is only transfering 32-bits of each integer register. is only transfering 32-bits of each integer register.
Reflect this in the cooked/pseudo (ABI) register value. */ 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) else if (mips_abi_regsize (gdbarch) == 4)
/* The ABI is restricted to 32-bit registers (the ISA could be /* The ABI is restricted to 32-bit registers (the ISA could be
32- or 64-bit). */ 32- or 64-bit). */
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
else else
/* 64-bit ABI. */ /* 64-bit ABI. */
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
} }
} }
@ -741,7 +741,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
the necessary 32 bits, but older versions of GDB expected 64, the necessary 32 bits, but older versions of GDB expected 64,
so allow the target to provide 64 bits without interfering so allow the target to provide 64 bits without interfering
with the displayed type. */ 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, /* Use pointer types for registers if we can. For n32 we can not,
@ -757,7 +757,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (mips_abi_regsize (gdbarch) == 4 && TYPE_LENGTH (rawtype) == 8 if (mips_abi_regsize (gdbarch) == 4 && TYPE_LENGTH (rawtype) == 8
&& rawnum >= MIPS_ZERO_REGNUM && rawnum <= MIPS_EMBED_PC_REGNUM) && 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. */ /* For all other registers, pass through the hardware type. */
return rawtype; return rawtype;
@ -4396,8 +4396,9 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1); flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
get_formatted_print_options (&opts, 'x'); get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer, builtin_type_uint32, &opts, 'w', print_scalar_formatted (raw_buffer,
file); builtin_type (gdbarch)->builtin_uint32,
&opts, 'w', file);
fprintf_filtered (file, " flt: "); fprintf_filtered (file, " flt: ");
if (inv1) if (inv1)
@ -4430,8 +4431,9 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2); doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
get_formatted_print_options (&opts, 'x'); get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer, builtin_type_uint64, &opts, 'g', print_scalar_formatted (raw_buffer,
file); builtin_type (gdbarch)->builtin_uint64,
&opts, 'g', file);
fprintf_filtered (file, " flt: "); fprintf_filtered (file, " flt: ");
if (inv1) if (inv1)

View File

@ -110,7 +110,7 @@ moxie_register_type (struct gdbarch *gdbarch, int reg_nr)
else if (reg_nr == MOXIE_SP_REGNUM || reg_nr == MOXIE_FP_REGNUM) else if (reg_nr == MOXIE_SP_REGNUM || reg_nr == MOXIE_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
else else
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
/* Write into appropriate registers a function return value /* Write into appropriate registers a function return value

View File

@ -139,6 +139,14 @@ enum mt_gdb_regnums
* MT_COPRO_PSEUDOREG_DIM_2) * 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. */ /* Return name of register number specified by REGNUM. */
static const char * static const char *
@ -213,7 +221,7 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
case MT_QCHANNEL_REGNUM: case MT_QCHANNEL_REGNUM:
case MT_ISCRAMB_REGNUM: case MT_ISCRAMB_REGNUM:
case MT_QSCRAMB_REGNUM: case MT_QSCRAMB_REGNUM:
return builtin_type_int32; return builtin_type (arch)->builtin_int32;
case MT_BYPA_REGNUM: case MT_BYPA_REGNUM:
case MT_BYPB_REGNUM: case MT_BYPB_REGNUM:
case MT_BYPC_REGNUM: case MT_BYPC_REGNUM:
@ -222,27 +230,27 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
case MT_OUT_REGNUM: case MT_OUT_REGNUM:
case MT_ZI2_REGNUM: case MT_ZI2_REGNUM:
case MT_ZQ2_REGNUM: case MT_ZQ2_REGNUM:
return builtin_type_int16; return builtin_type (arch)->builtin_int16;
case MT_EXMAC_REGNUM: case MT_EXMAC_REGNUM:
case MT_MAC_REGNUM: case MT_MAC_REGNUM:
return builtin_type_uint32; return builtin_type (arch)->builtin_uint32;
case MT_CONTEXT_REGNUM: case MT_CONTEXT_REGNUM:
return builtin_type (arch)->builtin_long_long; return builtin_type (arch)->builtin_long_long;
case MT_FLAG_REGNUM: case MT_FLAG_REGNUM:
return builtin_type (arch)->builtin_unsigned_char; return builtin_type (arch)->builtin_unsigned_char;
default: default:
if (regnum >= MT_CPR0_REGNUM && regnum <= MT_CPR15_REGNUM) 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) else if (regnum == MT_CPR0_REGNUM + MT_COPRO_PSEUDOREG_MAC_REGNUM)
{ {
if (gdbarch_bfd_arch_info (arch)->mach == bfd_mach_mrisc2 if (gdbarch_bfd_arch_info (arch)->mach == bfd_mach_mrisc2
|| gdbarch_bfd_arch_info (arch)->mach == bfd_mach_ms2) || gdbarch_bfd_arch_info (arch)->mach == bfd_mach_ms2)
return builtin_type_uint64; return builtin_type (arch)->builtin_uint64;
else else
return builtin_type_uint32; return builtin_type (arch)->builtin_uint32;
} }
else else
return builtin_type_uint32; return builtin_type (arch)->builtin_uint32;
} }
} }
@ -252,12 +260,10 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
static struct type * static struct type *
mt_register_type (struct gdbarch *arch, int regnum) 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 (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) switch (regnum)
{ {
case MT_PC_REGNUM: case MT_PC_REGNUM:
@ -269,14 +275,19 @@ mt_register_type (struct gdbarch *arch, int regnum)
return builtin_type (arch)->builtin_data_ptr; return builtin_type (arch)->builtin_data_ptr;
case MT_COPRO_REGNUM: case MT_COPRO_REGNUM:
case MT_COPRO_PSEUDOREG_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: case MT_MAC_PSEUDOREG_REGNUM:
return mt_copro_register_type (arch, return mt_copro_register_type (arch,
MT_CPR0_REGNUM MT_CPR0_REGNUM
+ MT_COPRO_PSEUDOREG_MAC_REGNUM); + MT_COPRO_PSEUDOREG_MAC_REGNUM);
default: default:
if (regnum >= MT_R0_REGNUM && regnum <= MT_R15_REGNUM) 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) else if (regnum < MT_COPRO_PSEUDOREG_ARRAY)
return mt_copro_register_type (arch, regnum); return mt_copro_register_type (arch, regnum);
else else
@ -1098,6 +1109,7 @@ static struct gdbarch *
mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{ {
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* Find a candidate among the list of pre-declared architectures. */ /* Find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info); arches = gdbarch_list_lookup_by_info (arches, &info);
@ -1106,7 +1118,8 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, create a new architecture from the information /* None found, create a new architecture from the information
provided. */ 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_float_format (gdbarch, floatformats_ieee_single);
set_gdbarch_double_format (gdbarch, floatformats_ieee_double); set_gdbarch_double_format (gdbarch, floatformats_ieee_double);

View File

@ -781,13 +781,13 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
} }
if (size == 'b') if (size == 'b')
val_type = builtin_type_int8; val_type = builtin_type (next_gdbarch)->builtin_int8;
else if (size == 'h') else if (size == 'h')
val_type = builtin_type_int16; val_type = builtin_type (next_gdbarch)->builtin_int16;
else if (size == 'w') else if (size == 'w')
val_type = builtin_type_int32; val_type = builtin_type (next_gdbarch)->builtin_int32;
else if (size == 'g') else if (size == 'g')
val_type = builtin_type_int64; val_type = builtin_type (next_gdbarch)->builtin_int64;
maxelts = 8; maxelts = 8;
if (size == 'w') if (size == 'w')

View File

@ -2248,6 +2248,8 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
if (!tdep->ppc_builtin_type_vec64) if (!tdep->ppc_builtin_type_vec64)
{ {
const struct builtin_type *bt = builtin_type (gdbarch);
/* The type we're building is this: */ /* The type we're building is this: */
#if 0 #if 0
union __gdb_builtin_type_vec64 union __gdb_builtin_type_vec64
@ -2263,16 +2265,15 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
struct type *t; struct type *t;
t = init_composite_type ("__ppc_builtin_type_vec64", TYPE_CODE_UNION); 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", append_composite_type_field (t, "v2_float",
init_vector_type (builtin_type (gdbarch) init_vector_type (bt->builtin_float, 2));
->builtin_float, 2));
append_composite_type_field (t, "v2_int32", 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", 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", 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_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec64"; TYPE_NAME (t) = "ppc_builtin_type_vec64";
@ -2291,6 +2292,8 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
if (!tdep->ppc_builtin_type_vec128) if (!tdep->ppc_builtin_type_vec128)
{ {
const struct builtin_type *bt = builtin_type (gdbarch);
/* The type we're building is this /* The type we're building is this
type = union __ppc_builtin_type_vec128 { type = union __ppc_builtin_type_vec128 {
@ -2305,15 +2308,15 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
struct type *t; struct type *t;
t = init_composite_type ("__ppc_builtin_type_vec128", TYPE_CODE_UNION); 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", 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", 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", 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", 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_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec128"; TYPE_NAME (t) = "ppc_builtin_type_vec128";

View File

@ -268,7 +268,7 @@ static struct type *
score_register_type (struct gdbarch *gdbarch, int regnum) score_register_type (struct gdbarch *gdbarch, int regnum)
{ {
gdb_assert (regnum >= 0 && regnum < SCORE_NUM_REGS); gdb_assert (regnum >= 0 && regnum < SCORE_NUM_REGS);
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
} }
static CORE_ADDR static CORE_ADDR

View File

@ -349,7 +349,7 @@ sparc32_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC32_FSR_REGNUM) if (regnum == SPARC32_FSR_REGNUM)
return sparc_fsr_type; return sparc_fsr_type;
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
static void static void
@ -406,6 +406,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* Number of words in the "parameter array". */ /* Number of words in the "parameter array". */
int num_elements = 0; int num_elements = 0;
int element = 0; int element = 0;
@ -442,7 +443,8 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
gdb_assert (sparc_integral_or_pointer_p (type)); gdb_assert (sparc_integral_or_pointer_p (type));
if (len < 4) 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); num_elements += ((len + 3) / 4);
} }
} }

View File

@ -249,7 +249,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM) if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= SPARC_G0_REGNUM && regnum <= SPARC_I7_REGNUM) 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) if (regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
return builtin_type (gdbarch)->builtin_float; return builtin_type (gdbarch)->builtin_float;
if (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM) if (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)
@ -259,7 +259,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
/* This raw register contains the contents of %cwp, %pstate, %asi /* This raw register contains the contents of %cwp, %pstate, %asi
and %ccr as laid out in a %tstate register. */ and %ccr as laid out in a %tstate register. */
if (regnum == SPARC64_STATE_REGNUM) if (regnum == SPARC64_STATE_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_FSR_REGNUM) if (regnum == SPARC64_FSR_REGNUM)
return sparc64_fsr_type; return sparc64_fsr_type;
if (regnum == SPARC64_FPRS_REGNUM) if (regnum == SPARC64_FPRS_REGNUM)
@ -267,18 +267,18 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
/* "Although Y is a 64-bit register, its high-order 32 bits are /* "Although Y is a 64-bit register, its high-order 32 bits are
reserved and always read as 0." */ reserved and always read as 0." */
if (regnum == SPARC64_Y_REGNUM) if (regnum == SPARC64_Y_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
/* Pseudo registers. */ /* Pseudo registers. */
if (regnum == SPARC64_CWP_REGNUM) if (regnum == SPARC64_CWP_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_PSTATE_REGNUM) if (regnum == SPARC64_PSTATE_REGNUM)
return sparc64_pstate_type; return sparc64_pstate_type;
if (regnum == SPARC64_ASI_REGNUM) if (regnum == SPARC64_ASI_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_CCR_REGNUM) if (regnum == SPARC64_CCR_REGNUM)
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM) if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
return builtin_type (gdbarch)->builtin_double; return builtin_type (gdbarch)->builtin_double;
if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM) if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
@ -687,6 +687,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* Number of extended words in the "parameter array". */ /* Number of extended words in the "parameter array". */
int num_elements = 0; int num_elements = 0;
int element = 0; int element = 0;
@ -768,7 +769,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
caller to an extended word according to the signed-ness caller to an extended word according to the signed-ness
of the argument type." */ of the argument type." */
if (len < 8) 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++; num_elements++;
} }
} }

View File

@ -61,24 +61,23 @@ spu_builtin_type_vec128 (struct gdbarch *gdbarch)
if (!tdep->spu_builtin_type_vec128) if (!tdep->spu_builtin_type_vec128)
{ {
const struct builtin_type *bt = builtin_type (gdbarch);
struct type *t; struct type *t;
t = init_composite_type ("__spu_builtin_type_vec128", TYPE_CODE_UNION); 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", 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", 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", 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", 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", append_composite_type_field (t, "v2_double",
init_vector_type (builtin_type (gdbarch) init_vector_type (bt->builtin_double, 2));
->builtin_double, 2));
append_composite_type_field (t, "v4_float", append_composite_type_field (t, "v4_float",
init_vector_type (builtin_type (gdbarch) init_vector_type (bt->builtin_float, 4));
->builtin_float, 4));
TYPE_VECTOR (t) = 1; TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "spu_builtin_type_vec128"; TYPE_NAME (t) = "spu_builtin_type_vec128";
@ -136,7 +135,7 @@ spu_register_type (struct gdbarch *gdbarch, int reg_nr)
switch (reg_nr) switch (reg_nr)
{ {
case SPU_ID_REGNUM: case SPU_ID_REGNUM:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
case SPU_PC_REGNUM: case SPU_PC_REGNUM:
return builtin_type (gdbarch)->builtin_func_ptr; return builtin_type (gdbarch)->builtin_func_ptr;
@ -145,19 +144,19 @@ spu_register_type (struct gdbarch *gdbarch, int reg_nr)
return builtin_type (gdbarch)->builtin_data_ptr; return builtin_type (gdbarch)->builtin_data_ptr;
case SPU_FPSCR_REGNUM: case SPU_FPSCR_REGNUM:
return builtin_type_uint128; return builtin_type (gdbarch)->builtin_uint128;
case SPU_SRR0_REGNUM: case SPU_SRR0_REGNUM:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
case SPU_LSLR_REGNUM: case SPU_LSLR_REGNUM:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
case SPU_DECR_REGNUM: case SPU_DECR_REGNUM:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
case SPU_DECR_STATUS_REGNUM: case SPU_DECR_STATUS_REGNUM:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
default: default:
internal_error (__FILE__, __LINE__, "invalid regnum"); internal_error (__FILE__, __LINE__, "invalid regnum");

View File

@ -452,34 +452,34 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
{ {
/* Predefined types. */ /* Predefined types. */
case TDESC_TYPE_INT8: case TDESC_TYPE_INT8:
return builtin_type_int8; return builtin_type (gdbarch)->builtin_int8;
case TDESC_TYPE_INT16: case TDESC_TYPE_INT16:
return builtin_type_int16; return builtin_type (gdbarch)->builtin_int16;
case TDESC_TYPE_INT32: case TDESC_TYPE_INT32:
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
case TDESC_TYPE_INT64: case TDESC_TYPE_INT64:
return builtin_type_int64; return builtin_type (gdbarch)->builtin_int64;
case TDESC_TYPE_INT128: case TDESC_TYPE_INT128:
return builtin_type_int128; return builtin_type (gdbarch)->builtin_int128;
case TDESC_TYPE_UINT8: case TDESC_TYPE_UINT8:
return builtin_type_uint8; return builtin_type (gdbarch)->builtin_uint8;
case TDESC_TYPE_UINT16: case TDESC_TYPE_UINT16:
return builtin_type_uint16; return builtin_type (gdbarch)->builtin_uint16;
case TDESC_TYPE_UINT32: case TDESC_TYPE_UINT32:
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
case TDESC_TYPE_UINT64: case TDESC_TYPE_UINT64:
return builtin_type_uint64; return builtin_type (gdbarch)->builtin_uint64;
case TDESC_TYPE_UINT128: case TDESC_TYPE_UINT128:
return builtin_type_uint128; return builtin_type (gdbarch)->builtin_uint128;
case TDESC_TYPE_CODE_PTR: case TDESC_TYPE_CODE_PTR:
return builtin_type (gdbarch)->builtin_func_ptr; return builtin_type (gdbarch)->builtin_func_ptr;
@ -708,7 +708,7 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno)
if (reg == NULL) if (reg == NULL)
/* Return "int0_t", since "void" has a misleading size of one. */ /* 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 (arch_reg->type == NULL)
{ {

View File

@ -184,7 +184,7 @@ v850_register_type (struct gdbarch *gdbarch, int regnum)
{ {
if (regnum == E_PC_REGNUM) if (regnum == E_PC_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr; return builtin_type (gdbarch)->builtin_func_ptr;
return builtin_type_int32; return builtin_type (gdbarch)->builtin_int32;
} }
static int static int

View File

@ -125,9 +125,9 @@ static struct type *
xstormy16_register_type (struct gdbarch *gdbarch, int regnum) xstormy16_register_type (struct gdbarch *gdbarch, int regnum)
{ {
if (regnum == E_PC_REGNUM) if (regnum == E_PC_REGNUM)
return builtin_type_uint32; return builtin_type (gdbarch)->builtin_uint32;
else else
return builtin_type_uint16; return builtin_type (gdbarch)->builtin_uint16;
} }
/* Function: xstormy16_type_is_scalar /* Function: xstormy16_type_is_scalar

View File

@ -214,33 +214,27 @@ xtensa_register_name (struct gdbarch *gdbarch, int regnum)
/* Return the type of a register. Create a new type, if necessary. */ /* 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 * static struct type *
xtensa_register_type (struct gdbarch *gdbarch, int regnum) xtensa_register_type (struct gdbarch *gdbarch, int regnum)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Return signed integer for ARx and Ax registers. */ /* Return signed integer for ARx and Ax registers. */
if ((regnum >= gdbarch_tdep (gdbarch)->ar_base if ((regnum >= tdep->ar_base
&& regnum < gdbarch_tdep (gdbarch)->ar_base && regnum < tdep->ar_base + tdep->num_aregs)
+ gdbarch_tdep (gdbarch)->num_aregs) || (regnum >= tdep->a0_base
|| (regnum >= gdbarch_tdep (gdbarch)->a0_base && regnum < tdep->a0_base + 16))
&& regnum < gdbarch_tdep (gdbarch)->a0_base + 16))
return builtin_type (gdbarch)->builtin_int; return builtin_type (gdbarch)->builtin_int;
if (regnum == gdbarch_pc_regnum (gdbarch) 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 builtin_type (gdbarch)->builtin_data_ptr;
/* Return the stored type for all other registers. */ /* Return the stored type for all other registers. */
else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch) else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_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). */ /* Set ctype for this register (only the first time). */
@ -254,27 +248,27 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
switch (size) switch (size)
{ {
case 1: case 1:
reg->ctype = builtin_type_uint8; reg->ctype = builtin_type (gdbarch)->builtin_uint8;
break; break;
case 2: case 2:
reg->ctype = builtin_type_uint16; reg->ctype = builtin_type (gdbarch)->builtin_uint16;
break; break;
case 4: case 4:
reg->ctype = builtin_type_uint32; reg->ctype = builtin_type (gdbarch)->builtin_uint32;
break; break;
case 8: case 8:
reg->ctype = builtin_type_uint64; reg->ctype = builtin_type (gdbarch)->builtin_uint64;
break; break;
case 16: case 16:
reg->ctype = builtin_type_uint128; reg->ctype = builtin_type (gdbarch)->builtin_uint128;
break; break;
default: default:
for (tp = type_entries; tp != NULL; tp = tp->next) for (tp = tdep->type_entries; tp != NULL; tp = tp->next)
if (tp->size == size) if (tp->size == size)
break; break;
@ -282,8 +276,8 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
{ {
char *name = xmalloc (16); char *name = xmalloc (16);
tp = xmalloc (sizeof (struct ctype_cache)); tp = xmalloc (sizeof (struct ctype_cache));
tp->next = type_entries; tp->next = tdep->type_entries;
type_entries = tp; tdep->type_entries = tp;
tp->size = size; tp->size = size;
sprintf (name, "int%d", size * 8); sprintf (name, "int%d", size * 8);

View File

@ -227,6 +227,14 @@ struct gdbarch_tdep
unsigned long *fp_layout; /* Layout of custom/TIE regs in 'FP' area. */ unsigned long *fp_layout; /* Layout of custom/TIE regs in 'FP' area. */
unsigned int fp_layout_bytes; /* Size of layout information (in bytes). */ unsigned int fp_layout_bytes; /* Size of layout information (in bytes). */
unsigned long *gregmap; 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. */ /* Macro to instantiate a gdbarch_tdep structure. */