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
42 lines
901 B
Swift
42 lines
901 B
Swift
// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests -primary-file %s -parse-as-library -emit-ir -O | %FileCheck %s
|
|
|
|
// Two thunks are generated:
|
|
// 1. from function signature opts
|
|
// 2. the witness thunk
|
|
// Both should not inline the testit function and should set the noinline-attribute for llvm.
|
|
|
|
// CHECK-LABEL: define hidden swiftcc i32 @{{.*}}testit{{.*}}F(i32)
|
|
// CHECK: call swiftcc i32 @{{.*}}testit{{.*}}Tf{{.*}} #[[ATTR:[0-9]+]]
|
|
// CHECK: ret
|
|
|
|
// CHECK-LABEL: define hidden swiftcc i32 @{{.*}}testit{{.*}}FTW(i32
|
|
// CHECK: call swiftcc i32 @{{.*}}testit{{.*}}Tf{{.*}} #[[ATTR]]
|
|
// CHECK: ret
|
|
|
|
// CHECK: attributes #[[ATTR]] = { noinline }
|
|
|
|
protocol Proto {
|
|
func testit(x: Int32) -> Int32
|
|
}
|
|
|
|
|
|
struct TestStruct : Proto {
|
|
func testit(x: Int32) -> Int32 {
|
|
var y = x * 2
|
|
y += 1
|
|
y *= x
|
|
y += 1
|
|
y *= x
|
|
y += 1
|
|
y *= x
|
|
y += 1
|
|
y *= x
|
|
y += 1
|
|
y *= x
|
|
y += 1
|
|
return y
|
|
}
|
|
}
|
|
|
|
|