Last active
August 29, 2015 14:13
-
-
Save norio-nomura/f95c5921484da4a55242 to your computer and use it in GitHub Desktop.
`swift-demangle-filter.py -emit-sil indexof.swift -o indexof.sil`
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
sil_stage canonical | |
import Builtin | |
import Swift | |
import SwiftShims | |
// indexof.a : Swift.Array<Swift.Int> | |
sil_global indexof.a : [Swift.Int] : $Array<Int> | |
// indexof.c (Swift.Int) -> Swift.Bool | |
sil_global indexof.c (Swift.Int) -> Swift.Bool : $@callee_owned (Int) -> Bool | |
// indexof.result1 : Swift.Optional<Swift.Int> | |
sil_global indexof.result1 : Swift.Int? : $Optional<Int> | |
// indexof.result2 : Swift.Optional<Swift.Int> | |
sil_global indexof.result2 : Swift.Int? : $Optional<Int> | |
// top_level_code | |
sil private @top_level_code : $@thin () -> () { | |
bb0: | |
%0 = sil_global_addr indexof.a : [Swift.Int] : $*Array<Int> // users: %23, %31, %43 | |
// function_ref Swift.Array.init <A>(Swift.Array<A>.Type)(arrayLiteral : Swift.Array<A>...) -> Swift.Array<A> | |
%1 = function_ref Swift.Array.init <A>([A].Type)(arrayLiteral : [A]...) -> [A] : $@thin <τ_0_0> (@owned Array<τ_0_0>, @thin Array<τ_0_0>.Type) -> @owned Array<τ_0_0> // user: %22 | |
%2 = metatype $@thin Array<Int>.Type // user: %22 | |
%3 = integer_literal $Builtin.Word, 1 // user: %4 | |
%4 = struct $Int (%3 : $Builtin.Word) // user: %11 | |
%5 = integer_literal $Builtin.Word, 2 // user: %6 | |
%6 = struct $Int (%5 : $Builtin.Word) // user: %14 | |
%7 = integer_literal $Builtin.Word, 3 // user: %8 | |
%8 = struct $Int (%7 : $Builtin.Word) // user: %17 | |
%9 = integer_literal $Builtin.Word, 3 // users: %10#0, %21 | |
%10 = alloc_array $Int, %9 : $Builtin.Word // users: %11, %13, %16, %18, %21 | |
store %4 to %10#1 : $*Int // id: %11 | |
%12 = integer_literal $Builtin.Word, 1 // user: %13 | |
%13 = index_addr %10#1 : $*Int, %12 : $Builtin.Word // user: %14 | |
store %6 to %13 : $*Int // id: %14 | |
%15 = integer_literal $Builtin.Word, 2 // user: %16 | |
%16 = index_addr %10#1 : $*Int, %15 : $Builtin.Word // user: %17 | |
store %8 to %16 : $*Int // id: %17 | |
%18 = address_to_pointer %10#1 : $*Int to $Builtin.RawPointer // user: %21 | |
// function_ref Swift.Array.convertFromHeapArray <A>(Swift.Array<A>.Type)(Builtin.RawPointer, owner : Builtin.NativeObject, count : Builtin.Word) -> Swift.Array<A> | |
%19 = function_ref Swift.Array.convertFromHeapArray <A>([A].Type)(Builtin.RawPointer, owner : Builtin.NativeObject, count : Builtin.Word) -> [A] : $@thin <τ_0_0> (Builtin.RawPointer, @owned Builtin.NativeObject, Builtin.Word, @thin Array<τ_0_0>.Type) -> @owned Array<τ_0_0> // user: %21 | |
%20 = metatype $@thin Array<Int>.Type // user: %21 | |
%21 = apply %19<Int>(%18, %10#0, %9, %20) : $@thin <τ_0_0> (Builtin.RawPointer, @owned Builtin.NativeObject, Builtin.Word, @thin Array<τ_0_0>.Type) -> @owned Array<τ_0_0> // user: %22 | |
%22 = apply %1<Int>(%21, %2) : $@thin <τ_0_0> (@owned Array<τ_0_0>, @thin Array<τ_0_0>.Type) -> @owned Array<τ_0_0> // user: %23 | |
store %22 to %0 : $*Array<Int> // id: %23 | |
%24 = sil_global_addr indexof.c (Swift.Int) -> Swift.Bool : $*@callee_owned (Int) -> Bool // users: %27, %34, %46 | |
// function_ref indexof.(closure #1) | |
%25 = function_ref indexof.(closure #1) : $@thin (Int) -> Bool // user: %26 | |
%26 = thin_to_thick_function %25 : $@thin (Int) -> Bool to $@callee_owned (Int) -> Bool // user: %27 | |
store %26 to %24 : $*@callee_owned (Int) -> Bool // id: %27 | |
%28 = sil_global_addr indexof.result1 : Swift.Int? : $*Optional<Int> // user: %38 | |
// function_ref indexof.v1_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> Swift.Optional<A.Index> | |
%29 = function_ref indexof.v1_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> A.Index? : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @owned @callee_owned (@in τ_0_0.Generator.Element) -> Bool) -> () // user: %38 | |
%30 = alloc_stack $Array<Int> // users: %33, %38, %39 | |
%31 = load %0 : $*Array<Int> // users: %32, %33 | |
retain_value %31 : $Array<Int> // id: %32 | |
store %31 to %30#1 : $*Array<Int> // id: %33 | |
%34 = load %24 : $*@callee_owned (Int) -> Bool // users: %35, %37 | |
strong_retain %34 : $@callee_owned (Int) -> Bool // id: %35 | |
// function_ref reabstraction thunk helper from @callee_owned (@unowned Swift.Int) -> (@unowned Swift.Bool) to @callee_owned (@in Swift.Int) -> (@unowned Swift.Bool) | |
%36 = function_ref reabstraction thunk helper from @callee_owned (@unowned Swift.Int) -> (@unowned Swift.Bool) to @callee_owned (@in Swift.Int) -> (@unowned Swift.Bool) : $@thin (@in Int, @owned @callee_owned (Int) -> Bool) -> Bool // user: %37 | |
%37 = partial_apply %36(%34) : $@thin (@in Int, @owned @callee_owned (Int) -> Bool) -> Bool // user: %38 | |
%38 = apply %29<[Int], IndexingGenerator<Array<Int>>, Int, Int, Int, Int, Int, Int>(%28, %30#1, %37) : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @owned @callee_owned (@in τ_0_0.Generator.Element) -> Bool) -> () | |
dealloc_stack %30#0 : $*@local_storage Array<Int> // id: %39 | |
%40 = sil_global_addr indexof.result2 : Swift.Int? : $*Optional<Int> // user: %50 | |
// function_ref indexof.v2_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> Swift.Optional<A.Index> | |
%41 = function_ref indexof.v2_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> A.Index? : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @owned @callee_owned (@in τ_0_0.Generator.Element) -> Bool) -> () // user: %50 | |
%42 = alloc_stack $Array<Int> // users: %45, %50, %51 | |
%43 = load %0 : $*Array<Int> // users: %44, %45 | |
retain_value %43 : $Array<Int> // id: %44 | |
store %43 to %42#1 : $*Array<Int> // id: %45 | |
%46 = load %24 : $*@callee_owned (Int) -> Bool // users: %47, %49 | |
strong_retain %46 : $@callee_owned (Int) -> Bool // id: %47 | |
// function_ref reabstraction thunk helper from @callee_owned (@unowned Swift.Int) -> (@unowned Swift.Bool) to @callee_owned (@in Swift.Int) -> (@unowned Swift.Bool) | |
%48 = function_ref reabstraction thunk helper from @callee_owned (@unowned Swift.Int) -> (@unowned Swift.Bool) to @callee_owned (@in Swift.Int) -> (@unowned Swift.Bool) : $@thin (@in Int, @owned @callee_owned (Int) -> Bool) -> Bool // user: %49 | |
%49 = partial_apply %48(%46) : $@thin (@in Int, @owned @callee_owned (Int) -> Bool) -> Bool // user: %50 | |
%50 = apply %41<[Int], IndexingGenerator<Array<Int>>, Int, Int, Int, Int, Int, Int>(%40, %42#1, %49) : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @owned @callee_owned (@in τ_0_0.Generator.Element) -> Bool) -> () | |
dealloc_stack %42#0 : $*@local_storage Array<Int> // id: %51 | |
%52 = tuple () // user: %53 | |
return %52 : $() // id: %53 | |
} | |
// indexof.v1_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> Swift.Optional<A.Index> | |
sil indexof.v1_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> A.Index? : $@thin <C where C : CollectionType, C.Generator : GeneratorType, C.Generator.Element : Equatable, C.Index : ForwardIndexType, C.Index.Distance : _SignedIntegerType, C.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<C.Index>, @in C, @owned @callee_owned (@in C.Generator.Element) -> Bool) -> () { | |
bb0(%0 : $*Optional<C.Index>, %1 : $*C, %2 : $@callee_owned (@in C.Generator.Element) -> Bool): | |
debug_value_addr %1 : $*C // let domain // id: %3 | |
debug_value %2 : $@callee_owned (@in C.Generator.Element) -> Bool // let condition // id: %4 | |
// function_ref Swift.find <A : Swift.CollectionType>(A, A.Generator.Element) -> Swift.Optional<A.Index> | |
%5 = function_ref Swift.find <A : Swift.CollectionType>(A, A.Generator.Element) -> A.Index? : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @in τ_0_0.Generator.Element) -> () // user: %21 | |
%6 = alloc_stack $LazyForwardCollection<MapCollectionView<C, Bool>> // users: %16, %21, %25 | |
// function_ref Swift.LazyForwardCollection.map <A : Swift.CollectionType>(Swift.LazyForwardCollection<A>)<E>((A.Generator.Element) -> E) -> Swift.LazyForwardCollection<Swift.MapCollectionView<A, E>> | |
%7 = function_ref Swift.LazyForwardCollection.map <A : Swift.CollectionType>(Swift.LazyForwardCollection<A>)<E>((A.Generator.Element) -> E) -> Swift.LazyForwardCollection<Swift.MapCollectionView<A, E>> : $@cc(method) @thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible><τ_1_0> (@out LazyForwardCollection<MapCollectionView<τ_0_0, τ_1_0>>, @owned @callee_owned (@out τ_1_0, @in τ_0_0.Generator.Element) -> (), @in LazyForwardCollection<τ_0_0>) -> () // user: %16 | |
%8 = alloc_stack $LazyForwardCollection<C> // users: %12, %16, %24 | |
// function_ref Swift.lazy <A : Swift.CollectionType>(A) -> Swift.LazyForwardCollection<A> | |
%9 = function_ref Swift.lazy <A : Swift.CollectionType>(A) -> Swift.LazyForwardCollection<A> : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out LazyForwardCollection<τ_0_0>, @in τ_0_0) -> () // user: %12 | |
%10 = alloc_stack $C // users: %11, %12, %23 | |
copy_addr %1 to [initialization] %10#1 : $*C // id: %11 | |
%12 = apply %9<C, C.Generator, C.Generator.Element, C.Index, C.Index.Distance, C.Index.Distance.IntegerLiteralType, C.Index._DisabledRangeIndex, C._Element>(%8#1, %10#1) : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out LazyForwardCollection<τ_0_0>, @in τ_0_0) -> () | |
strong_retain %2 : $@callee_owned (@in C.Generator.Element) -> Bool // id: %13 | |
// function_ref reabstraction thunk helper <T_0_0 where T_0_0: Swift.CollectionType, T_0_0.Generator: Swift.GeneratorType, T_0_0.Generator.Element: Swift.Equatable, T_0_0.Index: Swift.ForwardIndexType, T_0_0.Index.Distance: Swift._SignedIntegerType, T_0_0.Index.Distance.IntegerLiteralType: Swift._BuiltinIntegerLiteralConvertible> from @callee_owned (@in T_0_0.Generator.Element) -> (@unowned Swift.Bool) to @callee_owned (@in T_0_0.Generator.Element) -> (@out Swift.Bool) | |
%14 = function_ref reabstraction thunk helper <T_0_0 where T_0_0: Swift.CollectionType, T_0_0.Generator: Swift.GeneratorType, T_0_0.Generator.Element: Swift.Equatable, T_0_0.Index: Swift.ForwardIndexType, T_0_0.Index.Distance: Swift._SignedIntegerType, T_0_0.Index.Distance.IntegerLiteralType: Swift._BuiltinIntegerLiteralConvertible> from @callee_owned (@in T_0_0.Generator.Element) -> (@unowned Swift.Bool) to @callee_owned (@in T_0_0.Generator.Element) -> (@out Swift.Bool) : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Bool, @in τ_0_0.Generator.Element, @owned @callee_owned (@in τ_0_0.Generator.Element) -> Bool) -> () // user: %15 | |
%15 = partial_apply %14<C, C.Generator, C.Generator.Element, C.Index, C.Index.Distance, C.Index.Distance.IntegerLiteralType, C.Index._DisabledRangeIndex, C._Element>(%2) : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Bool, @in τ_0_0.Generator.Element, @owned @callee_owned (@in τ_0_0.Generator.Element) -> Bool) -> () // user: %16 | |
%16 = apply %7<C, C.Generator, C.Generator.Element, C.Index, C.Index.Distance, C.Index.Distance.IntegerLiteralType, C.Index._DisabledRangeIndex, C._Element, Bool>(%6#1, %15, %8#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible><τ_1_0> (@out LazyForwardCollection<MapCollectionView<τ_0_0, τ_1_0>>, @owned @callee_owned (@out τ_1_0, @in τ_0_0.Generator.Element) -> (), @in LazyForwardCollection<τ_0_0>) -> () | |
%17 = alloc_stack $Bool // users: %20, %21, %22 | |
%18 = integer_literal $Builtin.Int1, -1 // user: %19 | |
%19 = struct $Bool (%18 : $Builtin.Int1) // user: %20 | |
store %19 to %17#1 : $*Bool // id: %20 | |
%21 = apply %5<LazyForwardCollection<MapCollectionView<C, Bool>>, MapSequenceGenerator<C.Generator, Bool>, Bool, C.Index, C.Index.Distance, C.Index.Distance.IntegerLiteralType, C.Index._DisabledRangeIndex, Bool>(%0, %6#1, %17#1) : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @in τ_0_0.Generator.Element) -> () | |
dealloc_stack %17#0 : $*@local_storage Bool // id: %22 | |
dealloc_stack %10#0 : $*@local_storage C // id: %23 | |
dealloc_stack %8#0 : $*@local_storage LazyForwardCollection<C> // id: %24 | |
dealloc_stack %6#0 : $*@local_storage LazyForwardCollection<MapCollectionView<C, Bool>> // id: %25 | |
strong_release %2 : $@callee_owned (@in C.Generator.Element) -> Bool // id: %26 | |
destroy_addr %1 : $*C // id: %27 | |
%28 = tuple () // user: %29 | |
return %28 : $() // id: %29 | |
} | |
// Swift.find <A : Swift.CollectionType>(A, A.Generator.Element) -> Swift.Optional<A.Index> | |
sil Swift.find <A : Swift.CollectionType>(A, A.Generator.Element) -> A.Index? : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Generator.Element : Equatable, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<τ_0_0.Index>, @in τ_0_0, @in τ_0_0.Generator.Element) -> () | |
// Swift.LazyForwardCollection.map <A : Swift.CollectionType>(Swift.LazyForwardCollection<A>)<E>((A.Generator.Element) -> E) -> Swift.LazyForwardCollection<Swift.MapCollectionView<A, E>> | |
sil Swift.LazyForwardCollection.map <A : Swift.CollectionType>(Swift.LazyForwardCollection<A>)<E>((A.Generator.Element) -> E) -> Swift.LazyForwardCollection<Swift.MapCollectionView<A, E>> : $@cc(method) @thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible><τ_1_0> (@out LazyForwardCollection<MapCollectionView<τ_0_0, τ_1_0>>, @owned @callee_owned (@out τ_1_0, @in τ_0_0.Generator.Element) -> (), @in LazyForwardCollection<τ_0_0>) -> () | |
// Swift.lazy <A : Swift.CollectionType>(A) -> Swift.LazyForwardCollection<A> | |
sil Swift.lazy <A : Swift.CollectionType>(A) -> Swift.LazyForwardCollection<A> : $@thin <τ_0_0 where τ_0_0 : CollectionType, τ_0_0.Generator : GeneratorType, τ_0_0.Index : ForwardIndexType, τ_0_0.Index.Distance : _SignedIntegerType, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out LazyForwardCollection<τ_0_0>, @in τ_0_0) -> () | |
// reabstraction thunk helper <T_0_0 where T_0_0: Swift.CollectionType, T_0_0.Generator: Swift.GeneratorType, T_0_0.Generator.Element: Swift.Equatable, T_0_0.Index: Swift.ForwardIndexType, T_0_0.Index.Distance: Swift._SignedIntegerType, T_0_0.Index.Distance.IntegerLiteralType: Swift._BuiltinIntegerLiteralConvertible> from @callee_owned (@in T_0_0.Generator.Element) -> (@unowned Swift.Bool) to @callee_owned (@in T_0_0.Generator.Element) -> (@out Swift.Bool) | |
sil shared [transparent] reabstraction thunk helper <T_0_0 where T_0_0: Swift.CollectionType, T_0_0.Generator: Swift.GeneratorType, T_0_0.Generator.Element: Swift.Equatable, T_0_0.Index: Swift.ForwardIndexType, T_0_0.Index.Distance: Swift._SignedIntegerType, T_0_0.Index.Distance.IntegerLiteralType: Swift._BuiltinIntegerLiteralConvertible> from @callee_owned (@in T_0_0.Generator.Element) -> (@unowned Swift.Bool) to @callee_owned (@in T_0_0.Generator.Element) -> (@out Swift.Bool) : $@thin <C where C : CollectionType, C.Generator : GeneratorType, C.Generator.Element : Equatable, C.Index : ForwardIndexType, C.Index.Distance : _SignedIntegerType, C.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Bool, @in C.Generator.Element, @owned @callee_owned (@in C.Generator.Element) -> Bool) -> () { | |
bb0(%0 : $*Bool, %1 : $*C.Generator.Element, %2 : $@callee_owned (@in C.Generator.Element) -> Bool): | |
%3 = apply %2(%1) : $@callee_owned (@in C.Generator.Element) -> Bool // user: %4 | |
store %3 to %0 : $*Bool // id: %4 | |
%5 = tuple () // user: %6 | |
return %5 : $() // id: %6 | |
} | |
// Swift.Bool.init (Swift.Bool.Type)(_builtinBooleanLiteral : Builtin.Int1) -> Swift.Bool | |
sil public_external [transparent] Swift.Bool.init (Swift.Bool.Type)(_builtinBooleanLiteral : Builtin.Int1) -> Swift.Bool : $@thin (Builtin.Int1, @thin Bool.Type) -> Bool { | |
bb0(%0 : $Builtin.Int1, %1 : $@thin Bool.Type): | |
%2 = struct $Bool (%0 : $Builtin.Int1) // user: %3 | |
return %2 : $Bool // id: %3 | |
} | |
// indexof.v2_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> Swift.Optional<A.Index> | |
sil indexof.v2_index_of <A : Swift.CollectionType>(A, (A.Generator.Element) -> Swift.Bool) -> A.Index? : $@thin <C where C : CollectionType, C.Generator : GeneratorType, C.Index : ForwardIndexType, C.Index.Distance : _SignedIntegerType, C.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible> (@out Optional<C.Index>, @in C, @owned @callee_owned (@in C.Generator.Element) -> Bool) -> () { | |
bb0(%0 : $*Optional<C.Index>, %1 : $*C, %2 : $@callee_owned (@in C.Generator.Element) -> Bool): | |
%3 = alloc_stack $EnumerateGenerator<C.Generator> // var $generator // users: %12, %18, %52, %59, %67 | |
debug_value_addr %1 : $*C // let domain // id: %4 | |
debug_value %2 : $@callee_owned (@in C.Generator.Element) -> Bool // let condition // id: %5 | |
// function_ref Swift.EnumerateSequence.generate <A : Swift.SequenceType>(Swift.EnumerateSequence<A>)() -> Swift.EnumerateGenerator<A.Generator> | |
%6 = function_ref Swift.EnumerateSequence.generate <A : Swift.SequenceType>(Swift.EnumerateSequence<A>)() -> Swift.EnumerateGenerator<A.Generator> : $@cc(method) @thin <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out EnumerateGenerator<τ_0_0.Generator>, @in EnumerateSequence<τ_0_0>) -> () // user: %12 | |
%7 = alloc_stack $EnumerateSequence<C> // users: %11, %12, %14 | |
// function_ref Swift.enumerate <A : Swift.SequenceType>(A) -> Swift.EnumerateSequence<A> | |
%8 = function_ref Swift.enumerate <A : Swift.SequenceType>(A) -> Swift.EnumerateSequence<A> : $@thin <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out EnumerateSequence<τ_0_0>, @in τ_0_0) -> () // user: %11 | |
%9 = alloc_stack $C // users: %10, %11, %13 | |
copy_addr %1 to [initialization] %9#1 : $*C // id: %10 | |
%11 = apply %8<C, C.Generator, C.Generator.Element>(%7#1, %9#1) : $@thin <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out EnumerateSequence<τ_0_0>, @in τ_0_0) -> () | |
%12 = apply %6<C, C.Generator, C.Generator.Element>(%3#1, %7#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out EnumerateGenerator<τ_0_0.Generator>, @in EnumerateSequence<τ_0_0>) -> () | |
dealloc_stack %9#0 : $*@local_storage C // id: %13 | |
dealloc_stack %7#0 : $*@local_storage EnumerateSequence<C> // id: %14 | |
%15 = alloc_stack $Optional<(index: Int, element: C.Generator.Element)> // users: %18, %20, %25, %51, %58 | |
br bb1 // id: %16 | |
bb1: // Preds: bb0 bb7 | |
// function_ref Swift.EnumerateGenerator.next <A : Swift.GeneratorType>(inout Swift.EnumerateGenerator<A>)() -> Swift.Optional<(index : Swift.Int, element : A.Element)> | |
%17 = function_ref Swift.EnumerateGenerator.next <A : Swift.GeneratorType>(inout Swift.EnumerateGenerator<A>)() -> (index : Swift.Int, element : A.Element)? : $@cc(method) @thin <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<(index: Int, element: τ_0_0.Element)>, @inout EnumerateGenerator<τ_0_0>) -> () // user: %18 | |
%18 = apply %17<C.Generator, C.Generator.Element>(%15#1, %3#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<(index: Int, element: τ_0_0.Element)>, @inout EnumerateGenerator<τ_0_0>) -> () | |
// function_ref Swift._doesOptionalHaveValue <A>(inout Swift.Optional<A>) -> Builtin.Int1 | |
%19 = function_ref Swift._doesOptionalHaveValue <A>(inout A?) -> Builtin.Int1 : $@thin <τ_0_0> (@inout Optional<τ_0_0>) -> Builtin.Int1 // user: %20 | |
%20 = apply [transparent] %19<(index: Int, element: C.Generator.Element)>(%15#1) : $@thin <τ_0_0> (@inout Optional<τ_0_0>) -> Builtin.Int1 // user: %21 | |
cond_br %20, bb2, bb8 // id: %21 | |
bb2: // Preds: bb1 | |
%22 = alloc_stack $C.Generator.Element // let element // users: %30, %33, %49, %50, %55, %56 | |
// function_ref Swift._getOptionalValue <A>(Swift.Optional<A>) -> A | |
%23 = function_ref Swift._getOptionalValue <A>(A?) -> A : $@thin <τ_0_0> (@out τ_0_0, @in Optional<τ_0_0>) -> () // user: %25 | |
%24 = alloc_stack $(index: Int, element: C.Generator.Element) // users: %25, %26, %28, %48, %54 | |
%25 = apply [transparent] %23<(index: Int, element: C.Generator.Element)>(%24#1, %15#1) : $@thin <τ_0_0> (@out τ_0_0, @in Optional<τ_0_0>) -> () | |
%26 = tuple_element_addr %24#1 : $*(index: Int, element: C.Generator.Element), 0 // user: %27 | |
%27 = load %26 : $*Int // users: %29, %40 | |
%28 = tuple_element_addr %24#1 : $*(index: Int, element: C.Generator.Element), 1 // user: %30 | |
debug_value %27 : $Int // let idx // id: %29 | |
copy_addr [take] %28 to [initialization] %22#1 : $*C.Generator.Element // id: %30 | |
strong_retain %2 : $@callee_owned (@in C.Generator.Element) -> Bool // id: %31 | |
%32 = alloc_stack $C.Generator.Element // users: %33, %34, %36 | |
copy_addr %22#1 to [initialization] %32#1 : $*C.Generator.Element // id: %33 | |
%34 = apply %2(%32#1) : $@callee_owned (@in C.Generator.Element) -> Bool // user: %35 | |
%35 = struct_extract %34 : $Bool, #Bool.value // user: %37 | |
dealloc_stack %32#0 : $*@local_storage C.Generator.Element // id: %36 | |
cond_br %35, bb3, bb7 // id: %37 | |
bb3: // Preds: bb2 | |
%38 = init_enum_data_addr %0 : $*Optional<C.Index>, #Optional.Some!enumelt.1 // user: %41 | |
%39 = alloc_stack $Int // users: %40, %41, %43, %46 | |
store %27 to %39#1 : $*Int // id: %40 | |
checked_cast_addr_br take_always Int in %39#1 : $*Int to C.Index in %38 : $*C.Index, bb4, bb5 // id: %41 | |
bb4: // Preds: bb3 | |
inject_enum_addr %0 : $*Optional<C.Index>, #Optional.Some!enumelt.1 // id: %42 | |
dealloc_stack %39#0 : $*@local_storage Int // id: %43 | |
br bb6 // id: %44 | |
bb5: // Preds: bb3 | |
inject_enum_addr %0 : $*Optional<C.Index>, #Optional.None!enumelt // id: %45 | |
dealloc_stack %39#0 : $*@local_storage Int // id: %46 | |
br bb6 // id: %47 | |
bb6: // Preds: bb4 bb5 | |
dealloc_stack %24#0 : $*@local_storage (index: Int, element: C.Generator.Element) // id: %48 | |
destroy_addr %22#1 : $*C.Generator.Element // id: %49 | |
dealloc_stack %22#0 : $*@local_storage C.Generator.Element // id: %50 | |
dealloc_stack %15#0 : $*@local_storage Optional<(index: Int, element: C.Generator.Element)> // id: %51 | |
destroy_addr %3#1 : $*EnumerateGenerator<C.Generator> // id: %52 | |
br bb9 // id: %53 | |
bb7: // Preds: bb2 | |
dealloc_stack %24#0 : $*@local_storage (index: Int, element: C.Generator.Element) // id: %54 | |
destroy_addr %22#1 : $*C.Generator.Element // id: %55 | |
dealloc_stack %22#0 : $*@local_storage C.Generator.Element // id: %56 | |
br bb1 // id: %57 | |
bb8: // Preds: bb1 | |
dealloc_stack %15#0 : $*@local_storage Optional<(index: Int, element: C.Generator.Element)> // id: %58 | |
destroy_addr %3#1 : $*EnumerateGenerator<C.Generator> // id: %59 | |
// function_ref Swift.Optional.init <A>(Swift.Optional<A>.Type)(nilLiteral : ()) -> Swift.Optional<A> | |
%60 = function_ref Swift.Optional.init <A>(A?.Type)(nilLiteral : ()) -> A? : $@thin <τ_0_0> (@out Optional<τ_0_0>, @thin Optional<τ_0_0>.Type) -> () // user: %62 | |
%61 = metatype $@thin Optional<C.Index>.Type // user: %62 | |
%62 = apply [transparent] %60<C.Index>(%0, %61) : $@thin <τ_0_0> (@out Optional<τ_0_0>, @thin Optional<τ_0_0>.Type) -> () | |
br bb9 // id: %63 | |
bb9: // Preds: bb6 bb8 | |
strong_release %2 : $@callee_owned (@in C.Generator.Element) -> Bool // id: %64 | |
destroy_addr %1 : $*C // id: %65 | |
%66 = tuple () // user: %68 | |
dealloc_stack %3#0 : $*@local_storage EnumerateGenerator<C.Generator> // id: %67 | |
return %66 : $() // id: %68 | |
} | |
// Swift.EnumerateSequence.generate <A : Swift.SequenceType>(Swift.EnumerateSequence<A>)() -> Swift.EnumerateGenerator<A.Generator> | |
sil Swift.EnumerateSequence.generate <A : Swift.SequenceType>(Swift.EnumerateSequence<A>)() -> Swift.EnumerateGenerator<A.Generator> : $@cc(method) @thin <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out EnumerateGenerator<τ_0_0.Generator>, @in EnumerateSequence<τ_0_0>) -> () | |
// Swift.enumerate <A : Swift.SequenceType>(A) -> Swift.EnumerateSequence<A> | |
sil Swift.enumerate <A : Swift.SequenceType>(A) -> Swift.EnumerateSequence<A> : $@thin <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out EnumerateSequence<τ_0_0>, @in τ_0_0) -> () | |
// Swift.EnumerateGenerator.next <A : Swift.GeneratorType>(inout Swift.EnumerateGenerator<A>)() -> Swift.Optional<(index : Swift.Int, element : A.Element)> | |
sil Swift.EnumerateGenerator.next <A : Swift.GeneratorType>(inout Swift.EnumerateGenerator<A>)() -> (index : Swift.Int, element : A.Element)? : $@cc(method) @thin <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<(index: Int, element: τ_0_0.Element)>, @inout EnumerateGenerator<τ_0_0>) -> () | |
// Swift._doesOptionalHaveValue <A>(inout Swift.Optional<A>) -> Builtin.Int1 | |
sil public_external [transparent] Swift._doesOptionalHaveValue <A>(inout A?) -> Builtin.Int1 : $@thin <T> (@inout Optional<T>) -> Builtin.Int1 { | |
bb0(%0 : $*Optional<T>): | |
// function_ref Swift.!= infix <A>(Swift.Optional<A>, Swift._OptionalNilComparisonType) -> Swift.Bool | |
%1 = function_ref Swift.!= infix <A>(A?, Swift._OptionalNilComparisonType) -> Swift.Bool : $@thin <τ_0_0> (@in Optional<τ_0_0>, _OptionalNilComparisonType) -> Bool // user: %5 | |
%2 = alloc_stack $Optional<T> // users: %3, %5, %7 | |
copy_addr %0 to [initialization] %2#1 : $*Optional<T> // id: %3 | |
%4 = struct $_OptionalNilComparisonType () // user: %5 | |
%5 = apply %1<T>(%2#1, %4) : $@thin <τ_0_0> (@in Optional<τ_0_0>, _OptionalNilComparisonType) -> Bool // user: %6 | |
%6 = struct_extract %5 : $Bool, #Bool.value // user: %8 | |
dealloc_stack %2#0 : $*@local_storage Optional<T> // id: %7 | |
return %6 : $Builtin.Int1 // id: %8 | |
} | |
// Swift._getOptionalValue <A>(Swift.Optional<A>) -> A | |
sil public_external [transparent] Swift._getOptionalValue <A>(A?) -> A : $@thin <T> (@out T, @in Optional<T>) -> () { | |
bb0(%0 : $*T, %1 : $*Optional<T>): | |
%2 = alloc_stack $T // users: %7, %8, %12 | |
%3 = alloc_stack $Optional<T> // users: %4, %5, %6, %9, %14 | |
copy_addr %1 to [initialization] %3#1 : $*Optional<T> // id: %4 | |
switch_enum_addr %3#1 : $*Optional<T>, case #Optional.Some!enumelt.1: bb1, case #Optional.None!enumelt: bb2 // id: %5 | |
bb1: // Preds: bb0 | |
%6 = unchecked_take_enum_data_addr %3#1 : $*Optional<T>, #Optional.Some!enumelt.1 // user: %7 | |
copy_addr [take] %6 to [initialization] %2#1 : $*T // id: %7 | |
copy_addr [take] %2#1 to [initialization] %0 : $*T // id: %8 | |
dealloc_stack %3#0 : $*@local_storage Optional<T> // id: %9 | |
destroy_addr %1 : $*Optional<T> // id: %10 | |
%11 = tuple () // user: %13 | |
dealloc_stack %2#0 : $*@local_storage T // id: %12 | |
return %11 : $() // id: %13 | |
bb2: // Preds: bb0 | |
dealloc_stack %3#0 : $*@local_storage Optional<T> // id: %14 | |
%15 = string_literal utf8 "unexpectedly found nil while unwrapping an Optional value" // user: %18 | |
%16 = integer_literal $Builtin.Word, 57 // user: %18 | |
%17 = integer_literal $Builtin.Word, 2 // users: %18, %21, %28 | |
%18 = struct $StaticString (%15 : $Builtin.RawPointer, %16 : $Builtin.Word, %17 : $Builtin.Word) // user: %29 | |
%19 = string_literal utf8 "/SourceCache/swiftlang/swiftlang-600.0.57.3/src/tools/swift/stdlib/core/Optional.swift" // user: %21 | |
%20 = integer_literal $Builtin.Word, 86 // user: %21 | |
%21 = struct $StaticString (%19 : $Builtin.RawPointer, %20 : $Builtin.Word, %17 : $Builtin.Word) // user: %29 | |
%22 = integer_literal $Builtin.Word, 102 // user: %23 | |
%23 = struct $UInt (%22 : $Builtin.Word) // user: %29 | |
br bb3 // id: %24 | |
bb3: // Preds: bb2 | |
// function_ref Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () | |
%25 = function_ref Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () : $@thin @noreturn (StaticString, StaticString, StaticString, UInt) -> () // user: %29 | |
%26 = string_literal utf8 "fatal error" // user: %28 | |
%27 = integer_literal $Builtin.Word, 11 // user: %28 | |
%28 = struct $StaticString (%26 : $Builtin.RawPointer, %27 : $Builtin.Word, %17 : $Builtin.Word) // user: %29 | |
%29 = apply %25(%28, %18, %21, %23) : $@thin @noreturn (StaticString, StaticString, StaticString, UInt) -> () | |
unreachable // id: %30 | |
} | |
// Swift.Bool._getBuiltinLogicValue (Swift.Bool)() -> Builtin.Int1 | |
sil public_external [transparent] Swift.Bool._getBuiltinLogicValue (Swift.Bool)() -> Builtin.Int1 : $@cc(method) @thin (Bool) -> Builtin.Int1 { | |
bb0(%0 : $Bool): | |
%1 = struct_extract %0 : $Bool, #Bool.value // user: %2 | |
return %1 : $Builtin.Int1 // id: %2 | |
} | |
// Swift.Optional.init <A>(Swift.Optional<A>.Type)(nilLiteral : ()) -> Swift.Optional<A> | |
sil public_external [transparent] Swift.Optional.init <A>(A?.Type)(nilLiteral : ()) -> A? : $@thin <T> (@out Optional<T>, @thin Optional<T>.Type) -> () { | |
bb0(%0 : $*Optional<T>, %1 : $@thin Optional<T>.Type): | |
%2 = alloc_stack $Optional<T> // users: %7, %9, %11 | |
// function_ref Swift.Optional.None <A>(Swift.Optional<A>.Type) -> Swift.Optional<A> | |
%3 = function_ref Swift.Optional.None <A>(A?.Type) -> A? : $@thin <τ_0_0> (@out Optional<τ_0_0>, @thin Optional<τ_0_0>.Type) -> () // user: %6 | |
%4 = metatype $@thin Optional<T>.Type // user: %6 | |
%5 = alloc_stack $Optional<T> // users: %6, %7, %8 | |
%6 = apply [transparent] %3<T>(%5#1, %4) : $@thin <τ_0_0> (@out Optional<τ_0_0>, @thin Optional<τ_0_0>.Type) -> () | |
copy_addr [take] %5#1 to [initialization] %2#1 : $*Optional<T> // id: %7 | |
dealloc_stack %5#0 : $*@local_storage Optional<T> // id: %8 | |
copy_addr [take] %2#1 to [initialization] %0 : $*Optional<T> // id: %9 | |
%10 = tuple () // user: %12 | |
dealloc_stack %2#0 : $*@local_storage Optional<T> // id: %11 | |
return %10 : $() // id: %12 | |
} | |
// Swift.Array.init <A>(Swift.Array<A>.Type)(arrayLiteral : Swift.Array<A>...) -> Swift.Array<A> | |
sil Swift.Array.init <A>([A].Type)(arrayLiteral : [A]...) -> [A] : $@thin <τ_0_0> (@owned Array<τ_0_0>, @thin Array<τ_0_0>.Type) -> @owned Array<τ_0_0> | |
// Swift.Int.init (Swift.Int.Type)(_builtinIntegerLiteral : Builtin.Int2048) -> Swift.Int | |
sil public_external [transparent] Swift.Int.init (Swift.Int.Type)(_builtinIntegerLiteral : Builtin.Int2048) -> Swift.Int : $@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 | |
} | |
// Swift.Array.convertFromHeapArray <A>(Swift.Array<A>.Type)(Builtin.RawPointer, owner : Builtin.NativeObject, count : Builtin.Word) -> Swift.Array<A> | |
sil [readonly] Swift.Array.convertFromHeapArray <A>([A].Type)(Builtin.RawPointer, owner : Builtin.NativeObject, count : Builtin.Word) -> [A] : $@thin <τ_0_0> (Builtin.RawPointer, @owned Builtin.NativeObject, Builtin.Word, @thin Array<τ_0_0>.Type) -> @owned Array<τ_0_0> | |
// indexof.(closure #1) | |
sil shared indexof.(closure #1) : $@thin (Int) -> Bool { | |
bb0(%0 : $Int): | |
debug_value %0 : $Int // let e // id: %1 | |
%2 = integer_literal $Builtin.Word, 1 // user: %5 | |
%3 = builtin_function_ref "cmp_eq_Word" : $@thin (Builtin.Word, Builtin.Word) -> Builtin.Int1 // user: %5 | |
%4 = struct_extract %0 : $Int, #Int.value // user: %5 | |
%5 = apply %3(%4, %2) : $@thin (Builtin.Word, Builtin.Word) -> Builtin.Int1 // user: %6 | |
%6 = struct $Bool (%5 : $Builtin.Int1) // user: %7 | |
return %6 : $Bool // id: %7 | |
} | |
// Swift.== infix (Swift.Int, Swift.Int) -> Swift.Bool | |
sil public_external [transparent] Swift.== infix (Swift.Int, Swift.Int) -> Swift.Bool : $@thin (Int, Int) -> Bool { | |
bb0(%0 : $Int, %1 : $Int): | |
%2 = builtin_function_ref "cmp_eq_Word" : $@thin (Builtin.Word, Builtin.Word) -> Builtin.Int1 // user: %5 | |
%3 = struct_extract %0 : $Int, #Int.value // user: %5 | |
%4 = struct_extract %1 : $Int, #Int.value // user: %5 | |
%5 = apply %2(%3, %4) : $@thin (Builtin.Word, Builtin.Word) -> Builtin.Int1 // user: %6 | |
%6 = struct $Bool (%5 : $Builtin.Int1) // user: %7 | |
return %6 : $Bool // id: %7 | |
} | |
// reabstraction thunk helper from @callee_owned (@unowned Swift.Int) -> (@unowned Swift.Bool) to @callee_owned (@in Swift.Int) -> (@unowned Swift.Bool) | |
sil shared [transparent] reabstraction thunk helper from @callee_owned (@unowned Swift.Int) -> (@unowned Swift.Bool) to @callee_owned (@in Swift.Int) -> (@unowned Swift.Bool) : $@thin (@in Int, @owned @callee_owned (Int) -> Bool) -> Bool { | |
bb0(%0 : $*Int, %1 : $@callee_owned (Int) -> Bool): | |
%2 = load %0 : $*Int // user: %3 | |
%3 = apply %1(%2) : $@callee_owned (Int) -> Bool // user: %4 | |
return %3 : $Bool // id: %4 | |
} | |
// C.NSFastEnumerationState.init (C.NSFastEnumerationState.Type)(state : Swift.UInt, itemsPtr : Swift.AutoreleasingUnsafeMutablePointer<Swift.Optional<Swift.AnyObject>>, mutationsPtr : Swift.UnsafeMutablePointer<Swift.UInt>, extra : (Swift.UInt, Swift.UInt, Swift.UInt, Swift.UInt, Swift.UInt)) -> C.NSFastEnumerationState | |
sil shared C.NSFastEnumerationState.init (C.NSFastEnumerationState.Type)(state : Swift.UInt, itemsPtr : Swift.AutoreleasingUnsafeMutablePointer<Swift.AnyObject?>, mutationsPtr : Swift.UnsafeMutablePointer<Swift.UInt>, extra : (Swift.UInt, Swift.UInt, Swift.UInt, Swift.UInt, Swift.UInt)) -> C.NSFastEnumerationState : $@thin (UInt, AutoreleasingUnsafeMutablePointer<Optional<AnyObject>>, UnsafeMutablePointer<UInt>, UInt, UInt, UInt, UInt, UInt, @thin NSFastEnumerationState.Type) -> NSFastEnumerationState { | |
bb0(%0 : $UInt, %1 : $AutoreleasingUnsafeMutablePointer<Optional<AnyObject>>, %2 : $UnsafeMutablePointer<UInt>, %3 : $UInt, %4 : $UInt, %5 : $UInt, %6 : $UInt, %7 : $UInt, %8 : $@thin NSFastEnumerationState.Type): | |
%9 = tuple (%3 : $UInt, %4 : $UInt, %5 : $UInt, %6 : $UInt, %7 : $UInt) // user: %10 | |
%10 = struct $NSFastEnumerationState (%0 : $UInt, %1 : $AutoreleasingUnsafeMutablePointer<Optional<AnyObject>>, %2 : $UnsafeMutablePointer<UInt>, %9 : $(UInt, UInt, UInt, UInt, UInt)) // user: %11 | |
return %10 : $NSFastEnumerationState // id: %11 | |
} | |
// C.CGPoint.init (C.CGPoint.Type)(x : CoreGraphics.CGFloat, y : CoreGraphics.CGFloat) -> C.CGPoint | |
sil shared C.CGPoint.init (C.CGPoint.Type)(x : CoreGraphics.CGFloat, y : CoreGraphics.CGFloat) -> C.CGPoint : $@thin (CGFloat, CGFloat, @thin CGPoint.Type) -> CGPoint { | |
bb0(%0 : $CGFloat, %1 : $CGFloat, %2 : $@thin CGPoint.Type): | |
%3 = struct $CGPoint (%0 : $CGFloat, %1 : $CGFloat) // user: %4 | |
return %3 : $CGPoint // id: %4 | |
} | |
// C.CGSize.init (C.CGSize.Type)(width : CoreGraphics.CGFloat, height : CoreGraphics.CGFloat) -> C.CGSize | |
sil shared C.CGSize.init (C.CGSize.Type)(width : CoreGraphics.CGFloat, height : CoreGraphics.CGFloat) -> C.CGSize : $@thin (CGFloat, CGFloat, @thin CGSize.Type) -> CGSize { | |
bb0(%0 : $CGFloat, %1 : $CGFloat, %2 : $@thin CGSize.Type): | |
%3 = struct $CGSize (%0 : $CGFloat, %1 : $CGFloat) // user: %4 | |
return %3 : $CGSize // id: %4 | |
} | |
// C.CGVector.init (C.CGVector.Type)(dx : CoreGraphics.CGFloat, dy : CoreGraphics.CGFloat) -> C.CGVector | |
sil shared C.CGVector.init (C.CGVector.Type)(dx : CoreGraphics.CGFloat, dy : CoreGraphics.CGFloat) -> C.CGVector : $@thin (CGFloat, CGFloat, @thin CGVector.Type) -> CGVector { | |
bb0(%0 : $CGFloat, %1 : $CGFloat, %2 : $@thin CGVector.Type): | |
%3 = struct $CGVector (%0 : $CGFloat, %1 : $CGFloat) // user: %4 | |
return %3 : $CGVector // id: %4 | |
} | |
// C.CGRect.init (C.CGRect.Type)(origin : C.CGPoint, size : C.CGSize) -> C.CGRect | |
sil shared C.CGRect.init (C.CGRect.Type)(origin : C.CGPoint, size : C.CGSize) -> C.CGRect : $@thin (CGPoint, CGSize, @thin CGRect.Type) -> CGRect { | |
bb0(%0 : $CGPoint, %1 : $CGSize, %2 : $@thin CGRect.Type): | |
%3 = struct $CGRect (%0 : $CGPoint, %1 : $CGSize) // user: %4 | |
return %3 : $CGRect // id: %4 | |
} | |
// Swift.!= infix <A>(Swift.Optional<A>, Swift._OptionalNilComparisonType) -> Swift.Bool | |
sil Swift.!= infix <A>(A?, Swift._OptionalNilComparisonType) -> Swift.Bool : $@thin <τ_0_0> (@in Optional<τ_0_0>, _OptionalNilComparisonType) -> Bool | |
// Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () | |
sil [noinline] Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () : $@thin @noreturn (StaticString, StaticString, StaticString, UInt) -> () | |
// Swift.Optional.None <A>(Swift.Optional<A>.Type) -> Swift.Optional<A> | |
sil public_external [transparent] Swift.Optional.None <A>(A?.Type) -> A? : $@thin <T> (@out Optional<T>, @thin Optional<T>.Type) -> () { | |
bb0(%0 : $*Optional<T>, %1 : $@thin Optional<T>.Type): | |
inject_enum_addr %0 : $*Optional<T>, #Optional.None!enumelt // id: %2 | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} | |
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
#!/usr/bin/env xcrun swift | |
import Foundation | |
func v1_index_of<C : CollectionType where C.Generator.Element : Equatable>(domain: C, condition: C.Generator.Element -> Bool) -> C.Index? { | |
return find(lazy(domain).map(condition), true) | |
} | |
func v2_index_of<C : CollectionType>(domain: C, condition: C.Generator.Element -> Bool) -> C.Index? { | |
for (idx, element) in enumerate(domain) { | |
if condition(element) { | |
return idx as? C.Index | |
} | |
} | |
return nil | |
} | |
let a = [1,2,3] | |
let c = {(e: Int) -> Bool in e == 1} | |
let result1 = v1_index_of(a, c) | |
let result2 = v2_index_of(a, c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment