mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
39 lines
1.8 KiB
Swift
39 lines
1.8 KiB
Swift
// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
|
|
// RUN: %target-swift-frontend -O -emit-ir %s | FileCheck --check-prefix=OPT-CHECK %s
|
|
|
|
// Test that runtime functions are invoked using the new calling convention.
|
|
// Test that wrappers are used to invoked them.
|
|
|
|
// TODO: Once the PreserveRegistersCC calling convention is enabled, check that it is really used.
|
|
|
|
public class C {
|
|
}
|
|
|
|
// CHECK-LABEL: define {{(protected )?}}void @_TF27runtime_calling_conventions3fooFCS_1CT_(%C27runtime_calling_conventions1C*)
|
|
// Check that runtime functions use a proper calling convention.
|
|
// CHECK: call void {{.*}} @rt_swift_release
|
|
public func foo(c: C) {
|
|
}
|
|
|
|
// OPT-CHECK-LABEL: define {{(protected )?}}void @_TF27runtime_calling_conventions3booFCS_1CT_(%C27runtime_calling_conventions1C*)
|
|
// Check that runtime functions use a proper calling convention.
|
|
// OPT-CHECK: tail call void @rt_swift_release
|
|
public func boo(c: C) {
|
|
}
|
|
|
|
// Check that wrappers were generated, have a proper calling convention, linkage
|
|
// and linkonce_odr flags.
|
|
// CHECK: define linkonce_odr hidden void @rt_swift_release(%swift.refcounted*) #[[ATTR_REF:[0-9]+]]
|
|
// CHECK: load void (%swift.refcounted*)*, void (%swift.refcounted*)** @_swift_release
|
|
// CHECK-NEXT: tail call void %load(%swift.refcounted* %0)
|
|
// CHECK-NEXT: ret void
|
|
// CHECK: attributes #[[ATTR_REF]] = { noinline nounwind }
|
|
|
|
// Check that wrappers were generated, have a proper calling convention, linkage
|
|
// and linkonce_odr flags.
|
|
// OPT-CHECK: define linkonce_odr hidden void @rt_swift_release(%swift.refcounted*) #[[ATTR_REF:[0-9]+]]
|
|
// OPT-CHECK: load void (%swift.refcounted*)*, void (%swift.refcounted*)** @_swift_release
|
|
// OPT-CHECK-NEXT: tail call void %load(%swift.refcounted* %0)
|
|
// OPT-CHECK-NEXT: ret void
|
|
// OPT-CHECK: attributes #[[ATTR_REF]] = { noinline nounwind }
|