File: package-cmo-non-resilient-mode.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (221 lines) | stat: -rw-r--r-- 10,612 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -O -wmo -Xfrontend -experimental-package-cmo -Xfrontend -experimental-allow-non-resilient-access -parse-as-library -emit-module -emit-module-path=%t/Submodule.swiftmodule -module-name=Submodule -package-name Pkg %S/Inputs/cross-module/default-submodule.swift -c -o %t/submodule.o
// RUN: %target-build-swift -O -wmo -Xfrontend -experimental-package-cmo -Xfrontend -experimental-allow-non-resilient-access -parse-as-library -emit-module -emit-module-path=%t/Module.swiftmodule -module-name=Module -package-name Pkg -I%t -I%S/Inputs/cross-module %S/Inputs/cross-module/default-module.swift -c -o %t/module.o
// RUN: %target-build-swift -O -wmo -Xfrontend -experimental-package-cmo -Xfrontend -experimental-allow-non-resilient-access -parse-as-library -emit-tbd -emit-tbd-path %t/ModuleTBD.tbd -emit-module -emit-module-path=%t/ModuleTBD.swiftmodule -module-name=ModuleTBD -package-name Pkg -I%t -I%S/Inputs/cross-module %S/Inputs/cross-module/default-module.swift -c -o %t/moduletbd.o -Xfrontend -tbd-install_name -Xfrontend module

// RUN: %target-build-swift -O -wmo -module-name=Main -package-name Pkg -I%t -I%S/Inputs/cross-module %s -emit-sil -o %t/Main.sil
// RUN: %FileCheck %s < %t/Main.sil

// REQUIRES: swift_in_compiler

import Module
import ModuleTBD

// static ModuleStruct.privateFunctionPointer
// CHECK-LABEL: sil_global public_external @$s6Module0A6StructV22privateFunctionPointeryS2icvpZ : $@callee_guaranteed (Int) -> Int{{$}}

// static ModuleStruct.publicFunctionPointer
// CHECK-LABEL: sil_global public_external [serialized] @$s6Module0A6StructV21publicFunctionPointeryS2icvpZ : $@callee_guaranteed (Int) -> Int


// CHECK-LABEL: sil @$s4Main26callPrivateFunctionPointeryS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         global_addr @$s6Module0A6StructV22privateFunctionPointeryS2icvpZ
// CHECK:         load
// CHECK:         apply
public func callPrivateFunctionPointer(_ x: Int) -> Int {
  return Module.ModuleStruct.privateFunctionPointer(x)
}

// CHECK-LABEL: sil package @$s4Main27callStaticPkgClosurePointeryS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         function_ref @$s6Module03PkgA6StructV14closurePointeryS2icvau
// CHECK:         apply
// CHECK:         pointer_to_address
// CHECK:         load
// CHECK:         apply

// PkgModuleStruct.closurePointer.unsafeMutableAddressor
// CHECK: sil package_external [global_init] @$s6Module03PkgA6StructV14closurePointeryS2icvau : $@convention(thin) () -> Builtin.RawPointer
package func callStaticPkgClosurePointer(_ x: Int) -> Int {
  return Module.PkgModuleStruct.closurePointer(x)
}

// CHECK-LABEL: sil @$s4Main25callPublicFunctionPointeryS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         global_addr @$s6Module0A6StructV21publicFunctionPointeryS2icvpZ : $*@callee_guaranteed (Int) -> Int
// CHECK:         load
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main25callPublicFunctionPointeryS2iF'
public func callPublicFunctionPointer(_ x: Int) -> Int {
  return Module.ModuleStruct.publicFunctionPointer(x)
}

// CHECK-LABEL: sil package @$s4Main28callStaticPkgFunctionPointeryS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         function_ref @$s6Module03PkgA6StructV11funcPointeryS2icvau
// CHECK:         pointer_to_address
// CHECK:         load
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main28callStaticPkgFunctionPointeryS2iF'

// PkgModuleStruct.funcPointer.unsafeMutableAddressor
// CHECK-LABEL: sil package_external [global_init] @$s6Module03PkgA6StructV11funcPointeryS2icvau : $@convention(thin) () -> Builtin.RawPointer
package func callStaticPkgFunctionPointer(_ x: Int) -> Int {
  return Module.PkgModuleStruct.funcPointer(x)
}

// CHECK-LABEL: sil @$s4Main24callPrivateCFuncInModuleSiyF : $@convention(thin) () -> Int {
// CHECK:         function_ref @$s6Module16callPrivateCFuncSiyF
// CHECK:       } // end sil function '$s4Main24callPrivateCFuncInModuleSiyF'
public func callPrivateCFuncInModule() -> Int {
  return Module.callPrivateCFunc()
}

// CHECK-LABEL: sil @$s4Main22usePrivateCVarInModuleSiyF : $@convention(thin) () -> Int {
// CHECK:         function_ref @$s6Module14usePrivateCVarSiyF
// CHECK:       } // end sil function '$s4Main22usePrivateCVarInModuleSiyF'
public func usePrivateCVarInModule() -> Int {
  return Module.usePrivateCVar()
}

// CHECK-LABEL: sil @$s4Main11doIncrementyS2iF
// CHECK-NOT:     function_ref 
// CHECK-NOT:     apply 
// CHECK:       } // end sil function '$s4Main11doIncrementyS2iF'
public func doIncrement(_ x: Int) -> Int {
  return Module.incrementByThree(x)
}

// CHECK-LABEL: sil package @$s4Main11callPkgFuncyS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         function_ref @$s6Module7pkgFuncyS2iF
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main11callPkgFuncyS2iF'

// pkgFunc(_:)
// CHECK-LABEL: sil package_external @$s6Module7pkgFuncyS2iF : $@convention(thin) (Int) -> Int
package func callPkgFunc(_ x: Int) -> Int {
  return Module.pkgFunc(x)
}

// CHECK-LABEL: sil @$s4Main19doIncrementWithCallyS2iF
// CHECK:         function_ref @$s9Submodule19incrementByOneNoCMOyS2iF
// CHECK:       } // end sil function '$s4Main19doIncrementWithCallyS2iF'
public func doIncrementWithCall(_ x: Int) -> Int {
  return Module.incrementByThreeWithCall(x)
}

// CHECK-LABEL: sil package @$s4Main16callPkgFuncNoCMOyS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         function_ref @$s6Module12pkgFuncNoCMOyS2iF
// CHECK:       } // end sil function '$s4Main16callPkgFuncNoCMOyS2iF'
// pkgFuncNoCMO(_:)
// CHECK-LABEL: sil package_external @$s6Module12pkgFuncNoCMOyS2iF : $@convention(thin) (Int) -> Int
package func callPkgFuncNoCMO(_ x: Int) -> Int {
  return Module.pkgFuncNoCMO(x)
}

// CHECK-LABEL: sil @$s4Main14doIncrementTBDyS2iF
// CHECK-NOT:     function_ref 
// CHECK-NOT:     apply 
// CHECK:       } // end sil function '$s4Main14doIncrementTBDyS2iF'
public func doIncrementTBD(_ x: Int) -> Int {
  return ModuleTBD.incrementByThree(x)
}

// CHECK-LABEL: sil package @$s4Main14callPkgFuncTBDyS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         function_ref @$s9ModuleTBD7pkgFuncyS2iF
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main14callPkgFuncTBDyS2iF'
// pkgFunc(_:)
// CHECK-LABEL: sil package_external @$s9ModuleTBD7pkgFuncyS2iF : $@convention(thin) (Int) -> Int
package func callPkgFuncTBD(_ x: Int) -> Int {
  return ModuleTBD.pkgFunc(x)
}

// CHECK-LABEL: sil @$s4Main22doIncrementTBDWithCallyS2iF
// CHECK:         function_ref @$s9ModuleTBD24incrementByThreeWithCallyS2iF
// CHECK:       } // end sil function '$s4Main22doIncrementTBDWithCallyS2iF'
// CHECK-LABEL: sil @$s9ModuleTBD24incrementByThreeWithCallyS2iF : $@convention(thin) (Int) -> Int
public func doIncrementTBDWithCall(_ x: Int) -> Int {
  return ModuleTBD.incrementByThreeWithCall(x)
}

// CHECK-LABEL: sil package @$s4Main19callPkgFuncNoCMOTBDyS2iF : $@convention(thin) (Int) -> Int {
// CHECK:         function_ref @$s9ModuleTBD12pkgFuncNoCMOyS2iF
// CHECK:       } // end sil function '$s4Main19callPkgFuncNoCMOTBDyS2iF'
// CHECK-LABEL: sil package_external @$s9ModuleTBD12pkgFuncNoCMOyS2iF : $@convention(thin) (Int) -> Int
package func callPkgFuncNoCMOTBD(_ x: Int) -> Int {
  return ModuleTBD.pkgFuncNoCMO(x)
}

// CHECK-LABEL: sil @$s4Main23getSubmoduleKlassMemberSiyF
// CHECK-NOT:     function_ref 
// CHECK-NOT:     apply 
// CHECK:       } // end sil function '$s4Main23getSubmoduleKlassMemberSiyF'
public func getSubmoduleKlassMember() -> Int {
  return Module.submoduleKlassMember()
}

// CHECK-LABEL: sil package @$s4Main26getPkgSubmoduleKlassMemberSiyF : $@convention(thin) () -> Int {
// CHECK:         function_ref @$s6Module23pkgSubmoduleKlassMemberSiyF
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main26getPkgSubmoduleKlassMemberSiyF'
// pkgSubmoduleKlassMember()
// CHECK-LABEL: sil package_external @$s6Module23pkgSubmoduleKlassMemberSiyF : $@convention(thin) () -> Int
package func getPkgSubmoduleKlassMember() -> Int {
  return Module.pkgSubmoduleKlassMember()
}

// CHECK-LABEL: sil @$s4Main26getSubmoduleKlassMemberTBDSiyF
// CHECK-NOT:     function_ref 
// CHECK-NOT:     apply 
// CHECK:       } // end sil function '$s4Main26getSubmoduleKlassMemberTBDSiyF'
public func getSubmoduleKlassMemberTBD() -> Int {
  return ModuleTBD.submoduleKlassMember()
}

// CHECK-LABEL: sil package @$s4Main29getPkgSubmoduleKlassMemberTBDSiyF : $@convention(thin) () -> Int {
// CHECK:     function_ref @$s9ModuleTBD23pkgSubmoduleKlassMemberSiyF
// CHECK:     apply
// CHECK:       } // end sil function '$s4Main29getPkgSubmoduleKlassMemberTBDSiyF'

// pkgSubmoduleKlassMember()
// CHECK-LABEL:sil package_external @$s9ModuleTBD23pkgSubmoduleKlassMemberSiyF : $@convention(thin) () -> Int
package func getPkgSubmoduleKlassMemberTBD() -> Int {
  return ModuleTBD.pkgSubmoduleKlassMember()
}

// CHECK-LABEL: sil @$s4Main20getModuleKlassMemberSiyF
// CHECK-NOT:     function_ref 
// CHECK-NOT:     apply 
// CHECK:       } // end sil function '$s4Main20getModuleKlassMemberSiyF'
public func getModuleKlassMember() -> Int {
  return Module.moduleKlassMember()
}

// CHECK-LABEL: sil package @$s4Main23getPkgModuleKlassMemberSiyF : $@convention(thin) () -> Int {
// CHECK:         function_ref @$s6Module03pkgA11KlassMemberSiyF
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main23getPkgModuleKlassMemberSiyF'
// pkgModuleKlassMember()
// CHECK-LABEL: sil package_external @$s6Module03pkgA11KlassMemberSiyF : $@convention(thin) () -> Int
package func getPkgModuleKlassMember() -> Int {
  return Module.pkgModuleKlassMember()
}

// CHECK-LABEL: sil @$s4Main23getModuleKlassMemberTBDSiyF
// CHECK-NOT:     function_ref 
// CHECK-NOT:     apply 
// CHECK:       } // end sil function '$s4Main23getModuleKlassMemberTBDSiyF'
public func getModuleKlassMemberTBD() -> Int {
  return ModuleTBD.moduleKlassMember()
}

// CHECK-LABEL: sil package @$s4Main26getPkgModuleKlassMemberTBDSiyF : $@convention(thin) () -> Int {
// CHECK:         function_ref @$s9ModuleTBD03pkgA11KlassMemberSiyF
// CHECK:         apply
// CHECK:       } // end sil function '$s4Main26getPkgModuleKlassMemberTBDSiyF'
// pkgModuleKlassMember()
// CHECK-LABEL: sil package_external @$s9ModuleTBD03pkgA11KlassMemberSiyF : $@convention(thin) () -> Int
package func getPkgModuleKlassMemberTBD() -> Int {
  return ModuleTBD.pkgModuleKlassMember()
}


// CHECK-LABEL: sil [_semantics "optimize.no.crossmodule"] @$s9Submodule19incrementByOneNoCMOyS2iF : $@convention(thin) (Int) -> Int