Kaynağa Gözat

Use def file to avoid listing all non-type insts in type switches. (#3911)

Depends on #3910.
Richard Smith 2 yıl önce
ebeveyn
işleme
8f8277b450

+ 18 - 68
toolchain/check/context.cpp

@@ -939,70 +939,10 @@ class TypeCompleter {
   auto BuildValueRepr(SemIR::TypeId type_id, SemIR::Inst inst) const
       -> SemIR::ValueRepr {
     CARBON_KIND_SWITCH(inst) {
-      case SemIR::AdaptDecl::Kind:
-      case SemIR::AddrOf::Kind:
-      case SemIR::AddrPattern::Kind:
-      case SemIR::ArrayIndex::Kind:
-      case SemIR::ArrayInit::Kind:
-      case SemIR::AsCompatible::Kind:
-      case SemIR::Assign::Kind:
-      case SemIR::AssociatedConstantDecl::Kind:
-      case SemIR::AssociatedEntity::Kind:
-      case SemIR::BaseDecl::Kind:
-      case SemIR::BindAlias::Kind:
-      case SemIR::BindName::Kind:
-      case SemIR::BindValue::Kind:
-      case SemIR::BlockArg::Kind:
-      case SemIR::BoolLiteral::Kind:
-      case SemIR::BoundMethod::Kind:
-      case SemIR::Branch::Kind:
-      case SemIR::BranchIf::Kind:
-      case SemIR::BranchWithArg::Kind:
-      case SemIR::Call::Kind:
-      case SemIR::ClassDecl::Kind:
-      case SemIR::ClassElementAccess::Kind:
-      case SemIR::ClassInit::Kind:
-      case SemIR::Converted::Kind:
-      case SemIR::Deref::Kind:
-      case SemIR::ExternDecl::Kind:
-      case SemIR::FacetTypeAccess::Kind:
-      case SemIR::FloatLiteral::Kind:
-      case SemIR::FieldDecl::Kind:
-      case SemIR::FunctionDecl::Kind:
-      case SemIR::ImplDecl::Kind:
-      case SemIR::ImportRefLoaded::Kind:
-      case SemIR::ImportRefUnloaded::Kind:
-      case SemIR::ImportRefUsed::Kind:
-      case SemIR::InitializeFrom::Kind:
-      case SemIR::InterfaceDecl::Kind:
-      case SemIR::InterfaceWitness::Kind:
-      case SemIR::InterfaceWitnessAccess::Kind:
-      case SemIR::IntLiteral::Kind:
-      case SemIR::NameRef::Kind:
-      case SemIR::Namespace::Kind:
-      case SemIR::Param::Kind:
-      case SemIR::RealLiteral::Kind:
-      case SemIR::Return::Kind:
-      case SemIR::ReturnExpr::Kind:
-      case SemIR::SpliceBlock::Kind:
-      case SemIR::StringLiteral::Kind:
-      case SemIR::StructAccess::Kind:
-      case SemIR::StructTypeField::Kind:
-      case SemIR::StructLiteral::Kind:
-      case SemIR::StructInit::Kind:
-      case SemIR::StructValue::Kind:
-      case SemIR::Temporary::Kind:
-      case SemIR::TemporaryStorage::Kind:
-      case SemIR::TupleAccess::Kind:
-      case SemIR::TupleIndex::Kind:
-      case SemIR::TupleLiteral::Kind:
-      case SemIR::TupleInit::Kind:
-      case SemIR::TupleValue::Kind:
-      case SemIR::UnaryOperatorNot::Kind:
-      case SemIR::ValueAsRef::Kind:
-      case SemIR::ValueOfInitializer::Kind:
-      case SemIR::VarStorage::Kind:
-        CARBON_FATAL() << "Type refers to non-type inst " << inst;
+#define CARBON_SEM_IR_INST_KIND_TYPE(...)
+#define CARBON_SEM_IR_INST_KIND(Name) case SemIR::Name::Kind:
+#include "toolchain/sem_ir/inst_kind.def"
+      CARBON_FATAL() << "Type refers to non-type inst " << inst;
 
       case SemIR::ArrayType::Kind: {
         // For arrays, it's convenient to always use a pointer representation,
@@ -1031,21 +971,31 @@ class TypeCompleter {
         return MakePointerValueRepr(class_info.object_repr_id,
                                     SemIR::ValueRepr::ObjectAggregate);
       }
-      case SemIR::InterfaceType::Kind: {
-        // TODO: Should we model the value representation as a witness?
+      case SemIR::AssociatedEntityType::Kind:
+      case SemIR::InterfaceType::Kind:
+      case SemIR::UnboundElementType::Kind: {
+        // These types have no runtime operations, so we use an empty value
+        // representation.
+        //
+        // TODO: There is information we could model here:
+        // - For an interface, we could use a witness.
+        // - For an associated entity, we could use an index into the witness.
+        // - For an unbound element, we could use an index or offset.
         return MakeEmptyValueRepr();
       }
       case CARBON_KIND(SemIR::Builtin builtin): {
         return BuildBuiltinValueRepr(type_id, builtin);
       }
 
-      case SemIR::AssociatedEntityType::Kind:
       case SemIR::BindSymbolicName::Kind:
+      case SemIR::InterfaceWitnessAccess::Kind:
+        // For symbolic types, we arbitrarily pick a copy representation.
+        return MakeCopyValueRepr(type_id);
+
       case SemIR::ExternType::Kind:
       case SemIR::FloatType::Kind:
       case SemIR::IntType::Kind:
       case SemIR::PointerType::Kind:
-      case SemIR::UnboundElementType::Kind:
         return MakeCopyValueRepr(type_id);
 
       case CARBON_KIND(SemIR::ConstType const_type): {

+ 47 - 35
toolchain/lower/file_context.cpp

@@ -295,29 +295,8 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id)
 }
 
 auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* {
-  switch (inst_id.index) {
-    case SemIR::BuiltinKind::FloatType.AsInt():
-      // TODO: Handle different sizes.
-      return llvm::Type::getDoubleTy(*llvm_context_);
-    case SemIR::BuiltinKind::IntType.AsInt():
-      // TODO: Handle different sizes.
-      return llvm::Type::getInt32Ty(*llvm_context_);
-    case SemIR::BuiltinKind::BoolType.AsInt():
-      // TODO: We may want to have different representations for `bool` storage
-      // (`i8`) versus for `bool` values (`i1`).
-      return llvm::Type::getInt1Ty(*llvm_context_);
-    case SemIR::BuiltinKind::FunctionType.AsInt():
-    case SemIR::BuiltinKind::BoundMethodType.AsInt():
-    case SemIR::BuiltinKind::NamespaceType.AsInt():
-    case SemIR::BuiltinKind::WitnessType.AsInt():
-      // Return an empty struct as a placeholder.
-      return llvm::StructType::get(*llvm_context_);
-    default:
-      // Handled below.
-      break;
-  }
-
   auto inst = sem_ir_->insts().Get(inst_id);
+  // TODO: Use CARBON_KIND_SWITCH here.
   switch (inst.kind()) {
     case SemIR::ArrayType::Kind: {
       auto array_type = inst.As<SemIR::ArrayType>();
@@ -325,13 +304,33 @@ auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* {
           GetType(array_type.element_type_id),
           sem_ir_->GetArrayBoundValue(array_type.bound_id));
     }
-    case SemIR::AssociatedEntityType::Kind:
-      // No runtime operations are provided on an associated entity name, so use
-      // an empty representation.
-      return llvm::StructType::get(*llvm_context_);
-    case SemIR::BindSymbolicName::Kind:
-      // Treat non-monomorphized type bindings as opaque.
-      return llvm::StructType::get(*llvm_context_);
+    case SemIR::Builtin::Kind: {
+      switch (inst.As<SemIR::Builtin>().builtin_kind) {
+        case SemIR::BuiltinKind::Invalid:
+        case SemIR::BuiltinKind::Error:
+          CARBON_FATAL() << "Unexpected builtin type in lowering.";
+        case SemIR::BuiltinKind::TypeType:
+          return GetTypeType();
+        case SemIR::BuiltinKind::FloatType:
+          return llvm::Type::getDoubleTy(*llvm_context_);
+        case SemIR::BuiltinKind::IntType:
+          return llvm::Type::getInt32Ty(*llvm_context_);
+        case SemIR::BuiltinKind::BoolType:
+          // TODO: We may want to have different representations for `bool`
+          // storage
+          // (`i8`) versus for `bool` values (`i1`).
+          return llvm::Type::getInt1Ty(*llvm_context_);
+        case SemIR::BuiltinKind::StringType:
+          // TODO: Decide how we want to represent `StringType`.
+          return llvm::PointerType::get(*llvm_context_, 0);
+        case SemIR::BuiltinKind::BoundMethodType:
+        case SemIR::BuiltinKind::FunctionType:
+        case SemIR::BuiltinKind::NamespaceType:
+        case SemIR::BuiltinKind::WitnessType:
+          // Return an empty struct as a placeholder.
+          return llvm::StructType::get(*llvm_context_);
+      }
+    }
     case SemIR::ClassType::Kind: {
       auto object_repr_id = sem_ir_->classes()
                                 .Get(inst.As<SemIR::ClassType>().class_id)
@@ -340,10 +339,11 @@ auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* {
     }
     case SemIR::ConstType::Kind:
       return GetType(inst.As<SemIR::ConstType>().inner_id);
-    case SemIR::InterfaceType::Kind:
-      // Return an empty struct as a placeholder.
-      // TODO: Should we model an interface as a witness table?
-      return llvm::StructType::get(*llvm_context_);
+    case SemIR::ExternType::Kind:
+      CARBON_FATAL() << "Lowering extern types not supported.";
+    case SemIR::FloatType::Kind:
+      // TODO: Handle different sizes.
+      return llvm::Type::getDoubleTy(*llvm_context_);
     case SemIR::IntType::Kind: {
       auto width = sem_ir_->insts().TryGetAs<SemIR::IntLiteral>(
           inst.As<SemIR::IntType>().bit_width_id);
@@ -378,13 +378,25 @@ auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* {
       }
       return llvm::StructType::get(*llvm_context_, subtypes);
     }
+    case SemIR::AssociatedEntityType::Kind:
+    case SemIR::InterfaceType::Kind:
     case SemIR::UnboundElementType::Kind: {
       // Return an empty struct as a placeholder.
+      // TODO: Should we model an interface as a witness table, or an associated
+      // entity as an index?
       return llvm::StructType::get(*llvm_context_);
     }
-    default: {
-      CARBON_FATAL() << "Cannot use inst as type: " << inst_id << " " << inst;
+
+    // Treat non-monomorphized symbolic types as opaque.
+    case SemIR::BindSymbolicName::Kind:
+    case SemIR::InterfaceWitnessAccess::Kind: {
+      return llvm::StructType::get(*llvm_context_);
     }
+
+#define CARBON_SEM_IR_INST_KIND_TYPE(...)
+#define CARBON_SEM_IR_INST_KIND(Name) case SemIR::Name::Kind:
+#include "toolchain/sem_ir/inst_kind.def"
+      CARBON_FATAL() << "Cannot use inst as type: " << inst_id << " " << inst;
   }
 }
 

+ 4 - 63
toolchain/sem_ir/file.cpp

@@ -176,16 +176,14 @@ static auto GetTypePrecedence(InstKind kind) -> int {
   switch (kind) {
     case ArrayType::Kind:
     case AssociatedEntityType::Kind:
-    case BindAlias::Kind:
     case BindSymbolicName::Kind:
     case Builtin::Kind:
     case ClassType::Kind:
     case ExternType::Kind:
-    case FacetTypeAccess::Kind:
     case FloatType::Kind:
     case InterfaceType::Kind:
+    case InterfaceWitnessAccess::Kind:
     case IntType::Kind:
-    case NameRef::Kind:
     case StructType::Kind:
     case TupleType::Kind:
     case UnboundElementType::Kind:
@@ -195,66 +193,9 @@ static auto GetTypePrecedence(InstKind kind) -> int {
     case PointerType::Kind:
       return -2;
 
-    case AdaptDecl::Kind:
-    case AddrOf::Kind:
-    case AddrPattern::Kind:
-    case ArrayIndex::Kind:
-    case ArrayInit::Kind:
-    case AsCompatible::Kind:
-    case Assign::Kind:
-    case AssociatedConstantDecl::Kind:
-    case AssociatedEntity::Kind:
-    case BaseDecl::Kind:
-    case BindName::Kind:
-    case BindValue::Kind:
-    case BlockArg::Kind:
-    case BoolLiteral::Kind:
-    case BoundMethod::Kind:
-    case Branch::Kind:
-    case BranchIf::Kind:
-    case BranchWithArg::Kind:
-    case Call::Kind:
-    case ClassDecl::Kind:
-    case ClassElementAccess::Kind:
-    case ClassInit::Kind:
-    case Converted::Kind:
-    case Deref::Kind:
-    case ExternDecl::Kind:
-    case FieldDecl::Kind:
-    case FloatLiteral::Kind:
-    case FunctionDecl::Kind:
-    case ImplDecl::Kind:
-    case ImportRefLoaded::Kind:
-    case ImportRefUnloaded::Kind:
-    case ImportRefUsed::Kind:
-    case InitializeFrom::Kind:
-    case InterfaceDecl::Kind:
-    case InterfaceWitness::Kind:
-    case InterfaceWitnessAccess::Kind:
-    case IntLiteral::Kind:
-    case Namespace::Kind:
-    case Param::Kind:
-    case RealLiteral::Kind:
-    case Return::Kind:
-    case ReturnExpr::Kind:
-    case SpliceBlock::Kind:
-    case StringLiteral::Kind:
-    case StructAccess::Kind:
-    case StructTypeField::Kind:
-    case StructLiteral::Kind:
-    case StructInit::Kind:
-    case StructValue::Kind:
-    case Temporary::Kind:
-    case TemporaryStorage::Kind:
-    case TupleAccess::Kind:
-    case TupleIndex::Kind:
-    case TupleLiteral::Kind:
-    case TupleInit::Kind:
-    case TupleValue::Kind:
-    case UnaryOperatorNot::Kind:
-    case ValueAsRef::Kind:
-    case ValueOfInitializer::Kind:
-    case VarStorage::Kind:
+#define CARBON_SEM_IR_INST_KIND_TYPE(...)
+#define CARBON_SEM_IR_INST_KIND(Name) case SemIR::Name::Kind:
+#include "toolchain/sem_ir/inst_kind.def"
       CARBON_FATAL() << "GetTypePrecedence for non-type inst kind " << kind;
   }
 }

+ 100 - 77
toolchain/sem_ir/inst_kind.def

@@ -10,89 +10,112 @@
 // This macro should be defined before including this header:
 // - CARBON_SEM_IR_INST_KIND(Name)
 //   Invoked for each kind of semantic instruction.
+//
+// The invocation of the above macro will be wrapped in one of these, which by
+// default expand to their argument:
+// - CARBON_SEM_IR_INST_KIND_TYPE(...)
+//   Invoked for each instruction that might define a type constant.
+// - CARBON_SEM_IR_INST_KIND_NOT_TYPE(...)
+//   Invoked for each instruction that can never define a type constant. Note
+//   that such instructions can still have type `type`, but are not the
+//   canonical definition of any type.
+// Defining these is optional.
 
 #ifndef CARBON_SEM_IR_INST_KIND
 #error "Must define the x-macro to use this file."
 #endif
 
+#ifndef CARBON_SEM_IR_INST_KIND_NOT_TYPE
+#define CARBON_SEM_IR_INST_KIND_NOT_TYPE(...) __VA_ARGS__
+#endif
+#ifndef CARBON_SEM_IR_INST_KIND_TYPE
+#define CARBON_SEM_IR_INST_KIND_TYPE(...) __VA_ARGS__
+#endif
+
+#define CARBON_SEM_IR_INST_KIND_IMPL(Name, IsType) \
+  CARBON_SEM_IR_INST_KIND_##IsType(CARBON_SEM_IR_INST_KIND(Name))
+
 // For each instruction kind declared here there is a matching definition in
 // `typed_insts.h`.
-CARBON_SEM_IR_INST_KIND(AdaptDecl)
-CARBON_SEM_IR_INST_KIND(AddrOf)
-CARBON_SEM_IR_INST_KIND(AddrPattern)
-CARBON_SEM_IR_INST_KIND(ArrayIndex)
-CARBON_SEM_IR_INST_KIND(ArrayInit)
-CARBON_SEM_IR_INST_KIND(ArrayType)
-CARBON_SEM_IR_INST_KIND(AsCompatible)
-CARBON_SEM_IR_INST_KIND(Assign)
-CARBON_SEM_IR_INST_KIND(AssociatedConstantDecl)
-CARBON_SEM_IR_INST_KIND(AssociatedEntity)
-CARBON_SEM_IR_INST_KIND(AssociatedEntityType)
-CARBON_SEM_IR_INST_KIND(BaseDecl)
-CARBON_SEM_IR_INST_KIND(BindAlias)
-CARBON_SEM_IR_INST_KIND(BindName)
-CARBON_SEM_IR_INST_KIND(BindSymbolicName)
-CARBON_SEM_IR_INST_KIND(BindValue)
-CARBON_SEM_IR_INST_KIND(BlockArg)
-CARBON_SEM_IR_INST_KIND(BoolLiteral)
-CARBON_SEM_IR_INST_KIND(BoundMethod)
-CARBON_SEM_IR_INST_KIND(Branch)
-CARBON_SEM_IR_INST_KIND(BranchIf)
-CARBON_SEM_IR_INST_KIND(BranchWithArg)
-CARBON_SEM_IR_INST_KIND(Builtin)
-CARBON_SEM_IR_INST_KIND(Call)
-CARBON_SEM_IR_INST_KIND(ClassDecl)
-CARBON_SEM_IR_INST_KIND(ClassElementAccess)
-CARBON_SEM_IR_INST_KIND(ClassInit)
-CARBON_SEM_IR_INST_KIND(ClassType)
-CARBON_SEM_IR_INST_KIND(ConstType)
-CARBON_SEM_IR_INST_KIND(Converted)
-CARBON_SEM_IR_INST_KIND(Deref)
-CARBON_SEM_IR_INST_KIND(ExternDecl)
-CARBON_SEM_IR_INST_KIND(ExternType)
-CARBON_SEM_IR_INST_KIND(FacetTypeAccess)
-CARBON_SEM_IR_INST_KIND(FloatLiteral)
-CARBON_SEM_IR_INST_KIND(FloatType)
-CARBON_SEM_IR_INST_KIND(FieldDecl)
-CARBON_SEM_IR_INST_KIND(FunctionDecl)
-CARBON_SEM_IR_INST_KIND(ImplDecl)
-CARBON_SEM_IR_INST_KIND(ImportRefUnloaded)
-CARBON_SEM_IR_INST_KIND(ImportRefLoaded)
-CARBON_SEM_IR_INST_KIND(ImportRefUsed)
-CARBON_SEM_IR_INST_KIND(InitializeFrom)
-CARBON_SEM_IR_INST_KIND(InterfaceDecl)
-CARBON_SEM_IR_INST_KIND(InterfaceType)
-CARBON_SEM_IR_INST_KIND(InterfaceWitness)
-CARBON_SEM_IR_INST_KIND(InterfaceWitnessAccess)
-CARBON_SEM_IR_INST_KIND(IntLiteral)
-CARBON_SEM_IR_INST_KIND(IntType)
-CARBON_SEM_IR_INST_KIND(NameRef)
-CARBON_SEM_IR_INST_KIND(Namespace)
-CARBON_SEM_IR_INST_KIND(Param)
-CARBON_SEM_IR_INST_KIND(PointerType)
-CARBON_SEM_IR_INST_KIND(RealLiteral)
-CARBON_SEM_IR_INST_KIND(ReturnExpr)
-CARBON_SEM_IR_INST_KIND(Return)
-CARBON_SEM_IR_INST_KIND(SpliceBlock)
-CARBON_SEM_IR_INST_KIND(StringLiteral)
-CARBON_SEM_IR_INST_KIND(StructAccess)
-CARBON_SEM_IR_INST_KIND(StructInit)
-CARBON_SEM_IR_INST_KIND(StructLiteral)
-CARBON_SEM_IR_INST_KIND(StructTypeField)
-CARBON_SEM_IR_INST_KIND(StructType)
-CARBON_SEM_IR_INST_KIND(StructValue)
-CARBON_SEM_IR_INST_KIND(TemporaryStorage)
-CARBON_SEM_IR_INST_KIND(Temporary)
-CARBON_SEM_IR_INST_KIND(TupleAccess)
-CARBON_SEM_IR_INST_KIND(TupleIndex)
-CARBON_SEM_IR_INST_KIND(TupleInit)
-CARBON_SEM_IR_INST_KIND(TupleLiteral)
-CARBON_SEM_IR_INST_KIND(TupleType)
-CARBON_SEM_IR_INST_KIND(TupleValue)
-CARBON_SEM_IR_INST_KIND(UnaryOperatorNot)
-CARBON_SEM_IR_INST_KIND(UnboundElementType)
-CARBON_SEM_IR_INST_KIND(ValueAsRef)
-CARBON_SEM_IR_INST_KIND(ValueOfInitializer)
-CARBON_SEM_IR_INST_KIND(VarStorage)
+CARBON_SEM_IR_INST_KIND_IMPL(AdaptDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(AddrOf, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(AddrPattern, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ArrayIndex, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ArrayInit, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ArrayType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(AsCompatible, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Assign, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(AssociatedConstantDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(AssociatedEntity, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(AssociatedEntityType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BaseDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BindAlias, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BindName, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BindSymbolicName, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BindValue, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BlockArg, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BoolLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BoundMethod, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Branch, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BranchIf, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(BranchWithArg, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Builtin, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Call, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ClassDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ClassElementAccess, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ClassInit, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ClassType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ConstType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Converted, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Deref, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ExternDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ExternType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(FacetTypeAccess, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(FloatLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(FloatType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(FieldDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(FunctionDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ImplDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ImportRefUnloaded, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ImportRefLoaded, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ImportRefUsed, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(InitializeFrom, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(InterfaceDecl, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(InterfaceType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(InterfaceWitness, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(InterfaceWitnessAccess, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(IntLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(IntType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(NameRef, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Namespace, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Param, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(PointerType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(RealLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ReturnExpr, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Return, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(SpliceBlock, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StringLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StructAccess, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StructInit, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StructLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StructTypeField, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StructType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(StructValue, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TemporaryStorage, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(Temporary, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TupleAccess, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TupleIndex, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TupleInit, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TupleLiteral, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TupleType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(TupleValue, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(UnaryOperatorNot, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(UnboundElementType, TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ValueAsRef, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(ValueOfInitializer, NOT_TYPE)
+CARBON_SEM_IR_INST_KIND_IMPL(VarStorage, NOT_TYPE)
 
+#undef CARBON_SEM_IR_INST_KIND_NOT_TYPE
+#undef CARBON_SEM_IR_INST_KIND_TYPE
+#undef CARBON_SEM_IR_INST_KIND_IMPL
 #undef CARBON_SEM_IR_INST_KIND