mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use the generic type lowering algorithm described in "docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion type to the type expected by the ABI. Change IRGen to use the swift calling convention (swiftcc) for native swift functions. Use the 'swiftself' attribute on self parameters and for closures contexts. Use the 'swifterror' parameter for swift error parameters. Change functions in the runtime that are called as native swift functions to use the swift calling convention. rdar://19978563
26 lines
1.4 KiB
Plaintext
26 lines
1.4 KiB
Plaintext
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
|
|
import Swift
|
|
|
|
protocol Foo: class { }
|
|
|
|
// CHECK-LABEL: define{{( protected)?}} swiftcc void @store_weak({ %swift.weak, i8** }* noalias nocapture sret, i64, i64) {{.*}} {
|
|
// CHECK: entry:
|
|
// CHECK-objc: [[INSTANCE:%.*]] = inttoptr i64 %1 to %objc_object*
|
|
// CHECK-native: [[INSTANCE:%.*]] = inttoptr i64 %1 to %swift.refcounted*
|
|
// CHECK: [[WTABLE:%.*]] = inttoptr i64 %2 to i8**
|
|
// CHECK: [[WTABLE_SLOT:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 1
|
|
// CHECK: store i8** [[WTABLE]], i8*** [[WTABLE_SLOT]], align 8
|
|
// CHECK: [[INSTANCE_SLOT:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 0
|
|
// CHECK-objc: call void @swift_unknownWeakAssign(%swift.weak* [[INSTANCE_SLOT]], %objc_object* [[INSTANCE]]) {{#[0-9]+}}
|
|
// CHECK-native: call void @swift_weakAssign(%swift.weak* [[INSTANCE_SLOT]], %swift.refcounted* [[INSTANCE]]) {{#[0-9]+}}
|
|
// CHECK: ret void
|
|
// CHECK: }
|
|
sil @store_weak : $@convention(thin) (@owned Foo?) -> @out @sil_weak Foo? {
|
|
entry(%w : $*@sil_weak Foo?, %x : $Foo?):
|
|
store_weak %x to %w : $*@sil_weak Foo?
|
|
return undef : $()
|
|
}
|