@@ -197,32 +197,39 @@ enum ForwardingUseResult: CustomStringConvertible {
197
197
}
198
198
}
199
199
200
- /// Visit all the uses in a forward-extended lifetime
200
+ /// Visit all the non-forwarding uses in a forward-extended lifetime
201
201
/// (LifetimeIntroducer -> Operand).
202
202
///
203
203
/// Minimal requirements:
204
204
/// needWalk(for value: Value) -> Bool
205
- /// leafUse (_ operand: Operand) -> WalkResult
205
+ /// nonForwardingUse (_ operand: Operand) -> WalkResult
206
206
/// deadValue(_ value: Value, using operand: Operand?) -> WalkResult
207
207
///
208
208
/// Start walking:
209
209
/// walkDown(root: Value)
210
+ ///
210
211
protocol ForwardingDefUseWalker {
211
- // Minimally, check a ValueSet. This walker may traverse chains of
212
- // aggregation and destructuring by default. Implementations may
213
- // handle phis.
212
+ /// Minimally, check a ValueSet. This walker may traverse chains of
213
+ /// aggregation and destructuring by default. Implementations may
214
+ /// handle phis.
214
215
mutating func needWalk( for value: Value ) -> Bool
215
216
216
- mutating func leafUse( _ operand: Operand ) -> WalkResult
217
+ /// A nonForwarding use does not forward ownership, but may
218
+ /// propagate the lifetime in other ways, such as an interior
219
+ /// pointer.
220
+ mutating func nonForwardingUse( _ operand: Operand ) -> WalkResult
217
221
218
- // Report any initial or forwarded value with no uses. Only relevant for
219
- // guaranteed values or incomplete OSSA. This could be a dead
220
- // instruction, a terminator in which the result is dead on one
221
- // path, or a dead phi.
222
- //
223
- // \p operand is nil if \p value is the root.
222
+ /// Report any initial or forwarded value with no uses. Only relevant for
223
+ /// guaranteed values or incomplete OSSA. This could be a dead
224
+ /// instruction, a terminator in which the result is dead on one
225
+ /// path, or a dead phi.
226
+ ///
227
+ /// \p operand is nil if \p value is the root.
224
228
mutating func deadValue( _ value: Value , using operand: Operand ? ) -> WalkResult
225
229
230
+ /// This is called for every forwarded value. If the root was an
231
+ /// owned value, then this identifies all OSSA lifetimes in the
232
+ /// forward-extendd lifetime.
226
233
mutating func walkDownUses( of: Value , using: Operand ? ) -> WalkResult
227
234
228
235
mutating func walkDown( operand: Operand ) -> WalkResult
@@ -235,7 +242,7 @@ extension ForwardingDefUseWalker {
235
242
}
236
243
237
244
mutating func walkDownUses( of value: Value , using operand: Operand ? )
238
- -> WalkResult {
245
+ -> WalkResult {
239
246
return walkDownUsesDefault ( forwarding: value, using: operand)
240
247
}
241
248
@@ -268,7 +275,7 @@ extension ForwardingDefUseWalker {
268
275
if let phi = Phi ( using: operand) {
269
276
return walkDownUses ( of: phi. value, using: operand)
270
277
}
271
- return leafUse ( operand)
278
+ return nonForwardingUse ( operand)
272
279
}
273
280
}
274
281
@@ -301,7 +308,7 @@ private struct VisitForwardedUses : ForwardingDefUseWalker {
301
308
visitedValues. insert ( value)
302
309
}
303
310
304
- mutating func leafUse ( _ operand: Operand ) -> WalkResult {
311
+ mutating func nonForwardingUse ( _ operand: Operand ) -> WalkResult {
305
312
return visitor ( . operand( operand) )
306
313
}
307
314
0 commit comments