Files
swift-mirror/SwiftCompilerSources/Sources/SIL/Registration.swift
Erik Eckstein e4d227a5fb SwiftCompilerSources: add StoreBorrowInst and BorrowIntroducingInstruction
`BorrowIntroducingInstruction` is a protocol to which all instructions conform which start a borrow-scope which must be ended by `EndBorrowInst` instructions: `begin_borrow`, `load_borrow` and `store_borrow`
2023-11-27 16:20:47 +01:00

191 lines
6.4 KiB
Swift

//===--- Registration.swift - register SIL classes ------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import Basic
import SILBridging
private func register<T: AnyObject>(_ cl: T.Type) {
String(describing: cl)._withBridgedStringRef { nameStr in
let metatype = unsafeBitCast(cl, to: SwiftMetatype.self)
registerBridgedClass(nameStr, metatype)
}
}
public func registerSILClasses() {
Function.register()
register(BasicBlock.self)
register(GlobalVariable.self)
// The "unimplemented" registrations must be done before all other node
// registrations. In the order from super -> sub class.
register(UnimplementedInstruction.self)
register(UnimplementedSingleValueInst.self)
register(UnimplementedRefCountingInst.self)
register(MultipleValueInstructionResult.self)
register(Undef.self)
register(PlaceholderValue.self)
register(FunctionArgument.self)
register(Argument.self)
register(StoreInst.self)
register(StoreWeakInst.self)
register(StoreUnownedInst.self)
register(StoreBorrowInst.self)
register(AssignInst.self)
register(CopyAddrInst.self)
register(EndAccessInst.self)
register(EndBorrowInst.self)
register(CondFailInst.self)
register(HopToExecutorInst.self)
register(MarkUninitializedInst.self)
register(FixLifetimeInst.self)
register(DebugValueInst.self)
register(DebugStepInst.self)
register(UnconditionalCheckedCastAddrInst.self)
register(BeginDeallocRefInst.self)
register(EndInitLetRefInst.self)
register(EndApplyInst.self)
register(AbortApplyInst.self)
register(StrongRetainInst.self)
register(UnownedRetainInst.self)
register(RetainValueInst.self)
register(StrongReleaseInst.self)
register(UnownedReleaseInst.self)
register(ReleaseValueInst.self)
register(DestroyValueInst.self)
register(DestroyAddrInst.self)
register(EndLifetimeInst.self)
register(StrongCopyUnownedValueInst.self)
register(StrongCopyUnmanagedValueInst.self)
register(InjectEnumAddrInst.self)
register(DeallocStackInst.self)
register(DeallocPackInst.self)
register(DeallocStackRefInst.self)
register(DeallocRefInst.self)
register(DeallocPartialRefInst.self)
register(DeallocBoxInst.self)
register(DeallocExistentialBoxInst.self)
register(LoadInst.self)
register(LoadWeakInst.self)
register(LoadUnownedInst.self)
register(LoadBorrowInst.self)
register(BuiltinInst.self)
register(UpcastInst.self)
register(UncheckedRefCastInst.self)
register(UncheckedAddrCastInst.self)
register(UncheckedTrivialBitCastInst.self)
register(MarkUnresolvedNonCopyableValueInst.self)
register(ObjectInst.self)
register(TuplePackExtractInst.self)
register(DifferentiableFunctionInst.self)
register(LinearFunctionInst.self)
register(RawPointerToRefInst.self)
register(AddressToPointerInst.self)
register(PointerToAddressInst.self)
register(IndexAddrInst.self)
register(InitExistentialRefInst.self)
register(OpenExistentialRefInst.self)
register(InitExistentialValueInst.self)
register(OpenExistentialValueInst.self)
register(InitExistentialAddrInst.self)
register(OpenExistentialAddrInst.self)
register(OpenExistentialBoxInst.self)
register(OpenExistentialBoxValueInst.self)
register(InitExistentialMetatypeInst.self)
register(OpenExistentialMetatypeInst.self)
register(MetatypeInst.self)
register(ValueMetatypeInst.self)
register(ExistentialMetatypeInst.self)
register(FunctionRefInst.self)
register(DynamicFunctionRefInst.self)
register(PreviousDynamicFunctionRefInst.self)
register(GlobalAddrInst.self)
register(GlobalValueInst.self)
register(AllocGlobalInst.self)
register(IntegerLiteralInst.self)
register(FloatLiteralInst.self)
register(StringLiteralInst.self)
register(TupleInst.self)
register(TupleExtractInst.self)
register(TupleElementAddrInst.self)
register(StructInst.self)
register(StructExtractInst.self)
register(StructElementAddrInst.self)
register(EnumInst.self)
register(UncheckedEnumDataInst.self)
register(InitEnumDataAddrInst.self)
register(UncheckedTakeEnumDataAddrInst.self)
register(SelectEnumInst.self)
register(RefElementAddrInst.self)
register(RefTailAddrInst.self)
register(KeyPathInst.self)
register(UnconditionalCheckedCastInst.self)
register(ConvertFunctionInst.self)
register(ThinToThickFunctionInst.self)
register(ConvertEscapeToNoEscapeInst.self)
register(ObjCExistentialMetatypeToObjectInst.self)
register(ObjCMetatypeToObjectInst.self)
register(ValueToBridgeObjectInst.self)
register(MarkDependenceInst.self)
register(RefToBridgeObjectInst.self)
register(BridgeObjectToRefInst.self)
register(BridgeObjectToWordInst.self)
register(GetAsyncContinuationInst.self)
register(GetAsyncContinuationAddrInst.self)
register(BeginAccessInst.self)
register(BeginBorrowInst.self)
register(ProjectBoxInst.self)
register(CopyValueInst.self)
register(MoveValueInst.self)
register(DropDeinitInst.self)
register(EndCOWMutationInst.self)
register(ClassifyBridgeObjectInst.self)
register(PartialApplyInst.self)
register(ApplyInst.self)
register(ClassMethodInst.self)
register(SuperMethodInst.self)
register(ObjCMethodInst.self)
register(ObjCSuperMethodInst.self)
register(WitnessMethodInst.self)
register(IsUniqueInst.self)
register(IsEscapingClosureInst.self)
register(AllocStackInst.self)
register(AllocRefInst.self)
register(AllocRefDynamicInst.self)
register(AllocBoxInst.self)
register(AllocExistentialBoxInst.self)
register(BeginCOWMutationInst.self)
register(DestructureStructInst.self)
register(DestructureTupleInst.self)
register(BeginApplyInst.self)
register(UnreachableInst.self)
register(ReturnInst.self)
register(ThrowInst.self)
register(ThrowAddrInst.self)
register(YieldInst.self)
register(UnwindInst.self)
register(TryApplyInst.self)
register(BranchInst.self)
register(CondBranchInst.self)
register(SwitchValueInst.self)
register(SwitchEnumInst.self)
register(SwitchEnumAddrInst.self)
register(DynamicMethodBranchInst.self)
register(AwaitAsyncContinuationInst.self)
register(CheckedCastBranchInst.self)
register(CheckedCastAddrBranchInst.self)
}