sil_stage canonical import Builtin import Swift import SwiftShims import Foundation func f() // main sil @main : $@convention(c) (Int32, UnsafeMutablePointer>>) -> Int32 { bb0(%0 : $Int32, %1 : $UnsafeMutablePointer>>): %2 = integer_literal $Builtin.Int32, 0 // user: %3 %3 = struct $Int32 (%2 : $Builtin.Int32) // user: %4 return %3 : $Int32 // id: %4 } // end sil function 'main' // f() sil hidden @$s5test11fyyF : $@convention(thin) () -> () { bb0: %0 = alloc_stack $@sil_unowned Optional, var, name "unownedValue" // users: %13, %12, %3, %8 %1 = metatype $@thin Optional.Type %2 = enum $Optional, #Optional.none!enumelt // user: %3 store_unowned %2 to [initialization] %0 : $*@sil_unowned Optional // id: %3 %4 = metatype $@thick NSDate.Type // user: %6 // function_ref NSDate.__allocating_init() %5 = function_ref @$sSo6NSDateCABycfC : $@convention(method) (@thick NSDate.Type) -> @owned NSDate // user: %6 %6 = apply %5(%4) : $@convention(method) (@thick NSDate.Type) -> @owned NSDate // user: %7 %7 = unchecked_ref_cast %6 : $NSDate to $Optional // users: %10, %9 %8 = begin_access [modify] [static] %0 : $*@sil_unowned Optional // users: %11, %9 store_unowned %7 to %8 : $*@sil_unowned Optional // id: %9 release_value %7 : $Optional // id: %10 end_access %8 : $*@sil_unowned Optional // id: %11 destroy_addr %0 : $*@sil_unowned Optional // id: %12 dealloc_stack %0 : $*@sil_unowned Optional // id: %13 %14 = tuple () // user: %15 return %14 : $() // id: %15 } // end sil function '$s5test11fyyF' // NSDate.__allocating_init() sil shared [serializable] @$sSo6NSDateCABycfC : $@convention(method) (@thick NSDate.Type) -> @owned NSDate { // %0 // user: %1 bb0(%0 : $@thick NSDate.Type): %1 = thick_to_objc_metatype %0 : $@thick NSDate.Type to $@objc_metatype NSDate.Type // user: %2 %2 = alloc_ref_dynamic [objc] %1 : $@objc_metatype NSDate.Type, $NSDate // user: %4 // function_ref @nonobjc NSDate.init() %3 = function_ref @$sSo6NSDateCABycfcTO : $@convention(method) (@owned NSDate) -> @owned NSDate // user: %4 %4 = apply %3(%2) : $@convention(method) (@owned NSDate) -> @owned NSDate // user: %5 return %4 : $NSDate // id: %5 } // end sil function '$sSo6NSDateCABycfC' // @nonobjc NSDate.init() sil shared [serializable] [thunk] @$sSo6NSDateCABycfcTO : $@convention(method) (@owned NSDate) -> @owned NSDate { // %0 // users: %2, %1 bb0(%0 : $NSDate): %1 = objc_method %0 : $NSDate, #NSDate.init!initializer.1.foreign : (NSDate.Type) -> () -> NSDate, $@convention(objc_method) (@owned NSDate) -> @owned NSDate // user: %2 %2 = apply %1(%0) : $@convention(objc_method) (@owned NSDate) -> @owned NSDate // user: %3 return %2 : $NSDate // id: %3 } // end sil function '$sSo6NSDateCABycfcTO'