mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:51:04 +01:00
This action was created to wrap any `MetaInstId` operand of an action instruction. This served two purposes: 1) It had a special hook in `OperandIsDependent` to allow it to be performed while it had a dependent operand (the reference to the instruction in the generic). 2) It created a `specific_inst` so that the downstream action saw an instruction in the specific instead of one in the generic. These are both replaced: the special case in `OperandIsDependent` for `RefineInstAction` is replaced by a special case for `MetaInstId`s in general, and the `SpecificInst` is now created as part of performing the downstream action, rather than as a separate step carried out beforehand. This simplifies the produced SemIR and reduces the number of splices significantly. It also prepares us to handle actions like initialization, where we don't actually want to create `SpecificInst`s immediately in the location where the action is performed, because they actually belong somewhere else in the IR. Assisted-by: Claude Opus 5 and Gemini via Antigravity
203 lines
7.9 KiB
C++
203 lines
7.9 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// This is an X-macro header. It does not use `#include` guards, and instead is
|
|
// designed to be `#include`ed after the x-macro is defined in order for its
|
|
// inclusion to expand to the desired output. Macro definitions are cleaned up
|
|
// at the end of this file.
|
|
//
|
|
// This macro should be defined before including this header:
|
|
// - CARBON_SEM_IR_INST_KIND(Name)
|
|
// Invoked for each kind of semantic instruction.
|
|
|
|
#ifndef CARBON_SEM_IR_INST_KIND
|
|
#error "Must define the x-macro to use this file."
|
|
#define CARBON_SEM_IR_INST_KIND(Name)
|
|
#endif
|
|
|
|
// For each instruction kind declared here there is a matching definition in
|
|
// `typed_insts.h`.
|
|
CARBON_SEM_IR_INST_KIND(AccessMemberAction)
|
|
CARBON_SEM_IR_INST_KIND(AccessOptionalMemberAction)
|
|
CARBON_SEM_IR_INST_KIND(AcquireValue)
|
|
CARBON_SEM_IR_INST_KIND(AdaptDecl)
|
|
CARBON_SEM_IR_INST_KIND(AddrOf)
|
|
CARBON_SEM_IR_INST_KIND(AliasBinding)
|
|
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(AutoType)
|
|
CARBON_SEM_IR_INST_KIND(BaseDecl)
|
|
CARBON_SEM_IR_INST_KIND(BlockArg)
|
|
CARBON_SEM_IR_INST_KIND(BoolLiteral)
|
|
CARBON_SEM_IR_INST_KIND(BoolType)
|
|
CARBON_SEM_IR_INST_KIND(BoundMethod)
|
|
CARBON_SEM_IR_INST_KIND(BoundMethodType)
|
|
CARBON_SEM_IR_INST_KIND(Branch)
|
|
CARBON_SEM_IR_INST_KIND(BranchIf)
|
|
CARBON_SEM_IR_INST_KIND(BranchWithArg)
|
|
CARBON_SEM_IR_INST_KIND(Call)
|
|
CARBON_SEM_IR_INST_KIND(CallAction)
|
|
CARBON_SEM_IR_INST_KIND(CalleePatternMatchAction)
|
|
CARBON_SEM_IR_INST_KIND(CallerPatternMatchAction)
|
|
CARBON_SEM_IR_INST_KIND(CharLiteralType)
|
|
CARBON_SEM_IR_INST_KIND(CharLiteralValue)
|
|
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(CompleteTypeWitness)
|
|
CARBON_SEM_IR_INST_KIND(CompoundMemberAccessAction)
|
|
CARBON_SEM_IR_INST_KIND(ConstType)
|
|
CARBON_SEM_IR_INST_KIND(ConvertAction)
|
|
CARBON_SEM_IR_INST_KIND(ConvertToCategoryAction)
|
|
CARBON_SEM_IR_INST_KIND(ConvertToValueAction)
|
|
CARBON_SEM_IR_INST_KIND(Converted)
|
|
CARBON_SEM_IR_INST_KIND(CppOverloadSetType)
|
|
CARBON_SEM_IR_INST_KIND(CppOverloadSetValue)
|
|
CARBON_SEM_IR_INST_KIND(CppTemplateNameType)
|
|
CARBON_SEM_IR_INST_KIND(CustomLayoutType)
|
|
CARBON_SEM_IR_INST_KIND(CustomWitness)
|
|
CARBON_SEM_IR_INST_KIND(DefaultValuePattern)
|
|
CARBON_SEM_IR_INST_KIND(Deref)
|
|
CARBON_SEM_IR_INST_KIND(EnclosingClassAccess)
|
|
CARBON_SEM_IR_INST_KIND(ErrorInst)
|
|
CARBON_SEM_IR_INST_KIND(ExportDecl)
|
|
CARBON_SEM_IR_INST_KIND(ExprPattern)
|
|
CARBON_SEM_IR_INST_KIND(FacetAccessType)
|
|
CARBON_SEM_IR_INST_KIND(FacetType)
|
|
CARBON_SEM_IR_INST_KIND(FacetValue)
|
|
CARBON_SEM_IR_INST_KIND(FieldDecl)
|
|
CARBON_SEM_IR_INST_KIND(FloatLiteralType)
|
|
CARBON_SEM_IR_INST_KIND(FloatLiteralValue)
|
|
CARBON_SEM_IR_INST_KIND(FloatType)
|
|
CARBON_SEM_IR_INST_KIND(FloatValue)
|
|
CARBON_SEM_IR_INST_KIND(FormParamPatternAction)
|
|
CARBON_SEM_IR_INST_KIND(FormType)
|
|
CARBON_SEM_IR_INST_KIND(FunctionDecl)
|
|
CARBON_SEM_IR_INST_KIND(FunctionType)
|
|
CARBON_SEM_IR_INST_KIND(FunctionTypeWithSelfType)
|
|
CARBON_SEM_IR_INST_KIND(GenericClassType)
|
|
CARBON_SEM_IR_INST_KIND(GenericInterfaceType)
|
|
CARBON_SEM_IR_INST_KIND(GenericNamedConstraintType)
|
|
CARBON_SEM_IR_INST_KIND(ImplDecl)
|
|
CARBON_SEM_IR_INST_KIND(ImplSelfWitness)
|
|
CARBON_SEM_IR_INST_KIND(ImplWitness)
|
|
CARBON_SEM_IR_INST_KIND(ImplWitnessAccess)
|
|
CARBON_SEM_IR_INST_KIND(ImplWitnessAccessSubstituted)
|
|
CARBON_SEM_IR_INST_KIND(ImplWitnessAssociatedConstant)
|
|
CARBON_SEM_IR_INST_KIND(ImplWitnessTable)
|
|
CARBON_SEM_IR_INST_KIND(ImportCppDecl)
|
|
CARBON_SEM_IR_INST_KIND(ImportDecl)
|
|
CARBON_SEM_IR_INST_KIND(ImportRefLoaded)
|
|
CARBON_SEM_IR_INST_KIND(ImportRefUnloaded)
|
|
CARBON_SEM_IR_INST_KIND(InPlaceInit)
|
|
CARBON_SEM_IR_INST_KIND(InitForm)
|
|
CARBON_SEM_IR_INST_KIND(InlineCppDecl)
|
|
CARBON_SEM_IR_INST_KIND(InstType)
|
|
CARBON_SEM_IR_INST_KIND(InstValue)
|
|
CARBON_SEM_IR_INST_KIND(IntLiteralType)
|
|
CARBON_SEM_IR_INST_KIND(IntType)
|
|
CARBON_SEM_IR_INST_KIND(IntValue)
|
|
CARBON_SEM_IR_INST_KIND(InterfaceDecl)
|
|
CARBON_SEM_IR_INST_KIND(InterfaceWithSelfDecl)
|
|
CARBON_SEM_IR_INST_KIND(LookupImplWitness)
|
|
CARBON_SEM_IR_INST_KIND(MarkInPlaceInit)
|
|
CARBON_SEM_IR_INST_KIND(MatchFirstDecl)
|
|
CARBON_SEM_IR_INST_KIND(MaybeUnformedType)
|
|
CARBON_SEM_IR_INST_KIND(NameBindingDecl)
|
|
CARBON_SEM_IR_INST_KIND(NamedConstraintDecl)
|
|
CARBON_SEM_IR_INST_KIND(NamedConstraintWithSelfDecl)
|
|
CARBON_SEM_IR_INST_KIND(NameRef)
|
|
CARBON_SEM_IR_INST_KIND(Namespace)
|
|
CARBON_SEM_IR_INST_KIND(NamespaceType)
|
|
CARBON_SEM_IR_INST_KIND(ObserveEquivalent)
|
|
CARBON_SEM_IR_INST_KIND(ObserveImpls)
|
|
CARBON_SEM_IR_INST_KIND(ObserveDecl)
|
|
CARBON_SEM_IR_INST_KIND(OutFormParamPatternAction)
|
|
CARBON_SEM_IR_INST_KIND(OutParam)
|
|
CARBON_SEM_IR_INST_KIND(OutParamPattern)
|
|
CARBON_SEM_IR_INST_KIND(PartialType)
|
|
CARBON_SEM_IR_INST_KIND(PatternType)
|
|
CARBON_SEM_IR_INST_KIND(PointerType)
|
|
CARBON_SEM_IR_INST_KIND(RefBindingPattern)
|
|
CARBON_SEM_IR_INST_KIND(RefForm)
|
|
CARBON_SEM_IR_INST_KIND(RefParam)
|
|
CARBON_SEM_IR_INST_KIND(RefParamPattern)
|
|
CARBON_SEM_IR_INST_KIND(RefReturn)
|
|
CARBON_SEM_IR_INST_KIND(RefReturnPattern)
|
|
CARBON_SEM_IR_INST_KIND(RefTagExpr)
|
|
CARBON_SEM_IR_INST_KIND(RequireCompleteType)
|
|
CARBON_SEM_IR_INST_KIND(RequireImplsDecl)
|
|
CARBON_SEM_IR_INST_KIND(RequireSpecificDefinition)
|
|
CARBON_SEM_IR_INST_KIND(RequireSpecificDefinitionType)
|
|
CARBON_SEM_IR_INST_KIND(RequirementBaseFacetType)
|
|
CARBON_SEM_IR_INST_KIND(RequirementEquivalent)
|
|
CARBON_SEM_IR_INST_KIND(RequirementImpls)
|
|
CARBON_SEM_IR_INST_KIND(RequirementRewrite)
|
|
CARBON_SEM_IR_INST_KIND(Return)
|
|
CARBON_SEM_IR_INST_KIND(ReturnExpr)
|
|
CARBON_SEM_IR_INST_KIND(ReturnSlot)
|
|
CARBON_SEM_IR_INST_KIND(ReturnSlotPattern)
|
|
CARBON_SEM_IR_INST_KIND(SpecificConstant)
|
|
CARBON_SEM_IR_INST_KIND(SpecificFunction)
|
|
CARBON_SEM_IR_INST_KIND(SpecificFunctionType)
|
|
CARBON_SEM_IR_INST_KIND(SpecificImplFunction)
|
|
CARBON_SEM_IR_INST_KIND(SpecificInst)
|
|
CARBON_SEM_IR_INST_KIND(SpliceBlock)
|
|
CARBON_SEM_IR_INST_KIND(SpliceInst)
|
|
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(StructType)
|
|
CARBON_SEM_IR_INST_KIND(StructValue)
|
|
CARBON_SEM_IR_INST_KIND(SymbolicBinding)
|
|
CARBON_SEM_IR_INST_KIND(SymbolicBindingPattern)
|
|
CARBON_SEM_IR_INST_KIND(TemplateInst)
|
|
CARBON_SEM_IR_INST_KIND(Temporary)
|
|
CARBON_SEM_IR_INST_KIND(TemporaryStorage)
|
|
CARBON_SEM_IR_INST_KIND(TupleAccess)
|
|
CARBON_SEM_IR_INST_KIND(TupleInit)
|
|
CARBON_SEM_IR_INST_KIND(TupleLiteral)
|
|
CARBON_SEM_IR_INST_KIND(TuplePattern)
|
|
CARBON_SEM_IR_INST_KIND(TupleType)
|
|
CARBON_SEM_IR_INST_KIND(TupleValue)
|
|
CARBON_SEM_IR_INST_KIND(TypeComponentOf)
|
|
CARBON_SEM_IR_INST_KIND(TypeLiteral)
|
|
CARBON_SEM_IR_INST_KIND(TypeOfInst)
|
|
CARBON_SEM_IR_INST_KIND(TypeType)
|
|
CARBON_SEM_IR_INST_KIND(UnaryOperatorNot)
|
|
CARBON_SEM_IR_INST_KIND(UnboundElementType)
|
|
CARBON_SEM_IR_INST_KIND(UninitializedValue)
|
|
CARBON_SEM_IR_INST_KIND(UnspecifiedValue)
|
|
CARBON_SEM_IR_INST_KIND(UnspecifiedValueType)
|
|
CARBON_SEM_IR_INST_KIND(UpdateInit)
|
|
CARBON_SEM_IR_INST_KIND(ValueAsRef)
|
|
CARBON_SEM_IR_INST_KIND(ValueBindingPattern)
|
|
CARBON_SEM_IR_INST_KIND(ValueForm)
|
|
CARBON_SEM_IR_INST_KIND(ValueOfInitializer)
|
|
CARBON_SEM_IR_INST_KIND(ValueParam)
|
|
CARBON_SEM_IR_INST_KIND(ValueParamPattern)
|
|
CARBON_SEM_IR_INST_KIND(ValueReturn)
|
|
CARBON_SEM_IR_INST_KIND(ValueReturnPattern)
|
|
CARBON_SEM_IR_INST_KIND(VarParamPattern)
|
|
CARBON_SEM_IR_INST_KIND(VarPattern)
|
|
CARBON_SEM_IR_INST_KIND(VarStorage)
|
|
CARBON_SEM_IR_INST_KIND(VtableDecl)
|
|
CARBON_SEM_IR_INST_KIND(VtableType)
|
|
CARBON_SEM_IR_INST_KIND(VtablePtr)
|
|
CARBON_SEM_IR_INST_KIND(WhereExpr)
|
|
CARBON_SEM_IR_INST_KIND(WitnessType)
|
|
CARBON_SEM_IR_INST_KIND(WrapperBinding)
|
|
CARBON_SEM_IR_INST_KIND(WrapperBindingPattern)
|
|
|
|
#undef CARBON_SEM_IR_INST_KIND
|
|
#undef CARBON_SEM_IR_BUILTIN_INST_KIND
|