Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// SILDemo.identity <A>(A) -> A
sil @_TF7SILDemo8identityU__FQ_Q_ : $@thin <T> (@out T, @in T) -> () {
bb0(%0 : $*T, %1 : $*T):
copy_addr [take] %1 to [initialization] %0 : $*T // id: %2
%3 = tuple () // user: %4
return %3 : $() // id: %4
}
// SILDemo.testInt () -> Swift.Int
sil @_TF7SILDemo7testIntFT_Si : $@thin () -> Int {
bb0:
%0 = integer_literal $Builtin.Word, 42 // user: %1
%1 = struct $Int (%0 : $Builtin.Word) // user: %2
return %1 : $Int // id: %2
}
// Swift.Int._convertFromBuiltinIntegerLiteral (Swift.Int.Type)(Builtin.Int2048) -> Swift.Int
sil public_external [transparent] @_TFSi33_convertFromBuiltinIntegerLiteralfMSiFBi2048_Si : $@thin (Builtin.Int2048, @thin Int.Type) -> Int {
bb0(%0 : $Builtin.Int2048, %1 : $@thin Int.Type):
%2 = builtin_function_ref "s_to_s_checked_trunc_Int2048_Word" : $@thin (Builtin.Int2048) -> (Builtin.Word, Builtin.Int1) // user: %3
%3 = apply %2(%0) : $@thin (Builtin.Int2048) -> (Builtin.Word, Builtin.Int1) // user: %4
%4 = tuple_extract %3 : $(Builtin.Word, Builtin.Int1), 0 // user: %5
%5 = struct $Int (%4 : $Builtin.Word) // user: %6
return %5 : $Int // id: %6
}
// SILDemo.testDouble () -> Swift.Double
sil @_TF7SILDemo10testDoubleFT_Sd : $@thin () -> Double {
bb0:
%0 = float_literal $Builtin.FPIEEE64, 0x4045000000000000 // 42 // user: %1
%1 = struct $Double (%0 : $Builtin.FPIEEE64) // user: %2
return %1 : $Double // id: %2
}
// Swift.Double._convertFromBuiltinFloatLiteral (Swift.Double.Type)(Builtin.Float64) -> Swift.Double
sil public_external [transparent] @_TFSd31_convertFromBuiltinFloatLiteralfMSdFBf64_Sd : $@thin (Builtin.FPIEEE64, @thin Double.Type) -> Double {
bb0(%0 : $Builtin.FPIEEE64, %1 : $@thin Double.Type):
%2 = struct $Double (%0 : $Builtin.FPIEEE64) // user: %3
return %2 : $Double // id: %3
}
// specialization <Swift.Int> of SILDemo.identity <A>(A) -> A
sil shared @_TTSSi___TF7SILDemo8identityU__FQ_Q_ : $@thin (@out Int, @in Int) -> () {
bb0(%0 : $*Int, %1 : $*Int):
%2 = load %1 : $*Int // user: %3
store %2 to %0 : $*Int // id: %3
%4 = tuple () // user: %5
return %4 : $() // id: %5
}
// specialization <Swift.Double> of SILDemo.identity <A>(A) -> A
sil shared @_TTSSd___TF7SILDemo8identityU__FQ_Q_ : $@thin (@out Double, @in Double) -> () {
bb0(%0 : $*Double, %1 : $*Double):
%2 = load %1 : $*Double // user: %3
store %2 to %0 : $*Double // id: %3
%4 = tuple () // user: %5
return %4 : $() // id: %5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment