[08/20] Unify arch_integer_type and init_integer_type

Message ID 20230313-split-objfile-type-allocator-2-v1-8-69ba773ac17b@tromey.com
State New
Headers
Series Remove objfile_type |

Commit Message

Tom Tromey March 13, 2023, 10:08 p.m. UTC
  This unifies arch_integer_type and init_integer_type by using a type
allocator.
---
 gdb/ada-lang.c     |  14 ++++----
 gdb/ctfread.c      |   2 +-
 gdb/d-lang.c       |  21 +++++------
 gdb/dwarf2/expr.c  |   9 +++--
 gdb/dwarf2/read.c  |   5 ++-
 gdb/f-lang.c       |   8 ++---
 gdb/fbsd-tdep.c    |  10 +++---
 gdb/gdbtypes.c     | 103 ++++++++++++++++++++++-------------------------------
 gdb/gdbtypes.h     |   8 ++---
 gdb/gnu-v3-abi.c   |   2 +-
 gdb/go-lang.c      |  23 ++++++------
 gdb/linux-tdep.c   |  11 +++---
 gdb/m2-lang.c      |   6 ++--
 gdb/m32c-tdep.c    |  12 +++----
 gdb/mdebugread.c   |  30 ++++++++--------
 gdb/opencl-lang.c  |  33 ++++++++---------
 gdb/rl78-tdep.c    |  12 +++----
 gdb/rust-lang.c    |  23 ++++++------
 gdb/stabsread.c    |  56 ++++++++++++++---------------
 gdb/windows-tdep.c |  13 +++----
 gdb/xtensa-tdep.c  |   3 +-
 21 files changed, 200 insertions(+), 204 deletions(-)
  

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2e99dfa0c6f..a3ceb3ae838 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13557,11 +13557,11 @@  class ada_language : public language_defn
     };
 
     type_allocator alloc (gdbarch);
-    add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+    add (init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			    0, "integer"));
-    add (arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+    add (init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 			    0, "long_integer"));
-    add (arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
+    add (init_integer_type (alloc, gdbarch_short_bit (gdbarch),
 			    0, "short_integer"));
     struct type *char_type = arch_character_type (gdbarch, TARGET_CHAR_BIT,
 						  1, "character");
@@ -13573,14 +13573,14 @@  class ada_language : public language_defn
 			  "float", gdbarch_float_format (gdbarch)));
     add (arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
 			  "long_float", gdbarch_double_format (gdbarch)));
-    add (arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
+    add (init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
 			    0, "long_long_integer"));
     add (arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
 			  "long_long_float",
 			  gdbarch_long_double_format (gdbarch)));
-    add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+    add (init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			    0, "natural"));
-    add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+    add (init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			    0, "positive"));
     add (builtin->builtin_void);
 
@@ -13594,7 +13594,7 @@  class ada_language : public language_defn
        type.  This is a signed integral type whose size is the same as
        the size of addresses.  */
     unsigned int addr_length = system_addr_ptr->length ();
-    add (arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0,
+    add (init_integer_type (alloc, addr_length * HOST_CHAR_BIT, 0,
 			    "storage_offset"));
 
     lai->set_bool_type (builtin->builtin_bool);
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 82c2cdb3abb..879fdeb74d6 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -577,7 +577,7 @@  read_base_type (struct ctf_context *ccp, ctf_id_t tid)
 	    bits = cet.cte_bits;
 	  else
 	    bits = gdbarch_int_bit (gdbarch);
-	  type = init_integer_type (of, bits, !issigned, name);
+	  type = init_integer_type (alloc, bits, !issigned, name);
 	}
     }
   else if (kind == CTF_K_FLOAT)
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 457e367fd51..af9a81d1b1b 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -201,29 +201,30 @@  build_d_types (struct gdbarch *gdbarch)
   struct builtin_d_type *builtin_d_type = new struct builtin_d_type;
 
   /* Basic types.  */
+  type_allocator alloc (gdbarch);
   builtin_d_type->builtin_void = builtin_type (gdbarch)->builtin_void;
   builtin_d_type->builtin_bool
     = arch_boolean_type (gdbarch, 8, 1, "bool");
   builtin_d_type->builtin_byte
-    = arch_integer_type (gdbarch, 8, 0, "byte");
+    = init_integer_type (alloc, 8, 0, "byte");
   builtin_d_type->builtin_ubyte
-    = arch_integer_type (gdbarch, 8, 1, "ubyte");
+    = init_integer_type (alloc, 8, 1, "ubyte");
   builtin_d_type->builtin_short
-    = arch_integer_type (gdbarch, 16, 0, "short");
+    = init_integer_type (alloc, 16, 0, "short");
   builtin_d_type->builtin_ushort
-    = arch_integer_type (gdbarch, 16, 1, "ushort");
+    = init_integer_type (alloc, 16, 1, "ushort");
   builtin_d_type->builtin_int
-    = arch_integer_type (gdbarch, 32, 0, "int");
+    = init_integer_type (alloc, 32, 0, "int");
   builtin_d_type->builtin_uint
-    = arch_integer_type (gdbarch, 32, 1, "uint");
+    = init_integer_type (alloc, 32, 1, "uint");
   builtin_d_type->builtin_long
-    = arch_integer_type (gdbarch, 64, 0, "long");
+    = init_integer_type (alloc, 64, 0, "long");
   builtin_d_type->builtin_ulong
-    = arch_integer_type (gdbarch, 64, 1, "ulong");
+    = init_integer_type (alloc, 64, 1, "ulong");
   builtin_d_type->builtin_cent
-    = arch_integer_type (gdbarch, 128, 0, "cent");
+    = init_integer_type (alloc, 128, 0, "cent");
   builtin_d_type->builtin_ucent
-    = arch_integer_type (gdbarch, 128, 1, "ucent");
+    = init_integer_type (alloc, 128, 1, "ucent");
   builtin_d_type->builtin_float
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
 		       "float", gdbarch_float_format (gdbarch));
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 2b41372be8a..d245bc65ef2 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -700,9 +700,12 @@  dwarf_expr_context::address_type () const
 	   8 * this->m_addr_size);
 
   if (types->dw_types[ndx] == NULL)
-    types->dw_types[ndx]
-      = arch_integer_type (arch, 8 * this->m_addr_size,
-			   0, "<signed DWARF address type>");
+    {
+      type_allocator alloc (arch);
+      types->dw_types[ndx]
+	= init_integer_type (alloc, 8 * this->m_addr_size,
+			     0, "<signed DWARF address type>");
+    }
 
   return types->dw_types[ndx];
 }
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e2571667aa2..f3cc78ce10b 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -15042,7 +15042,10 @@  dwarf2_init_integer_type (struct dwarf2_cu *cu, struct objfile *objfile,
       && strcmp (name, "void") == 0)
     type = objfile_type (objfile)->builtin_void;
   else
-    type = init_integer_type (objfile, bits, unsigned_p, name);
+    {
+      type_allocator alloc (objfile);
+      type = init_integer_type (alloc, bits, unsigned_p, name);
+    }
 
   return type;
 }
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 3bf33d020c6..cb63c3704c1 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1746,16 +1746,16 @@  build_fortran_types (struct gdbarch *gdbarch)
 			 "logical*8");
 
   builtin_f_type->builtin_integer_s1
-    = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "integer*1");
+    = init_integer_type (alloc, TARGET_CHAR_BIT, 0, "integer*1");
 
   builtin_f_type->builtin_integer_s2
-    = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0, "integer*2");
+    = init_integer_type (alloc, gdbarch_short_bit (gdbarch), 0, "integer*2");
 
   builtin_f_type->builtin_integer
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer*4");
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "integer*4");
 
   builtin_f_type->builtin_integer_s8
-    = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0,
+    = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 0,
 			 "integer*8");
 
   builtin_f_type->builtin_real
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 236a9f4d615..dc5020d92d2 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1594,11 +1594,12 @@  fbsd_get_siginfo_type (struct gdbarch *gdbarch)
   if (fbsd_gdbarch_data->siginfo_type != NULL)
     return fbsd_gdbarch_data->siginfo_type;
 
-  int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+  type_allocator alloc (gdbarch);
+  int_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 				0, "int");
-  int32_type = arch_integer_type (gdbarch, 32, 0, "int32_t");
-  uint32_type = arch_integer_type (gdbarch, 32, 1, "uint32_t");
-  long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+  int32_type = init_integer_type (alloc, 32, 0, "int32_t");
+  uint32_type = init_integer_type (alloc, 32, 1, "uint32_t");
+  long_type = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 				 0, "long");
   void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
 
@@ -1609,7 +1610,6 @@  fbsd_get_siginfo_type (struct gdbarch *gdbarch)
   append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
 
   /* __pid_t */
-  type_allocator alloc (gdbarch);
   pid_type = alloc.new_type (TYPE_CODE_TYPEDEF,
 			     int32_type->length () * TARGET_CHAR_BIT,
 			     "__pid_t");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index c16651534ed..f5ddc869ebf 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3398,17 +3398,15 @@  floatformat_from_type (const struct type *type)
   return TYPE_FLOATFORMAT (type);
 }
 
-/* Allocate a TYPE_CODE_INT type structure associated with OBJFILE.
-   BIT is the type size in bits.  If UNSIGNED_P is non-zero, set
-   the type's TYPE_UNSIGNED flag.  NAME is the type name.  */
+/* See gdbtypes.h.  */
 
 struct type *
-init_integer_type (struct objfile *objfile,
+init_integer_type (type_allocator &alloc,
 		   int bit, int unsigned_p, const char *name)
 {
   struct type *t;
 
-  t = type_allocator (objfile).new_type (TYPE_CODE_INT, bit, name);
+  t = alloc.new_type (TYPE_CODE_INT, bit, name);
   if (unsigned_p)
     t->set_is_unsigned (true);
 
@@ -5752,23 +5750,6 @@  copy_type (const struct type *type)
 
 /* Helper functions to initialize architecture-specific types.  */
 
-/* Allocate a TYPE_CODE_INT type structure associated with GDBARCH.
-   BIT is the type size in bits.  If UNSIGNED_P is non-zero, set
-   the type's TYPE_UNSIGNED flag.  NAME is the type name.  */
-
-struct type *
-arch_integer_type (struct gdbarch *gdbarch,
-		   int bit, int unsigned_p, const char *name)
-{
-  struct type *t;
-
-  t = type_allocator (gdbarch).new_type (TYPE_CODE_INT, bit, name);
-  if (unsigned_p)
-    t->set_is_unsigned (true);
-
-  return t;
-}
-
 /* Allocate a TYPE_CODE_CHAR type structure associated with GDBARCH.
    BIT is the type size in bits.  If UNSIGNED_P is non-zero, set
    the type's TYPE_UNSIGNED flag.  NAME is the type name.  */
@@ -6086,38 +6067,38 @@  create_gdbtypes_data (struct gdbarch *gdbarch)
   builtin_type->builtin_void
     = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
   builtin_type->builtin_char
-    = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
+    = init_integer_type (alloc, TARGET_CHAR_BIT,
 			 !gdbarch_char_signed (gdbarch), "char");
   builtin_type->builtin_char->set_has_no_signedness (true);
   builtin_type->builtin_signed_char
-    = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
+    = init_integer_type (alloc, TARGET_CHAR_BIT,
 			 0, "signed char");
   builtin_type->builtin_unsigned_char
-    = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
+    = init_integer_type (alloc, TARGET_CHAR_BIT,
 			 1, "unsigned char");
   builtin_type->builtin_short
-    = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_short_bit (gdbarch),
 			 0, "short");
   builtin_type->builtin_unsigned_short
-    = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_short_bit (gdbarch),
 			 1, "unsigned short");
   builtin_type->builtin_int
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			 0, "int");
   builtin_type->builtin_unsigned_int
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			 1, "unsigned int");
   builtin_type->builtin_long
-    = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 			 0, "long");
   builtin_type->builtin_unsigned_long
-    = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 			 1, "unsigned long");
   builtin_type->builtin_long_long
-    = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
 			 0, "long long");
   builtin_type->builtin_unsigned_long_long
-    = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
 			 1, "unsigned long long");
   builtin_type->builtin_half
     = arch_float_type (gdbarch, gdbarch_half_bit (gdbarch),
@@ -6160,31 +6141,31 @@  create_gdbtypes_data (struct gdbarch *gdbarch)
 
   /* Fixed-size integer types.  */
   builtin_type->builtin_int0
-    = arch_integer_type (gdbarch, 0, 0, "int0_t");
+    = init_integer_type (alloc, 0, 0, "int0_t");
   builtin_type->builtin_int8
-    = arch_integer_type (gdbarch, 8, 0, "int8_t");
+    = init_integer_type (alloc, 8, 0, "int8_t");
   builtin_type->builtin_uint8
-    = arch_integer_type (gdbarch, 8, 1, "uint8_t");
+    = init_integer_type (alloc, 8, 1, "uint8_t");
   builtin_type->builtin_int16
-    = arch_integer_type (gdbarch, 16, 0, "int16_t");
+    = init_integer_type (alloc, 16, 0, "int16_t");
   builtin_type->builtin_uint16
-    = arch_integer_type (gdbarch, 16, 1, "uint16_t");
+    = init_integer_type (alloc, 16, 1, "uint16_t");
   builtin_type->builtin_int24
-    = arch_integer_type (gdbarch, 24, 0, "int24_t");
+    = init_integer_type (alloc, 24, 0, "int24_t");
   builtin_type->builtin_uint24
-    = arch_integer_type (gdbarch, 24, 1, "uint24_t");
+    = init_integer_type (alloc, 24, 1, "uint24_t");
   builtin_type->builtin_int32
-    = arch_integer_type (gdbarch, 32, 0, "int32_t");
+    = init_integer_type (alloc, 32, 0, "int32_t");
   builtin_type->builtin_uint32
-    = arch_integer_type (gdbarch, 32, 1, "uint32_t");
+    = init_integer_type (alloc, 32, 1, "uint32_t");
   builtin_type->builtin_int64
-    = arch_integer_type (gdbarch, 64, 0, "int64_t");
+    = init_integer_type (alloc, 64, 0, "int64_t");
   builtin_type->builtin_uint64
-    = arch_integer_type (gdbarch, 64, 1, "uint64_t");
+    = init_integer_type (alloc, 64, 1, "uint64_t");
   builtin_type->builtin_int128
-    = arch_integer_type (gdbarch, 128, 0, "int128_t");
+    = init_integer_type (alloc, 128, 0, "int128_t");
   builtin_type->builtin_uint128
-    = arch_integer_type (gdbarch, 128, 1, "uint128_t");
+    = init_integer_type (alloc, 128, 1, "uint128_t");
 
   builtin_type->builtin_int8->set_instance_flags
     (builtin_type->builtin_int8->instance_flags ()
@@ -6196,11 +6177,11 @@  create_gdbtypes_data (struct gdbarch *gdbarch)
 
   /* Wide character types.  */
   builtin_type->builtin_char16
-    = arch_integer_type (gdbarch, 16, 1, "char16_t");
+    = init_integer_type (alloc, 16, 1, "char16_t");
   builtin_type->builtin_char32
-    = arch_integer_type (gdbarch, 32, 1, "char32_t");
+    = init_integer_type (alloc, 32, 1, "char32_t");
   builtin_type->builtin_wchar
-    = arch_integer_type (gdbarch, gdbarch_wchar_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_wchar_bit (gdbarch),
 			 !gdbarch_wchar_signed (gdbarch), "wchar_t");
 
   /* Default data/code pointer types.  */
@@ -6263,38 +6244,38 @@  objfile_type (struct objfile *objfile)
   objfile_type->builtin_void
     = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
   objfile_type->builtin_char
-    = init_integer_type (objfile, TARGET_CHAR_BIT,
+    = init_integer_type (alloc, TARGET_CHAR_BIT,
 			 !gdbarch_char_signed (gdbarch), "char");
   objfile_type->builtin_char->set_has_no_signedness (true);
   objfile_type->builtin_signed_char
-    = init_integer_type (objfile, TARGET_CHAR_BIT,
+    = init_integer_type (alloc, TARGET_CHAR_BIT,
 			 0, "signed char");
   objfile_type->builtin_unsigned_char
-    = init_integer_type (objfile, TARGET_CHAR_BIT,
+    = init_integer_type (alloc, TARGET_CHAR_BIT,
 			 1, "unsigned char");
   objfile_type->builtin_short
-    = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_short_bit (gdbarch),
 			 0, "short");
   objfile_type->builtin_unsigned_short
-    = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_short_bit (gdbarch),
 			 1, "unsigned short");
   objfile_type->builtin_int
-    = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			 0, "int");
   objfile_type->builtin_unsigned_int
-    = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			 1, "unsigned int");
   objfile_type->builtin_long
-    = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 			 0, "long");
   objfile_type->builtin_unsigned_long
-    = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 			 1, "unsigned long");
   objfile_type->builtin_long_long
-    = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
 			 0, "long long");
   objfile_type->builtin_unsigned_long_long
-    = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
+    = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
 			 1, "unsigned long long");
   objfile_type->builtin_float
     = init_float_type (objfile, gdbarch_float_bit (gdbarch),
@@ -6354,7 +6335,7 @@  objfile_type (struct objfile *objfile)
      are indeed in the unified virtual address space.  */
 
   objfile_type->builtin_core_addr
-    = init_integer_type (objfile, gdbarch_addr_bit (gdbarch), 1,
+    = init_integer_type (alloc, gdbarch_addr_bit (gdbarch), 1,
 			 "__CORE_ADDR");
 
   objfile_type_data.set (objfile, objfile_type);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 4a1d2027568..7f2da7a6572 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2294,9 +2294,11 @@  class type_allocator
   bool m_smash = false;
 };
 
-/* * Helper function to construct objfile-owned types.  */
+/* Allocate a TYPE_CODE_INT type structure using ALLOC.  BIT is the
+   type size in bits.  If UNSIGNED_P is non-zero, set the type's
+   TYPE_UNSIGNED flag.  NAME is the type name.  */
 
-extern struct type *init_integer_type (struct objfile *, int, int,
+extern struct type *init_integer_type (type_allocator &, int, int,
 				       const char *);
 extern struct type *init_character_type (struct objfile *, int, int,
 					 const char *);
@@ -2314,8 +2316,6 @@  extern struct type *init_fixed_point_type (struct objfile *, int, int,
 					   const char *);
 
 /* Helper functions to construct architecture-owned types.  */
-extern struct type *arch_integer_type (struct gdbarch *, int, int,
-				       const char *);
 extern struct type *arch_character_type (struct gdbarch *, int, int,
 					 const char *);
 extern struct type *arch_boolean_type (struct gdbarch *, int, int,
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index a3e2d73f10a..12bc5b09a93 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -129,7 +129,7 @@  get_gdb_vtable_type (struct gdbarch *arch)
 
   /* ARCH can't give us the true ptrdiff_t type, so we guess.  */
   struct type *ptrdiff_type
-    = arch_integer_type (arch, gdbarch_ptr_bit (arch), 0, "ptrdiff_t");
+    = init_integer_type (alloc, gdbarch_ptr_bit (arch), 0, "ptrdiff_t");
 
   /* We assume no padding is necessary, since GDB doesn't know
      anything about alignment at the moment.  If this assumption bites
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 456b74d80df..8cdd6b124c4 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -483,33 +483,34 @@  build_go_types (struct gdbarch *gdbarch)
 {
   struct builtin_go_type *builtin_go_type = new struct builtin_go_type;
 
+  type_allocator alloc (gdbarch);
   builtin_go_type->builtin_void = builtin_type (gdbarch)->builtin_void;
   builtin_go_type->builtin_char
     = arch_character_type (gdbarch, 8, 1, "char");
   builtin_go_type->builtin_bool
     = arch_boolean_type (gdbarch, 8, 0, "bool");
   builtin_go_type->builtin_int
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int");
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int");
   builtin_go_type->builtin_uint
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "uint");
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "uint");
   builtin_go_type->builtin_uintptr
-    = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr");
+    = init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "uintptr");
   builtin_go_type->builtin_int8
-    = arch_integer_type (gdbarch, 8, 0, "int8");
+    = init_integer_type (alloc, 8, 0, "int8");
   builtin_go_type->builtin_int16
-    = arch_integer_type (gdbarch, 16, 0, "int16");
+    = init_integer_type (alloc, 16, 0, "int16");
   builtin_go_type->builtin_int32
-    = arch_integer_type (gdbarch, 32, 0, "int32");
+    = init_integer_type (alloc, 32, 0, "int32");
   builtin_go_type->builtin_int64
-    = arch_integer_type (gdbarch, 64, 0, "int64");
+    = init_integer_type (alloc, 64, 0, "int64");
   builtin_go_type->builtin_uint8
-    = arch_integer_type (gdbarch, 8, 1, "uint8");
+    = init_integer_type (alloc, 8, 1, "uint8");
   builtin_go_type->builtin_uint16
-    = arch_integer_type (gdbarch, 16, 1, "uint16");
+    = init_integer_type (alloc, 16, 1, "uint16");
   builtin_go_type->builtin_uint32
-    = arch_integer_type (gdbarch, 32, 1, "uint32");
+    = init_integer_type (alloc, 32, 1, "uint32");
   builtin_go_type->builtin_uint64
-    = arch_integer_type (gdbarch, 64, 1, "uint64");
+    = init_integer_type (alloc, 64, 1, "uint64");
   builtin_go_type->builtin_float32
     = arch_float_type (gdbarch, 32, "float32", floatformats_ieee_single);
   builtin_go_type->builtin_float64
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 9192fc99be3..d66534e9182 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -277,13 +277,13 @@  linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
 
   type_allocator alloc (gdbarch);
 
-  int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+  int_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 			 	0, "int");
-  uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+  uint_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 				 1, "unsigned int");
-  long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+  long_type = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 				 0, "long");
-  short_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+  short_type = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
 				 0, "short");
   void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
 
@@ -1742,8 +1742,9 @@  linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
 				    int *note_size)
 {
   struct linux_make_mappings_data mapping_data;
+  type_allocator alloc (gdbarch);
   struct type *long_type
-    = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long");
+    = init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long");
   gdb_byte buf[sizeof (ULONGEST)];
 
   auto_obstack data_obstack, filename_obstack;
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 72d0b58d675..218867d408e 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -281,11 +281,13 @@  build_m2_types (struct gdbarch *gdbarch)
 {
   struct builtin_m2_type *builtin_m2_type = new struct builtin_m2_type;
 
+  type_allocator alloc (gdbarch);
+
   /* Modula-2 "pervasive" types.  NOTE:  these can be redefined!!! */
   builtin_m2_type->builtin_int
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "INTEGER");
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "INTEGER");
   builtin_m2_type->builtin_card
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "CARDINAL");
+    = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "CARDINAL");
   builtin_m2_type->builtin_real
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL",
 		       gdbarch_float_format (gdbarch));
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index e500ba88a42..65d5df330b1 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -201,12 +201,12 @@  make_types (struct gdbarch *arch)
   tdep->code_addr_reg_type
     = arch_pointer_type (arch, code_addr_reg_bits, type_name, tdep->func_voyd);
 
-  tdep->uint8  = arch_integer_type (arch,  8, 1, "uint8_t");
-  tdep->uint16 = arch_integer_type (arch, 16, 1, "uint16_t");
-  tdep->int8   = arch_integer_type (arch,  8, 0, "int8_t");
-  tdep->int16  = arch_integer_type (arch, 16, 0, "int16_t");
-  tdep->int32  = arch_integer_type (arch, 32, 0, "int32_t");
-  tdep->int64  = arch_integer_type (arch, 64, 0, "int64_t");
+  tdep->uint8  = init_integer_type (alloc,  8, 1, "uint8_t");
+  tdep->uint16 = init_integer_type (alloc, 16, 1, "uint16_t");
+  tdep->int8   = init_integer_type (alloc,  8, 0, "int8_t");
+  tdep->int16  = init_integer_type (alloc, 16, 0, "int16_t");
+  tdep->int32  = init_integer_type (alloc, 32, 0, "int32_t");
+  tdep->int64  = init_integer_type (alloc, 64, 0, "int64_t");
 }
 
 
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ae563f83457..84b513d5783 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1400,36 +1400,36 @@  basic_type (int bt, struct objfile *objfile)
       break;
 
     case btChar:
-      tp = init_integer_type (objfile, 8, 0, "char");
+      tp = init_integer_type (alloc, 8, 0, "char");
       tp->set_has_no_signedness (true);
       break;
 
     case btUChar:
-      tp = init_integer_type (objfile, 8, 1, "unsigned char");
+      tp = init_integer_type (alloc, 8, 1, "unsigned char");
       break;
 
     case btShort:
-      tp = init_integer_type (objfile, 16, 0, "short");
+      tp = init_integer_type (alloc, 16, 0, "short");
       break;
 
     case btUShort:
-      tp = init_integer_type (objfile, 16, 1, "unsigned short");
+      tp = init_integer_type (alloc, 16, 1, "unsigned short");
       break;
 
     case btInt:
-      tp = init_integer_type (objfile, 32, 0, "int");
+      tp = init_integer_type (alloc, 32, 0, "int");
       break;
 
    case btUInt:
-      tp = init_integer_type (objfile, 32, 1, "unsigned int");
+      tp = init_integer_type (alloc, 32, 1, "unsigned int");
       break;
 
     case btLong:
-      tp = init_integer_type (objfile, 32, 0, "long");
+      tp = init_integer_type (alloc, 32, 0, "long");
       break;
 
     case btULong:
-      tp = init_integer_type (objfile, 32, 1, "unsigned long");
+      tp = init_integer_type (alloc, 32, 1, "unsigned long");
       break;
 
     case btFloat:
@@ -1454,7 +1454,7 @@  basic_type (int bt, struct objfile *objfile)
       /* We use TYPE_CODE_INT to print these as integers.  Does this do any
 	 good?  Would we be better off with TYPE_CODE_ERROR?  Should
 	 TYPE_CODE_ERROR print things in hex if it knows the size?  */
-      tp = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
+      tp = init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0,
 			      "fixed decimal");
       break;
 
@@ -1474,19 +1474,19 @@  basic_type (int bt, struct objfile *objfile)
       break;
 
     case btLong64:
-      tp = init_integer_type (objfile, 64, 0, "long");
+      tp = init_integer_type (alloc, 64, 0, "long");
       break;
 
     case btULong64:
-      tp = init_integer_type (objfile, 64, 1, "unsigned long");
+      tp = init_integer_type (alloc, 64, 1, "unsigned long");
       break;
 
     case btLongLong64:
-      tp = init_integer_type (objfile, 64, 0, "long long");
+      tp = init_integer_type (alloc, 64, 0, "long long");
       break;
 
     case btULongLong64:
-      tp = init_integer_type (objfile, 64, 1, "unsigned long long");
+      tp = init_integer_type (alloc, 64, 1, "unsigned long long");
       break;
 
     case btAdr64:
@@ -1495,11 +1495,11 @@  basic_type (int bt, struct objfile *objfile)
       break;
 
     case btInt64:
-      tp = init_integer_type (objfile, 64, 0, "int");
+      tp = init_integer_type (alloc, 64, 0, "int");
       break;
 
     case btUInt64:
-      tp = init_integer_type (objfile, 64, 1, "unsigned int");
+      tp = init_integer_type (alloc, 64, 1, "unsigned int");
       break;
 
     default:
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 9b5304f588f..94f865e5ad5 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -909,21 +909,22 @@  class opencl_language : public language_defn
 
     struct type *el_type, *char_type, *int_type;
 
-    char_type = el_type = add (arch_integer_type (gdbarch, 8, 0, "char"));
+    type_allocator alloc (gdbarch);
+    char_type = el_type = add (init_integer_type (alloc, 8, 0, "char"));
     BUILD_OCL_VTYPES (char, el_type);
-    el_type = add (arch_integer_type (gdbarch, 8, 1, "uchar"));
+    el_type = add (init_integer_type (alloc, 8, 1, "uchar"));
     BUILD_OCL_VTYPES (uchar, el_type);
-    el_type = add (arch_integer_type (gdbarch, 16, 0, "short"));
+    el_type = add (init_integer_type (alloc, 16, 0, "short"));
     BUILD_OCL_VTYPES (short, el_type);
-    el_type = add (arch_integer_type (gdbarch, 16, 1, "ushort"));
+    el_type = add (init_integer_type (alloc, 16, 1, "ushort"));
     BUILD_OCL_VTYPES (ushort, el_type);
-    int_type = el_type = add (arch_integer_type (gdbarch, 32, 0, "int"));
+    int_type = el_type = add (init_integer_type (alloc, 32, 0, "int"));
     BUILD_OCL_VTYPES (int, el_type);
-    el_type = add (arch_integer_type (gdbarch, 32, 1, "uint"));
+    el_type = add (init_integer_type (alloc, 32, 1, "uint"));
     BUILD_OCL_VTYPES (uint, el_type);
-    el_type = add (arch_integer_type (gdbarch, 64, 0, "long"));
+    el_type = add (init_integer_type (alloc, 64, 0, "long"));
     BUILD_OCL_VTYPES (long, el_type);
-    el_type = add (arch_integer_type (gdbarch, 64, 1, "ulong"));
+    el_type = add (init_integer_type (alloc, 64, 1, "ulong"));
     BUILD_OCL_VTYPES (ulong, el_type);
     el_type = add (arch_float_type (gdbarch, 16, "half", floatformats_ieee_half));
     BUILD_OCL_VTYPES (half, el_type);
@@ -933,14 +934,14 @@  class opencl_language : public language_defn
     BUILD_OCL_VTYPES (double, el_type);
 
     add (arch_boolean_type (gdbarch, 8, 1, "bool"));
-    add (arch_integer_type (gdbarch, 8, 1, "unsigned char"));
-    add (arch_integer_type (gdbarch, 16, 1, "unsigned short"));
-    add (arch_integer_type (gdbarch, 32, 1, "unsigned int"));
-    add (arch_integer_type (gdbarch, 64, 1, "unsigned long"));
-    add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "size_t"));
-    add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "ptrdiff_t"));
-    add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr_t"));
-    add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"));
+    add (init_integer_type (alloc, 8, 1, "unsigned char"));
+    add (init_integer_type (alloc, 16, 1, "unsigned short"));
+    add (init_integer_type (alloc, 32, 1, "unsigned int"));
+    add (init_integer_type (alloc, 64, 1, "unsigned long"));
+    add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "size_t"));
+    add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 0, "ptrdiff_t"));
+    add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 0, "intptr_t"));
+    add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"));
     add (builtin_type (gdbarch)->builtin_void);
 
     /* Type of elements of strings.  */
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 1177215490f..ccb031bbfde 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1411,12 +1411,12 @@  rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Initialize types.  */
   type_allocator alloc (gdbarch);
   tdep->rl78_void = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
-  tdep->rl78_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8_t");
-  tdep->rl78_int8 = arch_integer_type (gdbarch, 8, 0, "int8_t");
-  tdep->rl78_uint16 = arch_integer_type (gdbarch, 16, 1, "uint16_t");
-  tdep->rl78_int16 = arch_integer_type (gdbarch, 16, 0, "int16_t");
-  tdep->rl78_uint32 = arch_integer_type (gdbarch, 32, 1, "uint32_t");
-  tdep->rl78_int32 = arch_integer_type (gdbarch, 32, 0, "int32_t");
+  tdep->rl78_uint8 = init_integer_type (alloc, 8, 1, "uint8_t");
+  tdep->rl78_int8 = init_integer_type (alloc, 8, 0, "int8_t");
+  tdep->rl78_uint16 = init_integer_type (alloc, 16, 1, "uint16_t");
+  tdep->rl78_int16 = init_integer_type (alloc, 16, 0, "int16_t");
+  tdep->rl78_uint32 = init_integer_type (alloc, 32, 1, "uint32_t");
+  tdep->rl78_int32 = init_integer_type (alloc, 32, 0, "int32_t");
 
   tdep->rl78_data_pointer
     = arch_pointer_type (gdbarch, 16, "rl78_data_addr_t", tdep->rl78_void);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 82004da53d4..608799cc662 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1594,27 +1594,28 @@  rust_language::language_arch_info (struct gdbarch *gdbarch,
     return t;
   };
 
+  type_allocator alloc (gdbarch);
   struct type *bool_type
     = add (arch_boolean_type (gdbarch, 8, 1, "bool"));
   add (arch_character_type (gdbarch, 32, 1, "char"));
-  add (arch_integer_type (gdbarch, 8, 0, "i8"));
+  add (init_integer_type (alloc, 8, 0, "i8"));
   struct type *u8_type
-    = add (arch_integer_type (gdbarch, 8, 1, "u8"));
-  add (arch_integer_type (gdbarch, 16, 0, "i16"));
-  add (arch_integer_type (gdbarch, 16, 1, "u16"));
-  add (arch_integer_type (gdbarch, 32, 0, "i32"));
-  add (arch_integer_type (gdbarch, 32, 1, "u32"));
-  add (arch_integer_type (gdbarch, 64, 0, "i64"));
-  add (arch_integer_type (gdbarch, 64, 1, "u64"));
+    = add (init_integer_type (alloc, 8, 1, "u8"));
+  add (init_integer_type (alloc, 16, 0, "i16"));
+  add (init_integer_type (alloc, 16, 1, "u16"));
+  add (init_integer_type (alloc, 32, 0, "i32"));
+  add (init_integer_type (alloc, 32, 1, "u32"));
+  add (init_integer_type (alloc, 64, 0, "i64"));
+  add (init_integer_type (alloc, 64, 1, "u64"));
 
   unsigned int length = 8 * builtin->builtin_data_ptr->length ();
-  add (arch_integer_type (gdbarch, length, 0, "isize"));
+  add (init_integer_type (alloc, length, 0, "isize"));
   struct type *usize_type
-    = add (arch_integer_type (gdbarch, length, 1, "usize"));
+    = add (init_integer_type (alloc, length, 1, "usize"));
 
   add (arch_float_type (gdbarch, 32, "f32", floatformats_ieee_single));
   add (arch_float_type (gdbarch, 64, "f64", floatformats_ieee_double));
-  add (arch_integer_type (gdbarch, 0, 1, "()"));
+  add (init_integer_type (alloc, 0, 1, "()"));
 
   struct type *tem = make_cv_type (1, 0, u8_type, NULL);
   add (rust_slice_type ("&str", tem, usize_type));
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 7a31d559831..6270f48bebb 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2090,35 +2090,35 @@  rs6000_builtin_type (int typenum, struct objfile *objfile)
 	 is other than 32 bits, then it should use a new negative type
 	 number (or avoid negative type numbers for that case).
 	 See stabs.texinfo.  */
-      rettype = init_integer_type (objfile, 32, 0, "int");
+      rettype = init_integer_type (alloc, 32, 0, "int");
       break;
     case 2:
-      rettype = init_integer_type (objfile, 8, 0, "char");
+      rettype = init_integer_type (alloc, 8, 0, "char");
       rettype->set_has_no_signedness (true);
       break;
     case 3:
-      rettype = init_integer_type (objfile, 16, 0, "short");
+      rettype = init_integer_type (alloc, 16, 0, "short");
       break;
     case 4:
-      rettype = init_integer_type (objfile, 32, 0, "long");
+      rettype = init_integer_type (alloc, 32, 0, "long");
       break;
     case 5:
-      rettype = init_integer_type (objfile, 8, 1, "unsigned char");
+      rettype = init_integer_type (alloc, 8, 1, "unsigned char");
       break;
     case 6:
-      rettype = init_integer_type (objfile, 8, 0, "signed char");
+      rettype = init_integer_type (alloc, 8, 0, "signed char");
       break;
     case 7:
-      rettype = init_integer_type (objfile, 16, 1, "unsigned short");
+      rettype = init_integer_type (alloc, 16, 1, "unsigned short");
       break;
     case 8:
-      rettype = init_integer_type (objfile, 32, 1, "unsigned int");
+      rettype = init_integer_type (alloc, 32, 1, "unsigned int");
       break;
     case 9:
-      rettype = init_integer_type (objfile, 32, 1, "unsigned");
+      rettype = init_integer_type (alloc, 32, 1, "unsigned");
       break;
     case 10:
-      rettype = init_integer_type (objfile, 32, 1, "unsigned long");
+      rettype = init_integer_type (alloc, 32, 1, "unsigned long");
       break;
     case 11:
       rettype = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
@@ -2141,7 +2141,7 @@  rs6000_builtin_type (int typenum, struct objfile *objfile)
 				 floatformats_ieee_double);
       break;
     case 15:
-      rettype = init_integer_type (objfile, 32, 0, "integer");
+      rettype = init_integer_type (alloc, 32, 0, "integer");
       break;
     case 16:
       rettype = init_boolean_type (objfile, 32, 1, "boolean");
@@ -2183,28 +2183,28 @@  rs6000_builtin_type (int typenum, struct objfile *objfile)
 				   rs6000_builtin_type (13, objfile));
       break;
     case 27:
-      rettype = init_integer_type (objfile, 8, 0, "integer*1");
+      rettype = init_integer_type (alloc, 8, 0, "integer*1");
       break;
     case 28:
-      rettype = init_integer_type (objfile, 16, 0, "integer*2");
+      rettype = init_integer_type (alloc, 16, 0, "integer*2");
       break;
     case 29:
-      rettype = init_integer_type (objfile, 32, 0, "integer*4");
+      rettype = init_integer_type (alloc, 32, 0, "integer*4");
       break;
     case 30:
       rettype = init_character_type (objfile, 16, 0, "wchar");
       break;
     case 31:
-      rettype = init_integer_type (objfile, 64, 0, "long long");
+      rettype = init_integer_type (alloc, 64, 0, "long long");
       break;
     case 32:
-      rettype = init_integer_type (objfile, 64, 1, "unsigned long long");
+      rettype = init_integer_type (alloc, 64, 1, "unsigned long long");
       break;
     case 33:
-      rettype = init_integer_type (objfile, 64, 1, "logical*8");
+      rettype = init_integer_type (alloc, 64, 1, "logical*8");
       break;
     case 34:
-      rettype = init_integer_type (objfile, 64, 0, "integer*8");
+      rettype = init_integer_type (alloc, 64, 0, "integer*8");
       break;
     }
   negative_types[-typenum] = rettype;
@@ -3761,7 +3761,7 @@  read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile
   if (boolean_type)
     return init_boolean_type (objfile, type_bits, unsigned_type, NULL);
   else
-    return init_integer_type (objfile, type_bits, unsigned_type, NULL);
+    return init_integer_type (alloc, type_bits, unsigned_type, NULL);
 }
 
 static struct type *
@@ -4059,7 +4059,7 @@  read_range_type (const char **pp, int typenums[2], int type_size,
 	}
 
       if (got_signed || got_unsigned)
-	return init_integer_type (objfile, nbits, got_unsigned, NULL);
+	return init_integer_type (alloc, nbits, got_unsigned, NULL);
       else
 	return error_type (pp, objfile);
     }
@@ -4105,14 +4105,14 @@  read_range_type (const char **pp, int typenums[2], int type_size,
 	  bits = gdbarch_int_bit (gdbarch);
 	}
 
-      return init_integer_type (objfile, bits, 1, NULL);
+      return init_integer_type (alloc, bits, 1, NULL);
     }
 
   /* Special case: char is defined (Who knows why) as a subrange of
      itself with range 0-127.  */
   else if (self_subrange && n2 == 0 && n3 == 127)
     {
-      struct type *type = init_integer_type (objfile, TARGET_CHAR_BIT,
+      struct type *type = init_integer_type (alloc, TARGET_CHAR_BIT,
 					     0, NULL);
       type->set_has_no_signedness (true);
       return type;
@@ -4126,7 +4126,7 @@  read_range_type (const char **pp, int typenums[2], int type_size,
 
       if (n3 < 0)
 	/* n3 actually gives the size.  */
-	return init_integer_type (objfile, -n3 * TARGET_CHAR_BIT, 1, NULL);
+	return init_integer_type (alloc, -n3 * TARGET_CHAR_BIT, 1, NULL);
 
       /* Is n3 == 2**(8n)-1 for some integer n?  Then it's an
 	 unsigned n-byte integer.  But do require n to be a power of
@@ -4140,7 +4140,7 @@  read_range_type (const char **pp, int typenums[2], int type_size,
 	  bits >>= 8;
 	if (bits == 0
 	    && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
-	  return init_integer_type (objfile, bytes * TARGET_CHAR_BIT, 1, NULL);
+	  return init_integer_type (alloc, bytes * TARGET_CHAR_BIT, 1, NULL);
       }
     }
   /* I think this is for Convex "long long".  Since I don't know whether
@@ -4150,15 +4150,15 @@  read_range_type (const char **pp, int typenums[2], int type_size,
 	   && (self_subrange
 	       || n2 == -gdbarch_long_long_bit
 			  (gdbarch) / TARGET_CHAR_BIT))
-    return init_integer_type (objfile, -n2 * TARGET_CHAR_BIT, 0, NULL);
+    return init_integer_type (alloc, -n2 * TARGET_CHAR_BIT, 0, NULL);
   else if (n2 == -n3 - 1)
     {
       if (n3 == 0x7f)
-	return init_integer_type (objfile, 8, 0, NULL);
+	return init_integer_type (alloc, 8, 0, NULL);
       if (n3 == 0x7fff)
-	return init_integer_type (objfile, 16, 0, NULL);
+	return init_integer_type (alloc, 16, 0, NULL);
       if (n3 == 0x7fffffff)
-	return init_integer_type (objfile, 32, 0, NULL);
+	return init_integer_type (alloc, 32, 0, NULL);
     }
 
   /* We have a real range type on our hands.  Allocate space and
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 5a58aa37953..4a08dd48c65 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -216,13 +216,13 @@  windows_get_tlb_type (struct gdbarch *gdbarch)
 
   type_allocator alloc (gdbarch);
 
-  dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
+  dword_ptr_type = init_integer_type (alloc, gdbarch_ptr_bit (gdbarch),
 				 1, "DWORD_PTR");
-  dword32_type = arch_integer_type (gdbarch, 32,
+  dword32_type = init_integer_type (alloc, 32,
 				 1, "DWORD32");
-  word_type = arch_integer_type (gdbarch, 16,
+  word_type = init_integer_type (alloc, 16,
 				 1, "WORD");
-  wchar_type = arch_integer_type (gdbarch, 16,
+  wchar_type = init_integer_type (alloc, 16,
 				  1, "wchar_t");
   void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
   wchar_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
@@ -810,11 +810,12 @@  windows_get_siginfo_type (struct gdbarch *gdbarch)
   if (windows_gdbarch_data->siginfo_type != NULL)
     return windows_gdbarch_data->siginfo_type;
 
-  dword_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+  type_allocator alloc (gdbarch);
+  dword_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
 				  1, "DWORD");
   pvoid_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "PVOID",
 				  builtin_type (gdbarch)->builtin_void);
-  ulongptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
+  ulongptr_type = init_integer_type (alloc, gdbarch_ptr_bit (gdbarch),
 				     1, "ULONG_PTR");
 
   /* ExceptionCode value names */
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 092ae088932..a47a2987499 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -312,8 +312,9 @@  xtensa_register_type (struct gdbarch *gdbarch, int regnum)
 		  tp->next = tdep->type_entries;
 		  tdep->type_entries = tp;
 		  tp->size = size;
+		  type_allocator alloc (gdbarch);
 		  tp->virtual_type
-		    = arch_integer_type (gdbarch, size * 8, 1, name.c_str ());
+		    = init_integer_type (alloc, size * 8, 1, name.c_str ());
 		}
 
 	      reg->ctype = tp->virtual_type;