This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3/7] Eliminate builtin integer types


Hello,

this patch removes all remaining use of builtin_type_int... by introducing
new builtin_type elements.  Nearly all such uses are in target code where
the appropriate architecture is readily available.

Bye,
Ulrich

ChangeLog:

	* 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.
	* m32t-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.



Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -104,7 +104,7 @@ alpha_register_type (struct gdbarch *gdb
   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?  */
@@ -298,12 +298,12 @@ alpha_push_dummy_call (struct gdbarch *g
 	    {
 	      /* 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;
@@ -498,6 +498,7 @@ static void
 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;
@@ -556,7 +557,7 @@ alpha_store_return_value (struct type *v
       /* 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;
Index: gdb-head/gdb/amd64-linux-tdep.c
===================================================================
--- gdb-head.orig/gdb/amd64-linux-tdep.c
+++ gdb-head/gdb/amd64-linux-tdep.c
@@ -218,7 +218,7 @@ static struct type *
 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);
 }
Index: gdb-head/gdb/amd64-tdep.c
===================================================================
--- gdb-head.orig/gdb/amd64-tdep.c
+++ gdb-head/gdb/amd64-tdep.c
@@ -90,21 +90,21 @@ struct type *
 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)
Index: gdb-head/gdb/arm-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-tdep.c
+++ gdb-head/gdb/arm-tdep.c
@@ -1608,9 +1608,9 @@ arm_register_type (struct gdbarch *gdbar
   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
Index: gdb-head/gdb/avr-tdep.c
===================================================================
--- gdb-head.orig/gdb/avr-tdep.c
+++ gdb-head/gdb/avr-tdep.c
@@ -212,11 +212,11 @@ static struct type *
 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. */
Index: gdb-head/gdb/cris-tdep.c
===================================================================
--- gdb-head.orig/gdb/cris-tdep.c
+++ gdb-head/gdb/cris-tdep.c
@@ -1657,14 +1657,14 @@ cris_register_type (struct gdbarch *gdba
   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 *
@@ -1680,17 +1680,17 @@ crisv32_register_type (struct gdbarch *g
 	   || (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;
     }
 }
 
Index: gdb-head/gdb/dwarf2expr.c
===================================================================
--- gdb-head.orig/gdb/dwarf2expr.c
+++ gdb-head/gdb/dwarf2expr.c
@@ -33,7 +33,7 @@
 
 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.  */
 
@@ -225,7 +225,7 @@ dwarf2_read_address (struct gdbarch *gdb
 
   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);
 }
@@ -234,16 +234,16 @@ dwarf2_read_address (struct gdbarch *gdb
    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"));
@@ -254,16 +254,16 @@ unsigned_address_type (int addr_size)
    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"));
@@ -622,6 +622,7 @@ execute_stack_op (struct dwarf_expr_cont
 	    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);
@@ -629,10 +630,10 @@ execute_stack_op (struct dwarf_expr_cont
 	    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)
 	      {
@@ -665,8 +666,7 @@ execute_stack_op (struct dwarf_expr_cont
                 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;
Index: gdb-head/gdb/frv-tdep.c
===================================================================
--- gdb-head.orig/gdb/frv-tdep.c
+++ gdb-head/gdb/frv-tdep.c
@@ -294,9 +294,9 @@ frv_register_type (struct gdbarch *gdbar
   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
Index: gdb-head/gdb/gdbtypes.c
===================================================================
--- gdb-head.orig/gdb/gdbtypes.c
+++ gdb-head/gdb/gdbtypes.c
@@ -39,20 +39,6 @@
 #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] = {
@@ -3196,6 +3182,52 @@ gdbtypes_post_init (struct gdbarch *gdba
 	       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);
@@ -3375,51 +3407,6 @@ _initialize_gdbtypes (void)
      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 =
Index: gdb-head/gdb/gdbtypes.h
===================================================================
--- gdb-head.orig/gdb/gdbtypes.h
+++ gdb-head/gdb/gdbtypes.h
@@ -990,6 +990,21 @@ struct builtin_type
   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.  */
 
@@ -1056,21 +1071,6 @@ struct objfile_type
 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];
Index: gdb-head/gdb/h8300-tdep.c
===================================================================
--- gdb-head.orig/gdb/h8300-tdep.c
+++ gdb-head/gdb/h8300-tdep.c
@@ -1119,13 +1119,13 @@ h8300_register_type (struct gdbarch *gdb
 	  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;
 	}
     }
 }
Index: gdb-head/gdb/hppa-tdep.c
===================================================================
--- gdb-head.orig/gdb/hppa-tdep.c
+++ gdb-head/gdb/hppa-tdep.c
@@ -975,7 +975,7 @@ hppa64_push_dummy_call (struct gdbarch *
              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;
 	    }
 	}
@@ -2610,7 +2610,7 @@ static struct type *
 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;
 }
@@ -2619,7 +2619,7 @@ static struct type *
 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;
 }
Index: gdb-head/gdb/i386-tdep.c
===================================================================
--- gdb-head.orig/gdb/i386-tdep.c
+++ gdb-head/gdb/i386-tdep.c
@@ -2052,6 +2052,8 @@ i386_mmx_type (struct gdbarch *gdbarch)
 
   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
@@ -2066,13 +2068,14 @@ i386_mmx_type (struct gdbarch *gdbarch)
       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";
@@ -2089,6 +2092,8 @@ i386_sse_type (struct gdbarch *gdbarch)
 
   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
@@ -2107,20 +2112,18 @@ i386_sse_type (struct gdbarch *gdbarch)
 
       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";
Index: gdb-head/gdb/iq2000-tdep.c
===================================================================
--- gdb-head.orig/gdb/iq2000-tdep.c
+++ gdb-head/gdb/iq2000-tdep.c
@@ -587,7 +587,7 @@ iq2000_return_value (struct gdbarch *gdb
 static struct type *
 iq2000_register_type (struct gdbarch *gdbarch, int regnum)
 {
-  return builtin_type_int32;
+  return builtin_type (gdbarch)->builtin_int32;
 }
 
 static CORE_ADDR
Index: gdb-head/gdb/jv-exp.y
===================================================================
--- gdb-head.orig/gdb/jv-exp.y
+++ gdb-head/gdb/jv-exp.y
@@ -795,12 +795,12 @@ parse_number (char *p, int len, int pars
 	}
 
   /* 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;
Index: gdb-head/gdb/lm32-tdep.c
===================================================================
--- gdb-head.orig/gdb/lm32-tdep.c
+++ gdb-head/gdb/lm32-tdep.c
@@ -111,7 +111,7 @@ lm32_register_name (struct gdbarch *gdba
 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.  */
@@ -273,7 +273,7 @@ lm32_push_dummy_call (struct gdbarch *gd
 	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;
Index: gdb-head/gdb/m32r-tdep.c
===================================================================
--- gdb-head.orig/gdb/m32r-tdep.c
+++ gdb-head/gdb/m32r-tdep.c
@@ -235,7 +235,7 @@ m32r_register_type (struct gdbarch *gdba
   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;
 }
 
 
Index: gdb-head/gdb/m68hc11-tdep.c
===================================================================
--- gdb-head.orig/gdb/m68hc11-tdep.c
+++ gdb-head/gdb/m68hc11-tdep.c
@@ -289,7 +289,7 @@ m68hc11_pseudo_register_read (struct gdb
   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)
@@ -329,7 +329,7 @@ m68hc11_pseudo_register_write (struct gd
      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;
 
@@ -1239,13 +1239,13 @@ m68hc11_register_type (struct gdbarch *g
     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;
     }
 }
 
Index: gdb-head/gdb/m68k-tdep.c
===================================================================
--- gdb-head.orig/gdb/m68k-tdep.c
+++ gdb-head/gdb/m68k-tdep.c
@@ -124,12 +124,12 @@ m68k_register_type (struct gdbarch *gdba
 	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))
@@ -141,7 +141,7 @@ m68k_register_type (struct gdbarch *gdba
   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[] = {
Index: gdb-head/gdb/m88k-tdep.c
===================================================================
--- gdb-head.orig/gdb/m88k-tdep.c
+++ gdb-head/gdb/m88k-tdep.c
@@ -81,7 +81,7 @@ m88k_register_type (struct gdbarch *gdba
   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;
 }
 
 
@@ -258,6 +258,7 @@ static CORE_ADDR
 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;
@@ -269,7 +270,8 @@ m88k_store_arguments (struct regcache *r
 
       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);
 	}
Index: gdb-head/gdb/mep-tdep.c
===================================================================
--- gdb-head.orig/gdb/mep-tdep.c
+++ gdb-head/gdb/mep-tdep.c
@@ -1084,7 +1084,7 @@ mep_register_type (struct gdbarch *gdbar
      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
@@ -1099,14 +1099,14 @@ mep_register_type (struct gdbarch *gdbar
           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);
@@ -1114,7 +1114,7 @@ mep_register_type (struct gdbarch *gdbar
 
   /* All other registers are 32 bits long.  */
   else
-    return builtin_type_uint32;
+    return builtin_type (gdbarch)->builtin_uint32;
 }
 
 
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -679,9 +679,9 @@ mips_register_type (struct gdbarch *gdba
       /* 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
     {
@@ -692,19 +692,19 @@ mips_register_type (struct gdbarch *gdba
 	  && 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;
     }
 }
 
@@ -741,7 +741,7 @@ mips_pseudo_register_type (struct gdbarc
 	 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,
@@ -757,7 +757,7 @@ mips_pseudo_register_type (struct gdbarc
 
   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;
@@ -4396,8 +4396,9 @@ mips_print_fp_register (struct ui_file *
       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)
@@ -4430,8 +4431,9 @@ mips_print_fp_register (struct ui_file *
       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)
Index: gdb-head/gdb/moxie-tdep.c
===================================================================
--- gdb-head.orig/gdb/moxie-tdep.c
+++ gdb-head/gdb/moxie-tdep.c
@@ -110,7 +110,7 @@ moxie_register_type (struct gdbarch *gdb
   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
Index: gdb-head/gdb/mt-tdep.c
===================================================================
--- gdb-head.orig/gdb/mt-tdep.c
+++ gdb-head/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 *
     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 *
     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 *
 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, 
 	  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 inf
 
   /* 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);
Index: gdb-head/gdb/rs6000-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-tdep.c
+++ gdb-head/gdb/rs6000-tdep.c
@@ -2248,6 +2248,8 @@ rs6000_builtin_type_vec64 (struct gdbarc
 
   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
@@ -2263,16 +2265,15 @@ rs6000_builtin_type_vec64 (struct gdbarc
       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";
@@ -2291,6 +2292,8 @@ rs6000_builtin_type_vec128 (struct gdbar
 
   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 {
@@ -2305,15 +2308,15 @@ rs6000_builtin_type_vec128 (struct gdbar
       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";
Index: gdb-head/gdb/score-tdep.c
===================================================================
--- gdb-head.orig/gdb/score-tdep.c
+++ gdb-head/gdb/score-tdep.c
@@ -268,7 +268,7 @@ static struct type *
 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
Index: gdb-head/gdb/sparc-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc-tdep.c
+++ gdb-head/gdb/sparc-tdep.c
@@ -349,7 +349,7 @@ sparc32_register_type (struct gdbarch *g
   if (regnum == SPARC32_FSR_REGNUM)
     return sparc_fsr_type;
 
-  return builtin_type_int32;
+  return builtin_type (gdbarch)->builtin_int32;
 }
 
 static void
@@ -406,6 +406,7 @@ sparc32_store_arguments (struct regcache
 			 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;
@@ -442,7 +443,8 @@ sparc32_store_arguments (struct regcache
 	  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);
 	}
     }
Index: gdb-head/gdb/sparc64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc64-tdep.c
+++ gdb-head/gdb/sparc64-tdep.c
@@ -249,7 +249,7 @@ sparc64_register_type (struct gdbarch *g
   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)
@@ -259,7 +259,7 @@ sparc64_register_type (struct gdbarch *g
   /* 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)
@@ -267,18 +267,18 @@ sparc64_register_type (struct gdbarch *g
   /* "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)
@@ -687,6 +687,7 @@ sparc64_store_arguments (struct regcache
 			 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;
@@ -768,7 +769,8 @@ sparc64_store_arguments (struct regcache
 	     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++;
 	}
     }
Index: gdb-head/gdb/spu-tdep.c
===================================================================
--- gdb-head.orig/gdb/spu-tdep.c
+++ gdb-head/gdb/spu-tdep.c
@@ -61,24 +61,23 @@ spu_builtin_type_vec128 (struct gdbarch 
 
   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";
@@ -136,7 +135,7 @@ spu_register_type (struct gdbarch *gdbar
   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;
@@ -145,19 +144,19 @@ spu_register_type (struct gdbarch *gdbar
       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");
Index: gdb-head/gdb/target-descriptions.c
===================================================================
--- gdb-head.orig/gdb/target-descriptions.c
+++ gdb-head/gdb/target-descriptions.c
@@ -452,34 +452,34 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
     {
     /* 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;
@@ -708,7 +708,7 @@ tdesc_register_type (struct gdbarch *gdb
 
   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)
     {
Index: gdb-head/gdb/v850-tdep.c
===================================================================
--- gdb-head.orig/gdb/v850-tdep.c
+++ gdb-head/gdb/v850-tdep.c
@@ -184,7 +184,7 @@ v850_register_type (struct gdbarch *gdba
 {
   if (regnum == E_PC_REGNUM)
     return builtin_type (gdbarch)->builtin_func_ptr;
-  return builtin_type_int32;
+  return builtin_type (gdbarch)->builtin_int32;
 }
 
 static int
Index: gdb-head/gdb/xstormy16-tdep.c
===================================================================
--- gdb-head.orig/gdb/xstormy16-tdep.c
+++ gdb-head/gdb/xstormy16-tdep.c
@@ -125,9 +125,9 @@ static struct type *
 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
Index: gdb-head/gdb/xtensa-tdep.c
===================================================================
--- gdb-head.orig/gdb/xtensa-tdep.c
+++ gdb-head/gdb/xtensa-tdep.c
@@ -214,33 +214,27 @@ xtensa_register_name (struct gdbarch *gd
 
 /* 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).  */
 
@@ -254,27 +248,27 @@ xtensa_register_type (struct gdbarch *gd
 	  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;
 
@@ -282,8 +276,8 @@ xtensa_register_type (struct gdbarch *gd
 		{
 		  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);
Index: gdb-head/gdb/xtensa-tdep.h
===================================================================
--- gdb-head.orig/gdb/xtensa-tdep.h
+++ gdb-head/gdb/xtensa-tdep.h
@@ -227,6 +227,14 @@ struct gdbarch_tdep
   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.  */
Index: gdb-head/gdb/mi/mi-main.c
===================================================================
--- gdb-head.orig/gdb/mi/mi-main.c
+++ gdb-head/gdb/mi/mi-main.c
@@ -828,6 +828,7 @@ mi_cmd_data_evaluate_expression (char *c
 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;
@@ -884,23 +885,23 @@ mi_cmd_data_read_memory (char *command, 
   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.  */
Index: gdb-head/gdb/printcmd.c
===================================================================
--- gdb-head.orig/gdb/printcmd.c
+++ gdb-head/gdb/printcmd.c
@@ -781,13 +781,13 @@ do_examine (struct format_data fmt, stru
     }
 
   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')
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]