|
|
@@ -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
|