@@ -202,23 +202,11 @@ class BottomUpRefCountState : public RefCountState {
202
202
// / true.
203
203
bool initWithMutatorInst (SILInstruction *I);
204
204
205
- // / Check if PotentialDecrement can decrement the reference count associated
206
- // / with the value we are tracking. If so advance the state's sequence
207
- // / appropriately and return true. Otherwise return false.
208
- bool handlePotentialDecrement (SILInstruction *Decrement, AliasAnalysis *AA);
209
-
210
- // / Check if PotentialUser could be a use of the reference counted value that
211
- // / requires user to be alive. If so advance the state's sequence
212
- // / appropriately and return true. Otherwise return false.
213
- bool handlePotentialUser (SILInstruction *PotentialUser,
214
- SILInstruction *InsertPt, AliasAnalysis *AA);
215
-
216
- // / Check if PotentialGuaranteedUser can use the reference count associated
217
- // / with the value we are tracking. If so advance the state's sequence
218
- // / appropriately and return true. Otherwise return false.
219
- bool handlePotentialGuaranteedUser (SILInstruction *User,
220
- SILInstruction *InsertPt,
221
- AliasAnalysis *AA);
205
+ // / Update this reference count's state given the instruction \p I. \p
206
+ // / InsertPt is the point furthest up the CFG where we can move the currently
207
+ // / tracked reference count.
208
+ void updateForSameLoopInst (SILInstruction *I, SILInstruction *InsertPt,
209
+ AliasAnalysis *AA);
222
210
223
211
// / Attempt to merge \p Other into this ref count state. Return true if we
224
212
// / succeed and false otherwise.
@@ -249,6 +237,11 @@ class BottomUpRefCountState : public RefCountState {
249
237
// / advance return true. Otherwise return false.
250
238
bool handleDecrement (SILInstruction *PotentialDecrement);
251
239
240
+ // / Check if PotentialDecrement can decrement the reference count associated
241
+ // / with the value we are tracking. If so advance the state's sequence
242
+ // / appropriately and return true. Otherwise return false.
243
+ bool handlePotentialDecrement (SILInstruction *Decrement, AliasAnalysis *AA);
244
+
252
245
// / Returns true if given the current lattice state, do we care if the value
253
246
// / we are tracking is used.
254
247
bool valueCanBeUsedGivenLatticeState () const ;
@@ -260,6 +253,12 @@ class BottomUpRefCountState : public RefCountState {
260
253
bool handleUser (SILInstruction *PotentialUser, SILInstruction *InsertPt,
261
254
SILValue RCIdentity, AliasAnalysis *AA);
262
255
256
+ // / Check if PotentialUser could be a use of the reference counted value that
257
+ // / requires user to be alive. If so advance the state's sequence
258
+ // / appropriately and return true. Otherwise return false.
259
+ bool handlePotentialUser (SILInstruction *PotentialUser,
260
+ SILInstruction *InsertPt, AliasAnalysis *AA);
261
+
263
262
// / Returns true if given the current lattice state, do we care if the value
264
263
// / we are tracking is used.
265
264
bool valueCanBeGuaranteedUsedGivenLatticeState () const ;
@@ -272,6 +271,13 @@ class BottomUpRefCountState : public RefCountState {
272
271
SILInstruction *InsertPt, SILValue RCIdentity,
273
272
AliasAnalysis *AA);
274
273
274
+ // / Check if PotentialGuaranteedUser can use the reference count associated
275
+ // / with the value we are tracking. If so advance the state's sequence
276
+ // / appropriately and return true. Otherwise return false.
277
+ bool handlePotentialGuaranteedUser (SILInstruction *User,
278
+ SILInstruction *InsertPt,
279
+ AliasAnalysis *AA);
280
+
275
281
// / We have a matching ref count inst. Return true if we advance the sequence
276
282
// / and false otherwise.
277
283
bool handleRefCountInstMatch (SILInstruction *RefCountInst);
@@ -322,23 +328,11 @@ class TopDownRefCountState : public RefCountState {
322
328
// / Uninitialize the current state.
323
329
void clear ();
324
330
325
- // / Check if PotentialDecrement can decrement the reference count associated
326
- // / with the value we are tracking. If so advance the state's sequence
327
- // / appropriately and return true. Otherwise return false.
328
- bool handlePotentialDecrement (SILInstruction *PotentialDecrement,
329
- SILInstruction *InsertPt, AliasAnalysis *AA);
330
-
331
- // / Check if PotentialUser could be a use of the reference counted value that
332
- // / requires user to be alive. If so advance the state's sequence
333
- // / appropriately and return true. Otherwise return false.
334
- bool handlePotentialUser (SILInstruction *PotentialUser, AliasAnalysis *AA);
335
-
336
- // / Check if PotentialGuaranteedUser can use the reference count associated
337
- // / with the value we are tracking. If so advance the state's sequence
338
- // / appropriately and return true. Otherwise return false.
339
- bool handlePotentialGuaranteedUser (SILInstruction *PotentialGuaranteedUser,
340
- SILInstruction *InsertPt,
341
- AliasAnalysis *AA);
331
+ // / Update this reference count's state given the instruction \p I. \p
332
+ // / InsertPt is the point furthest up the CFG where we can move the currently
333
+ // / tracked reference count.
334
+ void updateForSameLoopInst (SILInstruction *I, SILInstruction *InsertPt,
335
+ AliasAnalysis *AA);
342
336
343
337
// / Returns true if the passed in ref count inst matches the ref count inst
344
338
// / we are tracking. This handles generically retains/release.
@@ -361,6 +355,12 @@ class TopDownRefCountState : public RefCountState {
361
355
bool handleDecrement (SILInstruction *PotentialDecrement,
362
356
SILInstruction *InsertPt);
363
357
358
+ // / Check if PotentialDecrement can decrement the reference count associated
359
+ // / with the value we are tracking. If so advance the state's sequence
360
+ // / appropriately and return true. Otherwise return false.
361
+ bool handlePotentialDecrement (SILInstruction *PotentialDecrement,
362
+ SILInstruction *InsertPt, AliasAnalysis *AA);
363
+
364
364
// / Returns true if given the current lattice state, do we care if the value
365
365
// / we are tracking is used.
366
366
bool valueCanBeUsedGivenLatticeState () const ;
@@ -370,6 +370,11 @@ class TopDownRefCountState : public RefCountState {
370
370
bool handleUser (SILInstruction *PotentialUser,
371
371
SILValue RCIdentity, AliasAnalysis *AA);
372
372
373
+ // / Check if PotentialUser could be a use of the reference counted value that
374
+ // / requires user to be alive. If so advance the state's sequence
375
+ // / appropriately and return true. Otherwise return false.
376
+ bool handlePotentialUser (SILInstruction *PotentialUser, AliasAnalysis *AA);
377
+
373
378
// / Returns true if given the current lattice state, do we care if the value
374
379
// / we are tracking is used.
375
380
bool valueCanBeGuaranteedUsedGivenLatticeState () const ;
@@ -380,6 +385,13 @@ class TopDownRefCountState : public RefCountState {
380
385
SILInstruction *InsertPt, SILValue RCIdentity,
381
386
AliasAnalysis *AA);
382
387
388
+ // / Check if PotentialGuaranteedUser can use the reference count associated
389
+ // / with the value we are tracking. If so advance the state's sequence
390
+ // / appropriately and return true. Otherwise return false.
391
+ bool handlePotentialGuaranteedUser (SILInstruction *PotentialGuaranteedUser,
392
+ SILInstruction *InsertPt,
393
+ AliasAnalysis *AA);
394
+
383
395
// / We have a matching ref count inst. Return true if we advance the sequence
384
396
// / and false otherwise.
385
397
bool handleRefCountInstMatch (SILInstruction *RefCountInst);
0 commit comments