forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cf.sil
75 lines (62 loc) · 4.12 KB
/
cf.sil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/chex.py < %s > %t/cf.sil
// RUN: %target-swift-frontend -enable-objc-interop -sdk %S/Inputs %t/cf.sil -emit-ir -import-cf-types | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %t/cf.sil -DINT=i%target-ptrsize -check-prefix CHECK-%target-import-type -check-prefix CHECK-%target-import-type-%target-ptrsize
// REQUIRES: CPU=i386 || CPU=x86_64
// CHECK: [[TYPE:%swift.type]] = type
// CHECK: [[REFRIGERATOR:%TSo17CCRefrigeratorRefa]] = type
// CHECK: [[MUTABLE_REFRIGERATOR:%TSo24CCMutableRefrigeratorRefa]] = type
// CHECK: [[OBJC:%objc_object]] = type
// CHECK: [[MUTABLE_REFRIGERATOR_NAME:@.*]] = private constant [52 x i8] c"CCMutableRefrigerator\00NCCMutableRefrigeratorRef\00St\00\00"
// CHECK: @"$sSo24CCMutableRefrigeratorRefaMn" = linkonce_odr hidden constant
// -- is imported, foreign init, is class, is nonunique
// CHECK-SAME: <i32 0x0006_0010>
// CHECK-SAME: [[MUTABLE_REFRIGERATOR_NAME]]
// CHECK-SAME: @"$sSo24CCMutableRefrigeratorRefaMa"
// CHECK-SAME: @"$sSo24CCMutableRefrigeratorRefaMr"
// CHECK: @"$sSo24CCMutableRefrigeratorRefaMf" = linkonce_odr hidden global <{ {{.*}} }> <{
// -- value witness table
// CHECK-DIRECT-SAME: i8** @"$sBOWV",
// CHECK-INDIRECT-SAME: i8** null,
// CHECK-64-SAME: i64 515, {{.*}}"$sSo24CCMutableRefrigeratorRefaMn", %swift.type* null, i8* null }>
// CHECK: @"$sSo17CCRefrigeratorRefaMf" = linkonce_odr hidden
// CHECK-DIRECT-SAME: constant
// CHECK-INDIRECT-SAME: global
// CHECK-SAME: <{ {{.*}} }> <{
// -- value witness table
// CHECK-DIRECT-SAME: i8** @"$sBOWV",
// CHECK-INDIRECT-SAME: i8** null,
// CHECK-SAME: [[INT]] 515, {{.*}}"$sSo17CCRefrigeratorRefaMn", [[TYPE]]* null, i8* null }>
sil_stage canonical
import CoreCooling
import Swift
sil public_external @generic_function : $@convention(thin) <T where T : AnyObject> (@owned T) -> ()
sil @call_generic : $@convention(thin) (@owned CCRefrigerator, @owned CCMutableRefrigerator) -> () {
bb0(%0 : $CCRefrigerator, %1: $CCMutableRefrigerator):
%2 = function_ref @generic_function : $@convention(thin) <τ_0_0 where τ_0_0 : AnyObject> (@owned τ_0_0) -> ()
%3 = apply %2<CCRefrigerator>(%0) : $@convention(thin) <τ_0_0 where τ_0_0 : AnyObject> (@owned τ_0_0) -> ()
%4 = apply %2<CCMutableRefrigerator>(%1) : $@convention(thin) <τ_0_0 where τ_0_0 : AnyObject> (@owned τ_0_0) -> ()
%5 = tuple ()
return %5 : $()
}
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @call_generic
// CHECK-SAME: ([[REFRIGERATOR]]*, [[MUTABLE_REFRIGERATOR]]*) {{.*}} {
// CHECK: [[T0:%.*]] = bitcast [[REFRIGERATOR]]* %0 to [[OBJC]]*
// CHECK-NEXT: [[T1:%.*]] = call swiftcc %swift.metadata_response @"$sSo17CCRefrigeratorRefaMa"([[INT]] 0)
// CHECK-NEXT: [[T2:%.*]] = extractvalue %swift.metadata_response [[T1]], 0
// CHECK-NEXT: call swiftcc void @generic_function([[OBJC]]* [[T0]], [[TYPE]]* [[T2]])
// CHECK: [[T0:%.*]] = bitcast [[MUTABLE_REFRIGERATOR]]* %1 to [[OBJC]]*
// CHECK-NEXT: [[T1:%.*]] = call swiftcc %swift.metadata_response @"$sSo24CCMutableRefrigeratorRefaMa"([[INT]] 0)
// CHECK-NEXT: [[T2:%.*]] = extractvalue %swift.metadata_response [[T1]], 0
// CHECK-NEXT: call swiftcc void @generic_function([[OBJC]]* [[T0]], [[TYPE]]* [[T2]])
// CHECK-NEXT: ret void
// CHECK-LABEL: define linkonce_odr hidden swiftcc %swift.metadata_response @"$sSo17CCRefrigeratorRefaMa"(
// CHECK: call swiftcc %swift.metadata_response @swift_getForeignTypeMetadata([[INT]] %0,
// CHECK-SAME: @"$sSo17CCRefrigeratorRefaMf"
// CHECK-LABEL: define internal swiftcc %swift.metadata_response @"$sSo24CCMutableRefrigeratorRefaMr"(%swift.type*, i8*, i8**)
// CHECK: [[T0:%.*]] = call swiftcc %swift.metadata_response @"$sSo17CCRefrigeratorRefaMa"([[INT]] 255)
// CHECK-NEXT: [[T1:%.*]] = extractvalue %swift.metadata_response [[T0]], 0
// CHECK-NEXT: extractvalue %swift.metadata_response [[T0]], 1
// CHECK-NEXT: [[T2:%.*]] = bitcast %swift.type* %0 to %swift.type**
// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[T2]], i32 2
// CHECK-NEXT: store %swift.type* [[T1]], %swift.type** [[T3]], align
// CHECK-NEXT: ret %swift.metadata_response zeroinitializer