aboutsummaryrefslogtreecommitdiff
path: root/gdb/mt-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:46:19 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:46:19 +0000
commitdf4df182b49ab6808495f557d3727b8dfd4b98da (patch)
tree7df1585d4087550709356201e912e9ee285cb675 /gdb/mt-tdep.c
parent69feb676087cb0883eb5feb38558dc3252059312 (diff)
downloadgdb-df4df182b49ab6808495f557d3727b8dfd4b98da.zip
gdb-df4df182b49ab6808495f557d3727b8dfd4b98da.tar.gz
gdb-df4df182b49ab6808495f557d3727b8dfd4b98da.tar.bz2
* 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.
Diffstat (limited to 'gdb/mt-tdep.c')
-rw-r--r--gdb/mt-tdep.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index ec52d5b..b0da869 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -139,6 +139,14 @@ enum mt_gdb_regnums
* 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 *
@@ -213,7 +221,7 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
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:
@@ -222,27 +230,27 @@ mt_copro_register_type (struct gdbarch *arch, int 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;
}
}
@@ -252,12 +260,10 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
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:
@@ -269,14 +275,19 @@ mt_register_type (struct gdbarch *arch, int 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
@@ -1098,6 +1109,7 @@ static struct gdbarch *
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);
@@ -1106,7 +1118,8 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* 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);