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
58 lines
1.7 KiB
Plaintext
58 lines
1.7 KiB
Plaintext
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -primary-file %s -emit-ir > %t
|
|
// RUN: %FileCheck %s --check-prefix=CHECK-%target-object-format --check-prefix=CHECK < %t
|
|
// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
|
|
sil_stage canonical
|
|
|
|
sil private @foo : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @bar : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil public_external @bar : $@convention(thin) () -> () {
|
|
bb0:
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil shared @baz : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @bar : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil shared @qux : $@convention(thin) () -> () {
|
|
bb0:
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil hidden @fred : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @qux : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil @frieda : $@convention(thin) () -> () {
|
|
bb0:
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
// CHECK-macho: @llvm.used = appending global [2 x i8*] [i8* bitcast (void ()* @frieda to i8*), i8* bitcast (i16* @__swift_reflection_version to i8*)], section "llvm.metadata"
|
|
// CHECK-elf: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @frieda to i8*), i8* bitcast (i16* @__swift_reflection_version to i8*), i8* getelementptr inbounds ([0 x i8], [0 x i8]* @_swift1_autolink_entries, i32 0, i32 0)], section "llvm.metadata"
|
|
|
|
// CHECK: define linkonce_odr hidden swiftcc void @qux()
|
|
// CHECK: define hidden swiftcc void @fred()
|
|
// CHECK: define{{( protected)?}} swiftcc void @frieda()
|
|
|
|
// NEGATIVE-NOT: @foo
|
|
// NEGATIVE-NOT: @bar
|
|
// NEGATIVE-NOT: @baz
|