Created
October 21, 2016 18:26
-
-
Save harlanhaskins/864a21b73104b26c1d0dc0999c9aa238 to your computer and use it in GitHub Desktop.
Swift static dispatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = '-' | |
source_filename = "-" | |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-apple-macosx10.9" | |
define hidden void @_TFV4test3Foo8printBarfT_T_(i64) #0 { | |
entry: | |
%1 = call %swift.type* @_TMaP_() #6 | |
%2 = call { %swift.bridge*, i8* } @_TFs27_allocateUninitializedArrayurFBwTGSax_Bp_(i64 1, %swift.type* %1) | |
%3 = extractvalue { %swift.bridge*, i8* } %2, 0 | |
%4 = extractvalue { %swift.bridge*, i8* } %2, 1 | |
%5 = bitcast i8* %4 to %Any* | |
%6 = getelementptr inbounds %Any, %Any* %5, i32 0, i32 1 | |
store %swift.type* @_TMSi, %swift.type** %6, align 8 | |
%7 = getelementptr inbounds %Any, %Any* %5, i32 0, i32 0 | |
%object = bitcast [24 x i8]* %7 to %Si* | |
%object._value = getelementptr inbounds %Si, %Si* %object, i32 0, i32 0 | |
store i64 %0, i64* %object._value, align 8 | |
%8 = call { i64, i64, i64 } @_TIFs5printFTGSaP__9separatorSS10terminatorSS_T_A0_() | |
%9 = extractvalue { i64, i64, i64 } %8, 0 | |
%10 = extractvalue { i64, i64, i64 } %8, 1 | |
%11 = extractvalue { i64, i64, i64 } %8, 2 | |
%12 = call { i64, i64, i64 } @_TIFs5printFTGSaP__9separatorSS10terminatorSS_T_A1_() | |
%13 = extractvalue { i64, i64, i64 } %12, 0 | |
%14 = extractvalue { i64, i64, i64 } %12, 1 | |
%15 = extractvalue { i64, i64, i64 } %12, 2 | |
call void @_TFs5printFTGSaP__9separatorSS10terminatorSS_T_(%swift.bridge* %3, i64 %9, i64 %10, i64 %11, i64 %13, i64 %14, i64 %15) | |
ret void | |
} | |
define hidden i64 @_TFV4test3Foog3barSi(i64) #0 { | |
entry: | |
ret i64 %0 | |
} | |
define hidden i64 @_TFV4test3FooCfT3barSi_S0_(i64) #0 { | |
entry: | |
ret i64 %0 | |
} | |
define hidden void @_TF4test4mainFT_T_() #0 { | |
entry: | |
%0 = call i64 @_TFV4test3FooCfT3barSi_S0_(i64 10) | |
call void @_TFV4test3Foo8printBarfT_T_(i64 %0) | |
ret void | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
let bar: Int | |
func printBar() { | |
print(bar) | |
} | |
} | |
func main() { | |
Foo(bar: 10).printBar() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment