mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
[objc-arc] Move the checking of whether or not we can match onto PtrStates and out of the main dataflow.
These refactored computations check whether or not we are at a stage
of the sequence where we can perform a match. This patch moves the
computation out of the main dataflow and into
{BottomUp,TopDown}PtrState.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231439 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -164,6 +164,29 @@ bool BottomUpPtrState::InitBottomUp(ARCMDKindCache &Cache, Instruction *I) {
|
||||
return NestingDetected;
|
||||
}
|
||||
|
||||
bool BottomUpPtrState::MatchWithRetain() {
|
||||
SetKnownPositiveRefCount();
|
||||
|
||||
Sequence OldSeq = GetSeq();
|
||||
switch (OldSeq) {
|
||||
case S_Stop:
|
||||
case S_Release:
|
||||
case S_MovableRelease:
|
||||
case S_Use:
|
||||
// If OldSeq is not S_Use or OldSeq is S_Use and we are tracking an
|
||||
// imprecise release, clear our reverse insertion points.
|
||||
if (OldSeq != S_Use || IsTrackingImpreciseReleases())
|
||||
ClearReverseInsertPts();
|
||||
// FALL THROUGH
|
||||
case S_CanRelease:
|
||||
return true;
|
||||
case S_None:
|
||||
return false;
|
||||
case S_Retain:
|
||||
llvm_unreachable("bottom-up pointer in retain state!");
|
||||
}
|
||||
}
|
||||
|
||||
bool TopDownPtrState::InitTopDown(ARCInstKind Kind, Instruction *I) {
|
||||
bool NestingDetected = false;
|
||||
// Don't do retain+release tracking for ARCInstKind::RetainRV, because
|
||||
@@ -188,3 +211,30 @@ bool TopDownPtrState::InitTopDown(ARCInstKind Kind, Instruction *I) {
|
||||
SetKnownPositiveRefCount();
|
||||
return NestingDetected;
|
||||
}
|
||||
|
||||
bool TopDownPtrState::MatchWithRelease(ARCMDKindCache &Cache,
|
||||
Instruction *Release) {
|
||||
ClearKnownPositiveRefCount();
|
||||
|
||||
Sequence OldSeq = GetSeq();
|
||||
|
||||
MDNode *ReleaseMetadata = Release->getMetadata(Cache.ImpreciseReleaseMDKind);
|
||||
|
||||
switch (OldSeq) {
|
||||
case S_Retain:
|
||||
case S_CanRelease:
|
||||
if (OldSeq == S_Retain || ReleaseMetadata != nullptr)
|
||||
ClearReverseInsertPts();
|
||||
// FALL THROUGH
|
||||
case S_Use:
|
||||
SetReleaseMetadata(ReleaseMetadata);
|
||||
SetTailCallRelease(cast<CallInst>(Release)->isTailCall());
|
||||
return true;
|
||||
case S_None:
|
||||
return false;
|
||||
case S_Stop:
|
||||
case S_Release:
|
||||
case S_MovableRelease:
|
||||
llvm_unreachable("top-down pointer in bottom up state!");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user