-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagic.rawsil
230 lines (204 loc) · 12.5 KB
/
magic.rawsil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
sil_stage raw
import Builtin
import Swift
import SwiftShims
class Magic {
func number() -> Int
@objc deinit
init()
}
@_inheritsConvenienceInitializers final class SpecialMagic : Magic {
override final func number() -> Int
override init()
@objc deinit
}
@_hasStorage @_hasInitialValue public var number: Int { get set }
func magicTest()
// number
sil_global @$s5magic6numberSivp : $Int
// main
sil [ossa] @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
alloc_global @$s5magic6numberSivp // id: %2
%3 = global_addr @$s5magic6numberSivp : $*Int // users: %9, %8
%4 = integer_literal $Builtin.IntLiteral, -1 // user: %7
%5 = metatype $@thin Int.Type // user: %7
// function_ref Int.init(_builtinIntegerLiteral:)
%6 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %7
%7 = apply %6(%4, %5) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %8
store %7 to [trivial] %3 : $*Int // id: %8
mark_function_escape %3 : $*Int // id: %9
%10 = integer_literal $Builtin.Int32, 0 // user: %11
%11 = struct $Int32 (%10 : $Builtin.Int32) // user: %12
return %11 : $Int32 // id: %12
} // end sil function 'main'
// Magic.number()
sil hidden [ossa] @$s5magic5MagicC6numberSiyF : $@convention(method) (@guaranteed Magic) -> Int {
// %0 "self" // user: %1
bb0(%0 : @guaranteed $Magic):
debug_value %0 : $Magic, let, name "self", argno 1, implicit // id: %1
%2 = integer_literal $Builtin.IntLiteral, 0 // user: %5
%3 = metatype $@thin Int.Type // user: %5
// function_ref Int.init(_builtinIntegerLiteral:)
%4 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %5
%5 = apply %4(%2, %3) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %6
return %5 : $Int // id: %6
} // end sil function '$s5magic5MagicC6numberSiyF'
// Int.init(_builtinIntegerLiteral:)
sil [transparent] [serialized] @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
// Magic.deinit
sil hidden [ossa] @$s5magic5MagicCfd : $@convention(method) (@guaranteed Magic) -> @owned Builtin.NativeObject {
// %0 "self" // users: %2, %1
bb0(%0 : @guaranteed $Magic):
debug_value %0 : $Magic, let, name "self", argno 1, implicit // id: %1
%2 = unchecked_ref_cast %0 : $Magic to $Builtin.NativeObject // user: %3
%3 = unchecked_ownership_conversion %2 : $Builtin.NativeObject, @guaranteed to @owned // user: %4
return %3 : $Builtin.NativeObject // id: %4
} // end sil function '$s5magic5MagicCfd'
// Magic.__deallocating_deinit
sil hidden [ossa] @$s5magic5MagicCfD : $@convention(method) (@owned Magic) -> () {
// %0 "self" // users: %6, %3, %1
bb0(%0 : @owned $Magic):
debug_value %0 : $Magic, let, name "self", argno 1, implicit // id: %1
// function_ref Magic.deinit
%2 = function_ref @$s5magic5MagicCfd : $@convention(method) (@guaranteed Magic) -> @owned Builtin.NativeObject // user: %4
%3 = begin_borrow %0 : $Magic // users: %5, %4
%4 = apply %2(%3) : $@convention(method) (@guaranteed Magic) -> @owned Builtin.NativeObject // user: %7
end_borrow %3 : $Magic // id: %5
end_lifetime %0 : $Magic // id: %6
%7 = unchecked_ref_cast %4 : $Builtin.NativeObject to $Magic // user: %8
dealloc_ref %7 : $Magic // id: %8
%9 = tuple () // user: %10
return %9 : $() // id: %10
} // end sil function '$s5magic5MagicCfD'
// Magic.__allocating_init()
sil hidden [exact_self_class] [ossa] @$s5magic5MagicCACycfC : $@convention(method) (@thick Magic.Type) -> @owned Magic {
// %0 "$metatype"
bb0(%0 : $@thick Magic.Type):
%1 = alloc_ref $Magic // user: %3
// function_ref Magic.init()
%2 = function_ref @$s5magic5MagicCACycfc : $@convention(method) (@owned Magic) -> @owned Magic // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned Magic) -> @owned Magic // user: %4
return %3 : $Magic // id: %4
} // end sil function '$s5magic5MagicCACycfC'
// Magic.init()
sil hidden [ossa] @$s5magic5MagicCACycfc : $@convention(method) (@owned Magic) -> @owned Magic {
// %0 "self" // users: %2, %1
bb0(%0 : @owned $Magic):
debug_value %0 : $Magic, let, name "self", argno 1, implicit // id: %1
%2 = mark_uninitialized [rootself] %0 : $Magic // users: %4, %3
%3 = copy_value %2 : $Magic // user: %5
destroy_value %2 : $Magic // id: %4
return %3 : $Magic // id: %5
} // end sil function '$s5magic5MagicCACycfc'
// SpecialMagic.number()
sil hidden [ossa] @$s5magic12SpecialMagicC6numberSiyF : $@convention(method) (@guaranteed SpecialMagic) -> Int {
// %0 "self" // user: %1
bb0(%0 : @guaranteed $SpecialMagic):
debug_value %0 : $SpecialMagic, let, name "self", argno 1, implicit // id: %1
%2 = integer_literal $Builtin.IntLiteral, 42 // user: %5
%3 = metatype $@thin Int.Type // user: %5
// function_ref Int.init(_builtinIntegerLiteral:)
%4 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %5
%5 = apply %4(%2, %3) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %6
return %5 : $Int // id: %6
} // end sil function '$s5magic12SpecialMagicC6numberSiyF'
// SpecialMagic.__allocating_init()
sil hidden [exact_self_class] [ossa] @$s5magic12SpecialMagicCACycfC : $@convention(method) (@thick SpecialMagic.Type) -> @owned SpecialMagic {
// %0 "$metatype"
bb0(%0 : $@thick SpecialMagic.Type):
%1 = alloc_ref $SpecialMagic // user: %3
// function_ref SpecialMagic.init()
%2 = function_ref @$s5magic12SpecialMagicCACycfc : $@convention(method) (@owned SpecialMagic) -> @owned SpecialMagic // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned SpecialMagic) -> @owned SpecialMagic // user: %4
return %3 : $SpecialMagic // id: %4
} // end sil function '$s5magic12SpecialMagicCACycfC'
// SpecialMagic.init()
sil hidden [ossa] @$s5magic12SpecialMagicCACycfc : $@convention(method) (@owned SpecialMagic) -> @owned SpecialMagic {
// %0 "self" // user: %5
bb0(%0 : @owned $SpecialMagic):
%1 = alloc_box ${ var SpecialMagic }, let, name "self" // user: %2
%2 = mark_uninitialized [derivedself] %1 : ${ var SpecialMagic } // users: %14, %3
%3 = begin_borrow [lexical] %2 : ${ var SpecialMagic } // users: %13, %4
%4 = project_box %3 : ${ var SpecialMagic }, 0 // users: %12, %11, %6, %5
store %0 to [init] %4 : $*SpecialMagic // id: %5
%6 = load [take] %4 : $*SpecialMagic // user: %7
%7 = upcast %6 : $SpecialMagic to $Magic // user: %9
// function_ref Magic.init()
%8 = function_ref @$s5magic5MagicCACycfc : $@convention(method) (@owned Magic) -> @owned Magic // user: %9
%9 = apply %8(%7) : $@convention(method) (@owned Magic) -> @owned Magic // user: %10
%10 = unchecked_ref_cast %9 : $Magic to $SpecialMagic // user: %11
store %10 to [init] %4 : $*SpecialMagic // id: %11
%12 = load [copy] %4 : $*SpecialMagic // user: %15
end_borrow %3 : ${ var SpecialMagic } // id: %13
destroy_value %2 : ${ var SpecialMagic } // id: %14
return %12 : $SpecialMagic // id: %15
} // end sil function '$s5magic12SpecialMagicCACycfc'
// SpecialMagic.deinit
sil hidden [ossa] @$s5magic12SpecialMagicCfd : $@convention(method) (@guaranteed SpecialMagic) -> @owned Builtin.NativeObject {
// %0 "self" // users: %2, %1
bb0(%0 : @guaranteed $SpecialMagic):
debug_value %0 : $SpecialMagic, let, name "self", argno 1, implicit // id: %1
%2 = upcast %0 : $SpecialMagic to $Magic // user: %4
// function_ref Magic.deinit
%3 = function_ref @$s5magic5MagicCfd : $@convention(method) (@guaranteed Magic) -> @owned Builtin.NativeObject // user: %4
%4 = apply %3(%2) : $@convention(method) (@guaranteed Magic) -> @owned Builtin.NativeObject // users: %8, %5
%5 = begin_borrow %4 : $Builtin.NativeObject // users: %7, %6
%6 = unchecked_ref_cast %5 : $Builtin.NativeObject to $SpecialMagic
end_borrow %5 : $Builtin.NativeObject // id: %7
return %4 : $Builtin.NativeObject // id: %8
} // end sil function '$s5magic12SpecialMagicCfd'
// SpecialMagic.__deallocating_deinit
sil hidden [ossa] @$s5magic12SpecialMagicCfD : $@convention(method) (@owned SpecialMagic) -> () {
// %0 "self" // users: %6, %3, %1
bb0(%0 : @owned $SpecialMagic):
debug_value %0 : $SpecialMagic, let, name "self", argno 1, implicit // id: %1
// function_ref SpecialMagic.deinit
%2 = function_ref @$s5magic12SpecialMagicCfd : $@convention(method) (@guaranteed SpecialMagic) -> @owned Builtin.NativeObject // user: %4
%3 = begin_borrow %0 : $SpecialMagic // users: %5, %4
%4 = apply %2(%3) : $@convention(method) (@guaranteed SpecialMagic) -> @owned Builtin.NativeObject // user: %7
end_borrow %3 : $SpecialMagic // id: %5
end_lifetime %0 : $SpecialMagic // id: %6
%7 = unchecked_ref_cast %4 : $Builtin.NativeObject to $SpecialMagic // user: %8
dealloc_ref %7 : $SpecialMagic // id: %8
%9 = tuple () // user: %10
return %9 : $() // id: %10
} // end sil function '$s5magic12SpecialMagicCfD'
// magicTest()
sil hidden [ossa] @$s5magic0A4TestyyF : $@convention(thin) () -> () {
bb0:
%0 = global_addr @$s5magic6numberSivp : $*Int // user: %12
%1 = metatype $@thick SpecialMagic.Type // user: %3
// function_ref SpecialMagic.__allocating_init()
%2 = function_ref @$s5magic12SpecialMagicCACycfC : $@convention(method) (@thick SpecialMagic.Type) -> @owned SpecialMagic // user: %3
%3 = apply %2(%1) : $@convention(method) (@thick SpecialMagic.Type) -> @owned SpecialMagic // users: %18, %4
%4 = begin_borrow [lexical] %3 : $SpecialMagic // users: %17, %6, %5
debug_value %4 : $SpecialMagic, let, name "specialMagic" // id: %5
%6 = copy_value %4 : $SpecialMagic // user: %7
%7 = upcast %6 : $SpecialMagic to $Magic // users: %16, %8
%8 = begin_borrow [lexical] %7 : $Magic // users: %15, %11, %10, %9
debug_value %8 : $Magic, let, name "magic" // id: %9
%10 = class_method %8 : $Magic, #Magic.number : (Magic) -> () -> Int, $@convention(method) (@guaranteed Magic) -> Int // user: %11
%11 = apply %10(%8) : $@convention(method) (@guaranteed Magic) -> Int // user: %13
%12 = begin_access [modify] [dynamic] %0 : $*Int // users: %14, %13
assign %11 to %12 : $*Int // id: %13
end_access %12 : $*Int // id: %14
end_borrow %8 : $Magic // id: %15
destroy_value %7 : $Magic // id: %16
end_borrow %4 : $SpecialMagic // id: %17
destroy_value %3 : $SpecialMagic // id: %18
%19 = tuple () // user: %20
return %19 : $() // id: %20
} // end sil function '$s5magic0A4TestyyF'
sil_vtable Magic {
#Magic.number: (Magic) -> () -> Int : @$s5magic5MagicC6numberSiyF // Magic.number()
#Magic.init!allocator: (Magic.Type) -> () -> Magic : @$s5magic5MagicCACycfC // Magic.__allocating_init()
#Magic.deinit!deallocator: @$s5magic5MagicCfD // Magic.__deallocating_deinit
}
sil_vtable SpecialMagic {
#Magic.number: (Magic) -> () -> Int : @$s5magic12SpecialMagicC6numberSiyF [override] // SpecialMagic.number()
#Magic.init!allocator: (Magic.Type) -> () -> Magic : @$s5magic12SpecialMagicCACycfC [override] // SpecialMagic.__allocating_init()
#SpecialMagic.deinit!deallocator: @$s5magic12SpecialMagicCfD // SpecialMagic.__deallocating_deinit
}
// Mappings from '#fileID' to '#filePath':
// 'magic/magic.swift' => 'StudySwift/ExpertSwift/S1_CoreConcpets/magic.swift'