Slide 13
Slide 13 text
// LibX.ll
@"$s4LibX1SVAA1PAAWP" = constant [3 x i8*] [
...,
i8* bitcast (void (%T4LibX1SV*, %swift.type*, i8**)* @"$s4LibX1SVAA1PA2aDP3fooyyFTW" to i8*),
i8* bitcast (void (%T4LibX1SV*, %swift.type*, i8**)* @"$s4LibX1SVAA1PA2aDP12unusedMethodyyFTW" to i8*)
], align 8
define linkonce_odr hidden swiftcc void @"$s4LibX1SVAA1PA2aDP3fooyyFTW"(...) { ... }
define linkonce_odr hidden swiftcc void @"$s4LibX1SVAA1PA2aDP12unusedMethodyyFTW"(...) { ... }
// main.ll
define i32 @main(i32 %0, i8** %1) #0 {
entry:
...
call swiftcc void @"$s4main4usePyyx4LibX1PRzlF"(
%swift.opaque* noalias nocapture undef,
%swift.type* @"$s4LibX1SVN", i8** @"$s4LibX1SVAA1PAAWP"
)
ret i32 0
}
define hidden swiftcc void @"$s4main4usePyyx4LibX1PRzlF"(%swift.opaque* noalias nocapture %0, %swift.type* %T, i8** %T.P) {
entry:
%1 = getelementptr inbounds i8*, i8** %T.P, i32 1
%2 = load i8*, i8** %1, align 8, !invariant.load !14
%3 = bitcast i8* %2 to void (%swift.opaque*, %swift.type*, i8**)*
call swiftcc void %3(%swift.opaque* noalias nocapture swiftself %0, %swift.type* %T, i8** %T.P)
ret void
}
12