-2184750d74d37580486e90df1284c07fdee91670
+81687fccc568a088fee8f627ddde599e17c648c2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
 
 String_index_expression::do_type()
 {
   if (this->end_ == NULL)
-    return Type::lookup_integer_type("uint8");
+    return Type::lookup_integer_type("byte");
   else
     return this->string_->type();
 }
 
   Expression* length_expr = Expression::make_integer_ul(s.length(), NULL, loc);
 
-  Type* byte_type = gogo->lookup_global("byte")->type_value();
+  Type* byte_type = Type::lookup_integer_type("byte");
   Array_type* array_type = Type::make_array_type(byte_type, length_expr);
   array_type->set_is_array_incomparable();
 
 
 
   // "byte" is an alias for "uint8".
   uint8_type->integer_type()->set_is_byte();
-  Named_object* byte_type = Named_object::make_type("byte", NULL, uint8_type,
-                                                   loc);
-  byte_type->type_value()->set_is_alias();
-  this->add_named_type(byte_type->type_value());
+  this->add_named_type(Type::make_integer_type_alias("byte", uint8_type));
 
   // "rune" is an alias for "int32".
   int32_type->integer_type()->set_is_rune();
-  Named_object* rune_type = Named_object::make_type("rune", NULL, int32_type,
-                                                   loc);
-  rune_type->type_value()->set_is_alias();
-  this->add_named_type(rune_type->type_value());
+  this->add_named_type(Type::make_integer_type_alias("rune", int32_type));
 
   this->add_named_type(Type::make_named_bool_type());
 
 
   Type* pvt = Type::make_pointer_type(Type::make_void_type());
   Type* uintptr_type = Type::lookup_integer_type("uintptr");
-  Type* byte_type = this->lookup_global("byte")->type_value();
+  Type* byte_type = Type::lookup_integer_type("byte");
   Type* pointer_byte_type = Type::make_pointer_type(byte_type);
   Struct_type* root_type =
     Type::make_builtin_struct_type(4,
 
   else if (range_type->is_string_type())
     {
       index_type = Type::lookup_integer_type("int");
-      value_type = gogo->lookup_global("rune")->type_value();
+      value_type = Type::lookup_integer_type("rune");
     }
   else if (range_type->map_type() != NULL)
     {
     rune_type = value_temp->type();
   else
     {
-      rune_type = gogo->lookup_global("rune")->type_value();
+      rune_type = Type::lookup_integer_type("rune");
       value_temp = Statement::make_temporary(rune_type, NULL, loc);
       init->add_statement(value_temp);
     }
 
   symname() const;
 
   Expression*
-  constructor(Gogo* gogo) const;
+  constructor() const;
 
  private:
   void
 // initialize the runtime ptrmask value.
 
 Expression*
-Ptrmask::constructor(Gogo* gogo) const
+Ptrmask::constructor() const
 {
   Location bloc = Linemap::predeclared_location();
-  Type* byte_type = gogo->lookup_global("byte")->type_value();
+  Type* byte_type = Type::lookup_integer_type("byte");
   Expression* len = Expression::make_integer_ul(this->bits_.size(), NULL,
                                                bloc);
   Array_type* at = Type::make_array_type(byte_type, len);
       return ins.first->second;
     }
 
-  Expression* val = ptrmask.constructor(gogo);
+  Expression* val = ptrmask.constructor();
   Translate_context context(gogo, NULL, NULL, NULL);
   context.set_is_const();
   Bexpression* bval = val->get_backend(&context);
   end();
 
   Expression*
-  constructor(Gogo* gogo) const;
+  constructor() const;
 
  private:
   void
 // Return an Expression for the bytes in a GC program.
 
 Expression*
-GCProg::constructor(Gogo* gogo) const
+GCProg::constructor() const
 {
   Location bloc = Linemap::predeclared_location();
 
 
   Type* uint32_type = Type::lookup_integer_type("uint32");
 
-  Type* byte_type = gogo->lookup_global("byte")->type_value();
+  Type* byte_type = Type::lookup_integer_type("byte");
   Expression* len = Expression::make_integer_ul(this->bytes_.size(), NULL,
                                                bloc);
   Array_type* at = Type::make_array_type(byte_type, len);
 
   go_assert(offset >= ptrdata && offset <= type_size);
 
-  return prog.constructor(gogo);
+  return prog.constructor();
 }
 
 // Return a composite literal for the uncommon type information for
   return abstract_type;
 }
 
+// Create an alias to an integer type.  This is used for byte and rune.
+
+Named_type*
+Integer_type::create_integer_type_alias(const char* name,
+                                       Named_type* real_type)
+{
+  std::string sname(name);
+  Named_object* no = Named_object::make_type(sname, NULL, real_type,
+                                            Linemap::predeclared_location());
+  Named_type* nt = no->type_value();
+  nt->set_is_alias();
+  std::pair<Named_integer_types::iterator, bool> ins =
+    Integer_type::named_integer_types.insert(std::make_pair(sname, nt));
+  go_assert(ins.second);
+  return nt;
+}
+
 // Integer type compatibility.
 
 bool
   return Integer_type::create_abstract_character_type();
 }
 
+// Make an integer type alias.
+
+Named_type*
+Type::make_integer_type_alias(const char* name, Named_type* real_type)
+{
+  return Integer_type::create_integer_type_alias(name, real_type);
+}
+
 // Look up an integer type.
 
 Named_type*
     {
       std::vector<Backend::Btyped_identifier> fields(2);
 
-      Type* b = gogo->lookup_global("byte")->type_value();
+      Type* b = Type::lookup_integer_type("byte");
       Type* pb = Type::make_pointer_type(b);
 
       // We aren't going to get back to this field to finish the
 
   make_integer_type(const char* name, bool is_unsigned, int bits,
                    int runtime_type_kind);
 
+  // Make a named integer type alias.  This is used for byte and rune.
+  static Named_type*
+  make_integer_type_alias(const char* name, Named_type* real_type);
+
   // Look up a named integer type.
   static Named_type*
   lookup_integer_type(const char* name);
   static Integer_type*
   create_abstract_character_type();
 
+  // Create an alias to an integer type.
+  static Named_type*
+  create_integer_type_alias(const char* name, Named_type* real_type);
+
   // Whether this is an abstract integer type.
   bool
   is_abstract() const
 
       Location bloc = Linemap::predeclared_location();
 
       Type* bool_type = Type::lookup_bool_type();
-      Array_type* pad_type = Type::make_array_type(this->lookup_global("byte")->type_value(),
-                                                  Expression::make_integer_ul(3, NULL, bloc));
+      Array_type* pad_type =
+       Type::make_array_type(Type::lookup_integer_type("byte"),
+                             Expression::make_integer_ul(3, NULL, bloc));
       Type* uint64_type = Type::lookup_integer_type("uint64");
       Type* wb_type = Type::make_builtin_struct_type(5,
                                                     "enabled", bool_type,