先附上SIL代码
sil_stage canonical
import Builtin
import Swift
import SwiftShims
import Foundation
enum YREPIKModule : String {
case home, feed, mine, edit
init?(rawValue: String)
typealias RawValue = String
var rawValue: String { get }
}
@_hasStorage @_hasInitialValue var t: YREPIKModule? { get set }
// t
sil_global hidden @main.t : main.YREPIKModule? : $Optional<YREPIKModule>
// main
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
alloc_global @main.t : main.YREPIKModule? // id: %2
%3 = global_addr @main.t : main.YREPIKModule? : $*Optional<YREPIKModule> // user: %13
%4 = metatype $@thin YREPIKModule.Type // user: %12
%5 = string_literal utf8 "home" // user: %10
%6 = integer_literal $Builtin.Word, 4 // user: %10
%7 = integer_literal $Builtin.Int1, -1 // user: %10
%8 = metatype $@thin String.Type // user: %10
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%9 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %10
%10 = apply %9(%5, %6, %7, %8) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %12
// function_ref YREPIKModule.init(rawValue:)
%11 = function_ref @main.YREPIKModule.init(rawValue: Swift.String) -> main.YREPIKModule? : $@convention(method) (@owned String, @thin YREPIKModule.Type) -> Optional<YREPIKModule> // user: %12
%12 = apply %11(%10, %4) : $@convention(method) (@owned String, @thin YREPIKModule.Type) -> Optional<YREPIKModule> // user: %13
store %12 to %3 : $*Optional<YREPIKModule> // id: %13
%14 = integer_literal $Builtin.Word, 1 // user: %16
// function_ref _allocateUninitializedArray<A>(_:)
%15 = function_ref @Swift._allocateUninitializedArray<A>(Builtin.Word) -> ([A], Builtin.RawPointer) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %16
%16 = apply %15<Any>(%14) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %18, %17
%17 = tuple_extract %16 : $(Array<Any>, Builtin.RawPointer), 0 // user: %29
%18 = tuple_extract %16 : $(Array<Any>, Builtin.RawPointer), 1 // user: %19
%19 = pointer_to_address %18 : $Builtin.RawPointer to [strict] $*Any // user: %26
%20 = string_literal utf8 "end" // user: %25
%21 = integer_literal $Builtin.Word, 3 // user: %25
%22 = integer_literal $Builtin.Int1, -1 // user: %25
%23 = metatype $@thin String.Type // user: %25
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%24 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %25
%25 = apply %24(%20, %21, %22, %23) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %27
%26 = init_existential_addr %19 : $*Any, $String // user: %27
store %25 to %26 : $*String // id: %27
// function_ref _finalizeUninitializedArray<A>(_:)
%28 = function_ref @Swift._finalizeUninitializedArray<A>(__owned [A]) -> [A] : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // user: %29
%29 = apply %28<Any>(%17) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // users: %38, %35
// function_ref default argument 1 of print(_:separator:terminator:)
%30 = function_ref @default argument 1 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> () : $@convention(thin) () -> @owned String // user: %31
%31 = apply %30() : $@convention(thin) () -> @owned String // users: %37, %35
// function_ref default argument 2 of print(_:separator:terminator:)
%32 = function_ref @default argument 2 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> () : $@convention(thin) () -> @owned String // user: %33
%33 = apply %32() : $@convention(thin) () -> @owned String // users: %36, %35
// function_ref print(_:separator:terminator:)
%34 = function_ref @Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> () : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () // user: %35
%35 = apply %34(%29, %31, %33) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> ()
release_value %33 : $String // id: %36
release_value %31 : $String // id: %37
release_value %29 : $Array<Any> // id: %38
%39 = integer_literal $Builtin.Int32, 0 // user: %40
%40 = struct $Int32 (%39 : $Builtin.Int32) // user: %41
return %40 : $Int32 // id: %41
} // end sil function 'main'
// YREPIKModule.init(rawValue:)
sil hidden @main.YREPIKModule.init(rawValue: Swift.String) -> main.YREPIKModule? : $@convention(method) (@owned String, @thin YREPIKModule.Type) -> Optional<YREPIKModule> {
// %0 "rawValue" // users: %95, %89, %51, %3
// %1 "$metatype"
bb0(%0 : $String, %1 : $@thin YREPIKModule.Type):
%2 = alloc_stack $YREPIKModule, var, name "self" // users: %93, %85, %76, %67, %58, %96, %90
debug_value %0 : $String, let, name "rawValue", argno 1 // id: %3
%4 = integer_literal $Builtin.Word, 4 // user: %6
// function_ref _allocateUninitializedArray<A>(_:)
%5 = function_ref @Swift._allocateUninitializedArray<A>(Builtin.Word) -> ([A], Builtin.RawPointer) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %6
%6 = apply %5<StaticString>(%4) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %8, %7
%7 = tuple_extract %6 : $(Array<StaticString>, Builtin.RawPointer), 0 // user: %49
%8 = tuple_extract %6 : $(Array<StaticString>, Builtin.RawPointer), 1 // user: %9
%9 = pointer_to_address %8 : $Builtin.RawPointer to [strict] $*StaticString // users: %17, %39, %29, %19
%10 = string_literal utf8 "home" // user: %12
%11 = integer_literal $Builtin.Word, 4 // user: %16
%12 = builtin "ptrtoint_Word"(%10 : $Builtin.RawPointer) : $Builtin.Word // user: %16
br bb1 // id: %13
bb1: // Preds: bb0
%14 = integer_literal $Builtin.Int8, 2 // user: %16
br bb2 // id: %15
bb2: // Preds: bb1
%16 = struct $StaticString (%12 : $Builtin.Word, %11 : $Builtin.Word, %14 : $Builtin.Int8) // user: %17
store %16 to %9 : $*StaticString // id: %17
%18 = integer_literal $Builtin.Word, 1 // user: %19
%19 = index_addr %9 : $*StaticString, %18 : $Builtin.Word // user: %27
%20 = string_literal utf8 "feed" // user: %22
%21 = integer_literal $Builtin.Word, 4 // user: %26
%22 = builtin "ptrtoint_Word"(%20 : $Builtin.RawPointer) : $Builtin.Word // user: %26
br bb3 // id: %23
bb3: // Preds: bb2
%24 = integer_literal $Builtin.Int8, 2 // user: %26
br bb4 // id: %25
bb4: // Preds: bb3
%26 = struct $StaticString (%22 : $Builtin.Word, %21 : $Builtin.Word, %24 : $Builtin.Int8) // user: %27
store %26 to %19 : $*StaticString // id: %27
%28 = integer_literal $Builtin.Word, 2 // user: %29
%29 = index_addr %9 : $*StaticString, %28 : $Builtin.Word // user: %37
%30 = string_literal utf8 "mine" // user: %32
%31 = integer_literal $Builtin.Word, 4 // user: %36
%32 = builtin "ptrtoint_Word"(%30 : $Builtin.RawPointer) : $Builtin.Word // user: %36
br bb5 // id: %33
bb5: // Preds: bb4
%34 = integer_literal $Builtin.Int8, 2 // user: %36
br bb6 // id: %35
bb6: // Preds: bb5
%36 = struct $StaticString (%32 : $Builtin.Word, %31 : $Builtin.Word, %34 : $Builtin.Int8) // user: %37
store %36 to %29 : $*StaticString // id: %37
%38 = integer_literal $Builtin.Word, 3 // user: %39
%39 = index_addr %9 : $*StaticString, %38 : $Builtin.Word // user: %47
%40 = string_literal utf8 "edit" // user: %42
%41 = integer_literal $Builtin.Word, 4 // user: %46
%42 = builtin "ptrtoint_Word"(%40 : $Builtin.RawPointer) : $Builtin.Word // user: %46
br bb7 // id: %43
bb7: // Preds: bb6
%44 = integer_literal $Builtin.Int8, 2 // user: %46
br bb8 // id: %45
bb8: // Preds: bb7
%46 = struct $StaticString (%42 : $Builtin.Word, %41 : $Builtin.Word, %44 : $Builtin.Int8) // user: %47
store %46 to %39 : $*StaticString // id: %47
// function_ref _finalizeUninitializedArray<A>(_:)
%48 = function_ref @Swift._finalizeUninitializedArray<A>(__owned [A]) -> [A] : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // user: %49
%49 = apply %48<StaticString>(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0> // users: %52, %51
// function_ref _findStringSwitchCase(cases:string:)
%50 = function_ref @Swift._findStringSwitchCase(cases: [Swift.StaticString], string: Swift.String) -> Swift.Int : $@convention(thin) (@guaranteed Array<StaticString>, @guaranteed String) -> Int // user: %51
%51 = apply %50(%49, %0) : $@convention(thin) (@guaranteed Array<StaticString>, @guaranteed String) -> Int // users: %81, %72, %63, %54
release_value %49 : $Array<StaticString> // id: %52
%53 = integer_literal $Builtin.Int64, 0 // user: %55
%54 = struct_extract %51 : $Int, #Int._value // user: %55
%55 = builtin "cmp_eq_Int64"(%53 : $Builtin.Int64, %54 : $Builtin.Int64) : $Builtin.Int1 // user: %56
cond_br %55, bb9, bb10 // id: %56
bb9: // Preds: bb8
%57 = enum $YREPIKModule, #YREPIKModule.home!enumelt // user: %59
%58 = begin_access [modify] [static] %2 : $*YREPIKModule // users: %59, %60
store %57 to %58 : $*YREPIKModule // id: %59
end_access %58 : $*YREPIKModule // id: %60
br bb17 // id: %61
bb10: // Preds: bb8
%62 = integer_literal $Builtin.Int64, 1 // user: %64
%63 = struct_extract %51 : $Int, #Int._value // user: %64
%64 = builtin "cmp_eq_Int64"(%62 : $Builtin.Int64, %63 : $Builtin.Int64) : $Builtin.Int1 // user: %65
cond_br %64, bb11, bb12 // id: %65
bb11: // Preds: bb10
%66 = enum $YREPIKModule, #YREPIKModule.feed!enumelt // user: %68
%67 = begin_access [modify] [static] %2 : $*YREPIKModule // users: %68, %69
store %66 to %67 : $*YREPIKModule // id: %68
end_access %67 : $*YREPIKModule // id: %69
br bb17 // id: %70
bb12: // Preds: bb10
%71 = integer_literal $Builtin.Int64, 2 // user: %73
%72 = struct_extract %51 : $Int, #Int._value // user: %73
%73 = builtin "cmp_eq_Int64"(%71 : $Builtin.Int64, %72 : $Builtin.Int64) : $Builtin.Int1 // user: %74
cond_br %73, bb13, bb14 // id: %74
bb13: // Preds: bb12
%75 = enum $YREPIKModule, #YREPIKModule.mine!enumelt // user: %77
%76 = begin_access [modify] [static] %2 : $*YREPIKModule // users: %77, %78
store %75 to %76 : $*YREPIKModule // id: %77
end_access %76 : $*YREPIKModule // id: %78
br bb17 // id: %79
bb14: // Preds: bb12
%80 = integer_literal $Builtin.Int64, 3 // user: %82
%81 = struct_extract %51 : $Int, #Int._value // user: %82
%82 = builtin "cmp_eq_Int64"(%80 : $Builtin.Int64, %81 : $Builtin.Int64) : $Builtin.Int1 // user: %83
cond_br %82, bb15, bb16 // id: %83
bb15: // Preds: bb14
%84 = enum $YREPIKModule, #YREPIKModule.edit!enumelt // user: %86
%85 = begin_access [modify] [static] %2 : $*YREPIKModule // users: %86, %87
store %84 to %85 : $*YREPIKModule // id: %86
end_access %85 : $*YREPIKModule // id: %87
br bb17 // id: %88
bb16: // Preds: bb14
release_value %0 : $String // id: %89
dealloc_stack %2 : $*YREPIKModule // id: %90
%91 = enum $Optional<YREPIKModule>, #Optional.none!enumelt // user: %92
br bb18(%91 : $Optional<YREPIKModule>) // id: %92
bb17: // Preds: bb15 bb13 bb11 bb9
%93 = load %2 : $*YREPIKModule // user: %94
%94 = enum $Optional<YREPIKModule>, #Optional.some!enumelt, %93 : $YREPIKModule // user: %97
release_value %0 : $String // id: %95
dealloc_stack %2 : $*YREPIKModule // id: %96
br bb18(%94 : $Optional<YREPIKModule>) // id: %97
// %98 // user: %99
bb18(%98 : $Optional<YREPIKModule>): // Preds: bb17 bb16
return %98 : $Optional<YREPIKModule> // id: %99
} // end sil function 'main.YREPIKModule.init(rawValue: Swift.String) -> main.YREPIKModule?'
// _allocateUninitializedArray<A>(_:)
sil [always_inline] [_semantics "array.uninitialized_intrinsic"] @Swift._allocateUninitializedArray<A>(Builtin.Word) -> ([A], Builtin.RawPointer) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)
// StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
sil public_external [transparent] [readonly] @Swift.StaticString.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.StaticString : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin StaticString.Type) -> StaticString {
// %0 // user: %4
// %1 // user: %11
// %2 // user: %5
bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word, %2 : $Builtin.Int1, %3 : $@thin StaticString.Type):
%4 = builtin "ptrtoint_Word"(%0 : $Builtin.RawPointer) : $Builtin.Word // user: %11
cond_br %2, bb2, bb1 // id: %5
bb1: // Preds: bb0
%6 = integer_literal $Builtin.Int8, 0 // user: %7
br bb3(%6 : $Builtin.Int8) // id: %7
bb2: // Preds: bb0
%8 = integer_literal $Builtin.Int8, 2 // user: %9
br bb3(%8 : $Builtin.Int8) // id: %9
// %10 // user: %11
bb3(%10 : $Builtin.Int8): // Preds: bb2 bb1
%11 = struct $StaticString (%4 : $Builtin.Word, %1 : $Builtin.Word, %10 : $Builtin.Int8) // user: %12
return %11 : $StaticString // id: %12
} // end sil function 'Swift.StaticString.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.StaticString'
// _finalizeUninitializedArray<A>(_:)
sil shared_external [readnone] [_semantics "array.finalize_intrinsic"] @Swift._finalizeUninitializedArray<A>(__owned [A]) -> [A] : $@convention(thin) <Element> (@owned Array<Element>) -> @owned Array<Element> {
// %0 // user: %2
bb0(%0 : $Array<Element>):
%1 = alloc_stack $Array<Element> // users: %6, %5, %4, %2
store %0 to %1 : $*Array<Element> // id: %2
// function_ref Array._endMutation()
%3 = function_ref @Swift.Array._endMutation() -> () : $@convention(method) <τ_0_0> (@inout Array<τ_0_0>) -> () // user: %4
%4 = apply %3<Element>(%1) : $@convention(method) <τ_0_0> (@inout Array<τ_0_0>) -> ()
%5 = load %1 : $*Array<Element> // user: %7
dealloc_stack %1 : $*Array<Element> // id: %6
return %5 : $Array<Element> // id: %7
} // end sil function 'Swift._finalizeUninitializedArray<A>(__owned [A]) -> [A]'
// _findStringSwitchCase(cases:string:)
sil [_semantics "findStringSwitchCase"] @Swift._findStringSwitchCase(cases: [Swift.StaticString], string: Swift.String) -> Swift.Int : $@convention(thin) (@guaranteed Array<StaticString>, @guaranteed String) -> Int
// Int.init(_builtinIntegerLiteral:)
sil public_external [transparent] @Swift.Int.init(_builtinIntegerLiteral: Builtin.IntLiteral) -> Swift.Int : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int {
// %0 // user: %2
bb0(%0 : $Builtin.IntLiteral, %1 : $@thin Int.Type):
%2 = builtin "s_to_s_checked_trunc_IntLiteral_Int64"(%0 : $Builtin.IntLiteral) : $(Builtin.Int64, Builtin.Int1) // user: %3
%3 = tuple_extract %2 : $(Builtin.Int64, Builtin.Int1), 0 // user: %4
%4 = struct $Int (%3 : $Builtin.Int64) // user: %5
return %4 : $Int // id: %5
} // end sil function 'Swift.Int.init(_builtinIntegerLiteral: Builtin.IntLiteral) -> Swift.Int'
// ~= infix<A>(_:_:)
sil public_external [transparent] @Swift.~= infix<A where A: Swift.Equatable>(A, A) -> Swift.Bool : $@convention(thin) <T where T : Equatable> (@in_guaranteed T, @in_guaranteed T) -> Bool {
// %0 // user: %4
// %1 // user: %4
bb0(%0 : $*T, %1 : $*T):
%2 = metatype $@thick T.Type // user: %4
%3 = witness_method $T, #Equatable."==" : <Self where Self : Equatable> (Self.Type) -> (Self, Self) -> Bool : $@convention(witness_method: Equatable) <τ_0_0 where τ_0_0 : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0, @thick τ_0_0.Type) -> Bool // user: %4
%4 = apply %3<T>(%0, %1, %2) : $@convention(witness_method: Equatable) <τ_0_0 where τ_0_0 : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0, @thick τ_0_0.Type) -> Bool // user: %5
return %4 : $Bool // id: %5
} // end sil function 'Swift.~= infix<A where A: Swift.Equatable>(A, A) -> Swift.Bool'
// YREPIKModule.rawValue.getter
sil hidden @main.YREPIKModule.rawValue.getter : Swift.String : $@convention(method) (YREPIKModule) -> @owned String {
// %0 "self" // users: %2, %1
bb0(%0 : $YREPIKModule):
debug_value %0 : $YREPIKModule, let, name "self", argno 1 // id: %1
switch_enum %0 : $YREPIKModule, case #YREPIKModule.home!enumelt: bb1, case #YREPIKModule.feed!enumelt: bb2, case #YREPIKModule.mine!enumelt: bb3, case #YREPIKModule.edit!enumelt: bb4 // id: %2
bb1: // Preds: bb0
%3 = string_literal utf8 "home" // user: %8
%4 = integer_literal $Builtin.Word, 4 // user: %8
%5 = integer_literal $Builtin.Int1, -1 // user: %8
%6 = metatype $@thin String.Type // user: %8
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%7 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %8
%8 = apply %7(%3, %4, %5, %6) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %9
br bb5(%8 : $String) // id: %9
bb2: // Preds: bb0
%10 = string_literal utf8 "feed" // user: %15
%11 = integer_literal $Builtin.Word, 4 // user: %15
%12 = integer_literal $Builtin.Int1, -1 // user: %15
%13 = metatype $@thin String.Type // user: %15
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%14 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %15
%15 = apply %14(%10, %11, %12, %13) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %16
br bb5(%15 : $String) // id: %16
bb3: // Preds: bb0
%17 = string_literal utf8 "mine" // user: %22
%18 = integer_literal $Builtin.Word, 4 // user: %22
%19 = integer_literal $Builtin.Int1, -1 // user: %22
%20 = metatype $@thin String.Type // user: %22
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%21 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %22
%22 = apply %21(%17, %18, %19, %20) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %23
br bb5(%22 : $String) // id: %23
bb4: // Preds: bb0
%24 = string_literal utf8 "edit" // user: %29
%25 = integer_literal $Builtin.Word, 4 // user: %29
%26 = integer_literal $Builtin.Int1, -1 // user: %29
%27 = metatype $@thin String.Type // user: %29
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%28 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %29
%29 = apply %28(%24, %25, %26, %27) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %30
br bb5(%29 : $String) // id: %30
// %31 // user: %32
bb5(%31 : $String): // Preds: bb4 bb3 bb2 bb1
return %31 : $String // id: %32
} // end sil function 'main.YREPIKModule.rawValue.getter : Swift.String'
// String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
sil [always_inline] [readonly] [_semantics "string.makeUTF8"] @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String
// protocol witness for static Equatable.== infix(_:_:) in conformance YREPIKModule
sil private [transparent] [thunk] @protocol witness for static Swift.Equatable.== infix(A, A) -> Swift.Bool in conformance main.YREPIKModule : Swift.Equatable in main : $@convention(witness_method: Equatable) (@in_guaranteed YREPIKModule, @in_guaranteed YREPIKModule, @thick YREPIKModule.Type) -> Bool {
// %0 // user: %4
// %1 // user: %4
bb0(%0 : $*YREPIKModule, %1 : $*YREPIKModule, %2 : $@thick YREPIKModule.Type):
// function_ref == infix<A>(_:_:)
%3 = function_ref @Swift.== infix<A where A: Swift.RawRepresentable, A.RawValue: Swift.Equatable>(A, A) -> Swift.Bool : $@convention(thin) <τ_0_0 where τ_0_0 : RawRepresentable, τ_0_0.RawValue : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0) -> Bool // user: %4
%4 = apply %3<YREPIKModule>(%0, %1) : $@convention(thin) <τ_0_0 where τ_0_0 : RawRepresentable, τ_0_0.RawValue : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0) -> Bool // user: %5
return %4 : $Bool // id: %5
} // end sil function 'protocol witness for static Swift.Equatable.== infix(A, A) -> Swift.Bool in conformance main.YREPIKModule : Swift.Equatable in main'
// == infix<A>(_:_:)
sil @Swift.== infix<A where A: Swift.RawRepresentable, A.RawValue: Swift.Equatable>(A, A) -> Swift.Bool : $@convention(thin) <τ_0_0 where τ_0_0 : RawRepresentable, τ_0_0.RawValue : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0) -> Bool
// protocol witness for Hashable.hashValue.getter in conformance YREPIKModule
sil private [transparent] [thunk] @protocol witness for Swift.Hashable.hashValue.getter : Swift.Int in conformance main.YREPIKModule : Swift.Hashable in main : $@convention(witness_method: Hashable) (@in_guaranteed YREPIKModule) -> Int {
// %0 // user: %2
bb0(%0 : $*YREPIKModule):
// function_ref RawRepresentable<>.hashValue.getter
%1 = function_ref @(extension in Swift):Swift.RawRepresentable< where A: Swift.Hashable, A.Swift.RawRepresentable.RawValue: Swift.Hashable>.hashValue.getter : Swift.Int : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (@in_guaranteed τ_0_0) -> Int // user: %2
%2 = apply %1<YREPIKModule>(%0) : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (@in_guaranteed τ_0_0) -> Int // user: %3
return %2 : $Int // id: %3
} // end sil function 'protocol witness for Swift.Hashable.hashValue.getter : Swift.Int in conformance main.YREPIKModule : Swift.Hashable in main'
// RawRepresentable<>.hashValue.getter
sil @(extension in Swift):Swift.RawRepresentable< where A: Swift.Hashable, A.Swift.RawRepresentable.RawValue: Swift.Hashable>.hashValue.getter : Swift.Int : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (@in_guaranteed τ_0_0) -> Int
// protocol witness for Hashable.hash(into:) in conformance YREPIKModule
sil private [transparent] [thunk] @protocol witness for Swift.Hashable.hash(into: inout Swift.Hasher) -> () in conformance main.YREPIKModule : Swift.Hashable in main : $@convention(witness_method: Hashable) (@inout Hasher, @in_guaranteed YREPIKModule) -> () {
// %0 // user: %3
// %1 // user: %3
bb0(%0 : $*Hasher, %1 : $*YREPIKModule):
// function_ref RawRepresentable<>.hash(into:)
%2 = function_ref @(extension in Swift):Swift.RawRepresentable< where A: Swift.Hashable, A.Swift.RawRepresentable.RawValue: Swift.Hashable>.hash(into: inout Swift.Hasher) -> () : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (@inout Hasher, @in_guaranteed τ_0_0) -> () // user: %3
%3 = apply %2<YREPIKModule>(%0, %1) : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (@inout Hasher, @in_guaranteed τ_0_0) -> ()
%4 = tuple () // user: %5
return %4 : $() // id: %5
} // end sil function 'protocol witness for Swift.Hashable.hash(into: inout Swift.Hasher) -> () in conformance main.YREPIKModule : Swift.Hashable in main'
// RawRepresentable<>.hash(into:)
sil @(extension in Swift):Swift.RawRepresentable< where A: Swift.Hashable, A.Swift.RawRepresentable.RawValue: Swift.Hashable>.hash(into: inout Swift.Hasher) -> () : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (@inout Hasher, @in_guaranteed τ_0_0) -> ()
// protocol witness for Hashable._rawHashValue(seed:) in conformance YREPIKModule
sil private [transparent] [thunk] @protocol witness for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int in conformance main.YREPIKModule : Swift.Hashable in main : $@convention(witness_method: Hashable) (Int, @in_guaranteed YREPIKModule) -> Int {
// %0 // user: %3
// %1 // user: %3
bb0(%0 : $Int, %1 : $*YREPIKModule):
// function_ref RawRepresentable<>._rawHashValue(seed:)
%2 = function_ref @(extension in Swift):Swift.RawRepresentable< where A: Swift.Hashable, A.Swift.RawRepresentable.RawValue: Swift.Hashable>._rawHashValue(seed: Swift.Int) -> Swift.Int : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (Int, @in_guaranteed τ_0_0) -> Int // user: %3
%3 = apply %2<YREPIKModule>(%0, %1) : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (Int, @in_guaranteed τ_0_0) -> Int // user: %4
return %3 : $Int // id: %4
} // end sil function 'protocol witness for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int in conformance main.YREPIKModule : Swift.Hashable in main'
// RawRepresentable<>._rawHashValue(seed:)
sil @(extension in Swift):Swift.RawRepresentable< where A: Swift.Hashable, A.Swift.RawRepresentable.RawValue: Swift.Hashable>._rawHashValue(seed: Swift.Int) -> Swift.Int : $@convention(method) <τ_0_0 where τ_0_0 : Hashable, τ_0_0 : RawRepresentable, τ_0_0.RawValue : Hashable> (Int, @in_guaranteed τ_0_0) -> Int
// protocol witness for RawRepresentable.init(rawValue:) in conformance YREPIKModule
sil private [transparent] [thunk] @protocol witness for Swift.RawRepresentable.init(rawValue: A.RawValue) -> A? in conformance main.YREPIKModule : Swift.RawRepresentable in main : $@convention(witness_method: RawRepresentable) (@in String, @thick YREPIKModule.Type) -> @out Optional<YREPIKModule> {
// %0 // user: %7
// %1 // user: %3
bb0(%0 : $*Optional<YREPIKModule>, %1 : $*String, %2 : $@thick YREPIKModule.Type):
%3 = load %1 : $*String // user: %6
%4 = metatype $@thin YREPIKModule.Type // user: %6
// function_ref YREPIKModule.init(rawValue:)
%5 = function_ref @main.YREPIKModule.init(rawValue: Swift.String) -> main.YREPIKModule? : $@convention(method) (@owned String, @thin YREPIKModule.Type) -> Optional<YREPIKModule> // user: %6
%6 = apply %5(%3, %4) : $@convention(method) (@owned String, @thin YREPIKModule.Type) -> Optional<YREPIKModule> // user: %7
store %6 to %0 : $*Optional<YREPIKModule> // id: %7
%8 = tuple () // user: %9
return %8 : $() // id: %9
} // end sil function 'protocol witness for Swift.RawRepresentable.init(rawValue: A.RawValue) -> A? in conformance main.YREPIKModule : Swift.RawRepresentable in main'
// protocol witness for RawRepresentable.rawValue.getter in conformance YREPIKModule
sil private [transparent] [thunk] @protocol witness for Swift.RawRepresentable.rawValue.getter : A.RawValue in conformance main.YREPIKModule : Swift.RawRepresentable in main : $@convention(witness_method: RawRepresentable) (@in_guaranteed YREPIKModule) -> @out String {
// %0 // user: %5
// %1 // user: %2
bb0(%0 : $*String, %1 : $*YREPIKModule):
%2 = load %1 : $*YREPIKModule // user: %4
// function_ref YREPIKModule.rawValue.getter
%3 = function_ref @main.YREPIKModule.rawValue.getter : Swift.String : $@convention(method) (YREPIKModule) -> @owned String // user: %4
%4 = apply %3(%2) : $@convention(method) (YREPIKModule) -> @owned String // user: %5
store %4 to %0 : $*String // id: %5
%6 = tuple () // user: %7
return %6 : $() // id: %7
} // end sil function 'protocol witness for Swift.RawRepresentable.rawValue.getter : A.RawValue in conformance main.YREPIKModule : Swift.RawRepresentable in main'
// default argument 1 of print(_:separator:terminator:)
sil shared_external @default argument 1 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> () : $@convention(thin) () -> @owned String {
bb0:
%0 = string_literal utf8 " " // user: %5
%1 = integer_literal $Builtin.Word, 1 // user: %5
%2 = integer_literal $Builtin.Int1, -1 // user: %5
%3 = metatype $@thin String.Type // user: %5
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%4 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %5
%5 = apply %4(%0, %1, %2, %3) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %6
return %5 : $String // id: %6
} // end sil function 'default argument 1 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()'
// default argument 2 of print(_:separator:terminator:)
sil shared_external @default argument 2 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> () : $@convention(thin) () -> @owned String {
bb0:
%0 = string_literal utf8 "\n" // user: %5
%1 = integer_literal $Builtin.Word, 1 // user: %5
%2 = integer_literal $Builtin.Int1, -1 // user: %5
%3 = metatype $@thin String.Type // user: %5
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%4 = function_ref @Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %5
%5 = apply %4(%0, %1, %2, %3) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %6
return %5 : $String // id: %6
} // end sil function 'default argument 2 of Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()'
// print(_:separator:terminator:)
sil @Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> () : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> ()
// protocol witness for static Equatable.== infix(_:_:) in conformance Int
sil shared_external [transparent] [thunk] @protocol witness for static Swift.Equatable.== infix(A, A) -> Swift.Bool in conformance Swift.Int : Swift.Equatable in Swift : $@convention(witness_method: Equatable) (@in_guaranteed Int, @in_guaranteed Int, @thick Int.Type) -> Bool {
// %0 // user: %3
// %1 // user: %5
bb0(%0 : $*Int, %1 : $*Int, %2 : $@thick Int.Type):
%3 = struct_element_addr %0 : $*Int, #Int._value // user: %4
%4 = load %3 : $*Builtin.Int64 // user: %7
%5 = struct_element_addr %1 : $*Int, #Int._value // user: %6
%6 = load %5 : $*Builtin.Int64 // user: %7
%7 = builtin "cmp_eq_Int64"(%4 : $Builtin.Int64, %6 : $Builtin.Int64) : $Builtin.Int1 // user: %8
%8 = struct $Bool (%7 : $Builtin.Int1) // user: %9
return %8 : $Bool // id: %9
} // end sil function 'protocol witness for static Swift.Equatable.== infix(A, A) -> Swift.Bool in conformance Swift.Int : Swift.Equatable in Swift'
// Array._endMutation()
sil shared_external [_semantics "array.end_mutation"] @Swift.Array._endMutation() -> () : $@convention(method) <Element> (@inout Array<Element>) -> () {
// %0 // users: %9, %1
bb0(%0 : $*Array<Element>):
%1 = struct_element_addr %0 : $*Array<Element>, #Array._buffer // user: %2
%2 = struct_element_addr %1 : $*_ArrayBuffer<Element>, #_ArrayBuffer._storage // user: %3
%3 = struct_element_addr %2 : $*_BridgeStorage<__ContiguousArrayStorageBase>, #_BridgeStorage.rawValue // user: %4
%4 = load %3 : $*Builtin.BridgeObject // user: %5
%5 = end_cow_mutation %4 : $Builtin.BridgeObject // user: %6
%6 = struct $_BridgeStorage<__ContiguousArrayStorageBase> (%5 : $Builtin.BridgeObject) // user: %7
%7 = struct $_ArrayBuffer<Element> (%6 : $_BridgeStorage<__ContiguousArrayStorageBase>) // user: %8
%8 = struct $Array<Element> (%7 : $_ArrayBuffer<Element>) // user: %9
store %8 to %0 : $*Array<Element> // id: %9
%10 = tuple () // user: %11
return %10 : $() // id: %11
} // end sil function 'Swift.Array._endMutation() -> ()'
sil_witness_table hidden YREPIKModule: Equatable module main {
method #Equatable."==": <Self where Self : Equatable> (Self.Type) -> (Self, Self) -> Bool : @protocol witness for static Swift.Equatable.== infix(A, A) -> Swift.Bool in conformance main.YREPIKModule : Swift.Equatable in main // protocol witness for static Equatable.== infix(_:_:) in conformance YREPIKModule
}
sil_witness_table hidden YREPIKModule: Hashable module main {
base_protocol Equatable: YREPIKModule: Equatable module main
method #Hashable.hashValue!getter: <Self where Self : Hashable> (Self) -> () -> Int : @protocol witness for Swift.Hashable.hashValue.getter : Swift.Int in conformance main.YREPIKModule : Swift.Hashable in main // protocol witness for Hashable.hashValue.getter in conformance YREPIKModule
method #Hashable.hash: <Self where Self : Hashable> (Self) -> (inout Hasher) -> () : @protocol witness for Swift.Hashable.hash(into: inout Swift.Hasher) -> () in conformance main.YREPIKModule : Swift.Hashable in main // protocol witness for Hashable.hash(into:) in conformance YREPIKModule
method #Hashable._rawHashValue: <Self where Self : Hashable> (Self) -> (Int) -> Int : @protocol witness for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int in conformance main.YREPIKModule : Swift.Hashable in main // protocol witness for Hashable._rawHashValue(seed:) in conformance YREPIKModule
}
sil_witness_table hidden YREPIKModule: RawRepresentable module main {
associated_type RawValue: String
method #RawRepresentable.init!allocator: <Self where Self : RawRepresentable> (Self.Type) -> (Self.RawValue) -> Self? : @protocol witness for Swift.RawRepresentable.init(rawValue: A.RawValue) -> A? in conformance main.YREPIKModule : Swift.RawRepresentable in main // protocol witness for RawRepresentable.init(rawValue:) in conformance YREPIKModule
method #RawRepresentable.rawValue!getter: <Self where Self : RawRepresentable> (Self) -> () -> Self.RawValue : @protocol witness for Swift.RawRepresentable.rawValue.getter : A.RawValue in conformance main.YREPIKModule : Swift.RawRepresentable in main // protocol witness for RawRepresentable.rawValue.getter in conformance YREPIKModule
}
sil_witness_table public_external Int: Equatable module Swift {
method #Equatable."==": <Self where Self : Equatable> (Self.Type) -> (Self, Self) -> Bool : @protocol witness for static Swift.Equatable.== infix(A, A) -> Swift.Bool in conformance Swift.Int : Swift.Equatable in Swift // protocol witness for static Equatable.== infix(_:_:) in conformance Int
}
// Mappings from '#fileID' to '#filePath':
// 'main/main.swift' => 'main.swift'
项目忙,附上个人根据源码的简单总结,日后更新详细分析....
WX20211208-104859@2x.png
网友评论