LLVM
8.0.1
|
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
Functions | |
STATISTIC (NumNoops, "Number of no-op objc calls eliminated") | |
STATISTIC (NumPartialNoops, "Number of partially no-op objc calls eliminated") | |
STATISTIC (NumAutoreleases,"Number of autoreleases converted to releases") | |
STATISTIC (NumRets, "Number of return value forwarding " "retain+autoreleases eliminated") | |
STATISTIC (NumRRs, "Number of retain+release paths eliminated") | |
STATISTIC (NumPeeps, "Number of calls peephole-optimized") | |
STATISTIC (NumRetainsBeforeOpt, "Number of retains before optimization") | |
STATISTIC (NumReleasesBeforeOpt, "Number of releases before optimization") | |
STATISTIC (NumRetainsAfterOpt, "Number of retains after optimization") | |
STATISTIC (NumReleasesAfterOpt, "Number of releases after optimization") | |
INITIALIZE_PASS_BEGIN (ObjCARCOpt, "objc-arc", "ObjC ARC optimization", false, false) INITIALIZE_PASS_END(ObjCARCOpt | |
static void | CheckForUseCFGHazard (const Sequence SuccSSeq, const bool SuccSRRIKnownSafe, TopDownPtrState &S, bool &SomeSuccHasSame, bool &AllSuccsHaveSame, bool &NotAllSeqEqualButKnownSafe, bool &ShouldContinue) |
If we have a top down pointer in the S_Use state, make sure that there are no CFG hazards by checking the states of various bottom up pointers. More... | |
static void | CheckForCanReleaseCFGHazard (const Sequence SuccSSeq, const bool SuccSRRIKnownSafe, TopDownPtrState &S, bool &SomeSuccHasSame, bool &AllSuccsHaveSame, bool &NotAllSeqEqualButKnownSafe) |
If we have a Top Down pointer in the S_CanRelease state, make sure that there are no CFG hazards by checking the states of various bottom up pointers. More... | |
static void | ComputePostOrders (Function &F, SmallVectorImpl< BasicBlock *> &PostOrder, SmallVectorImpl< BasicBlock *> &ReverseCFGPostOrder, unsigned NoObjCARCExceptionsMDKind, DenseMap< const BasicBlock *, BBState > &BBStates) |
static bool | HasSafePathToPredecessorCall (const Value *Arg, Instruction *Retain, SmallPtrSetImpl< Instruction *> &DepInsts, SmallPtrSetImpl< const BasicBlock *> &Visited, ProvenanceAnalysis &PA) |
Check if there is a dependent call earlier that does not have anything in between the Retain and the call that can affect the reference count of their shared pointer argument. More... | |
static CallInst * | FindPredecessorRetainWithSafePath (const Value *Arg, BasicBlock *BB, Instruction *Autorelease, SmallPtrSetImpl< Instruction *> &DepInsts, SmallPtrSetImpl< const BasicBlock *> &Visited, ProvenanceAnalysis &PA) |
Find a dependent retain that precedes the given autorelease for which there is nothing in between the two instructions that can affect the ref count of Arg. More... | |
static CallInst * | FindPredecessorAutoreleaseWithSafePath (const Value *Arg, BasicBlock *BB, ReturnInst *Ret, SmallPtrSetImpl< Instruction *> &DepInsts, SmallPtrSetImpl< const BasicBlock *> &V, ProvenanceAnalysis &PA) |
Look for an ``autorelease'' instruction dependent on Arg such that there are no instructions dependent on Arg that need a positive ref count in between the autorelease and the ret. More... | |
raw_ostream & | llvm::operator<< (raw_ostream &OS, BBState &BBState) LLVM_ATTRIBUTE_UNUSED |
Pass * | llvm::createObjCARCOptPass () |
Variables | |
objc | arc |
objc ObjC ARC | optimization |
objc ObjC ARC | false |
static const unsigned | BBState::OverflowOccurredValue = 0xffffffff |
static char | ObjCARCOpt::ID = 0 |
|
static |
If we have a Top Down pointer in the S_CanRelease state, make sure that there are no CFG hazards by checking the states of various bottom up pointers.
Definition at line 1048 of file ObjCARCOpts.cpp.
References Arg, assert(), llvm::objcarc::AutoreleasepoolPop, llvm::objcarc::AutoreleasepoolPush, llvm::BasicBlock::back(), llvm::BasicBlock::begin(), CheckForUseCFGHazard(), llvm::objcarc::PtrState::ClearSequenceProgress(), llvm::dbgs(), E, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::BasicBlock::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::objcarc::GetARCInstKind(), llvm::objcarc::GetArgRCIdentityRoot(), llvm::objcarc::PtrState::GetRRInfo(), llvm::objcarc::PtrState::GetSeq(), llvm::objcarc::BottomUpPtrState::HandlePotentialAlterRefCount(), llvm::objcarc::TopDownPtrState::HandlePotentialAlterRefCount(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::objcarc::TopDownPtrState::HandlePotentialUse(), I, llvm::objcarc::BottomUpPtrState::InitBottomUp(), llvm::objcarc::TopDownPtrState::InitTopDown(), llvm::objcarc::PtrState::IsKnownSafe(), LLVM_DEBUG, llvm_unreachable, llvm::objcarc::TopDownPtrState::MatchWithRelease(), llvm::objcarc::BottomUpPtrState::MatchWithRetain(), MI, llvm::objcarc::None, llvm::objcarc::Release, llvm::objcarc::Retain, llvm::objcarc::RetainBlock, llvm::objcarc::RetainRV, llvm::objcarc::S_CanRelease, llvm::objcarc::S_MovableRelease, llvm::objcarc::S_None, llvm::objcarc::S_Release, llvm::objcarc::S_Retain, llvm::objcarc::S_Stop, llvm::objcarc::S_Use, llvm::objcarc::PtrState::SetCFGHazardAfflicted(), SI, and llvm::successors().
|
static |
If we have a top down pointer in the S_Use state, make sure that there are no CFG hazards by checking the states of various bottom up pointers.
Definition at line 1010 of file ObjCARCOpts.cpp.
References llvm::objcarc::PtrState::ClearSequenceProgress(), llvm::objcarc::PtrState::IsKnownSafe(), llvm_unreachable, llvm::objcarc::S_CanRelease, llvm::objcarc::S_MovableRelease, llvm::objcarc::S_None, llvm::objcarc::S_Release, llvm::objcarc::S_Retain, llvm::objcarc::S_Stop, llvm::objcarc::S_Use, and llvm::objcarc::PtrState::SetCFGHazardAfflicted().
Referenced by CheckForCanReleaseCFGHazard().
|
static |
The visited set, for doing DFS walks.
Definition at line 1408 of file ObjCARCOpts.cpp.
References Arg, assert(), llvm::objcarc::AutoreleasepoolPush, B, llvm::SmallVectorTemplateCommon< T >::back(), llvm::BlotMapVector< KeyT, ValueT >::begin(), llvm::BasicBlock::begin(), llvm::BlotMapVector< KeyT, ValueT >::blot(), llvm::objcarc::Call, llvm::objcarc::RRInfo::Calls, llvm::SmallPtrSetImplBase::clear(), llvm::objcarc::CopyWeak, llvm::SmallPtrSetImpl< PtrType >::count(), llvm::CallInst::Create(), llvm::dbgs(), llvm::objcarc::DestroyWeak, E, llvm::SmallVectorBase::empty(), llvm::BlotMapVector< KeyT, ValueT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::SmallPtrSetImpl< PtrType >::erase(), llvm::Instruction::eraseFromParent(), llvm::objcarc::EraseInstruction(), llvm::BlotMapVector< KeyT, ValueT >::find(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::objcarc::GetARCInstKind(), llvm::CallBase::getArgOperand(), llvm::objcarc::GetArgRCIdentityRoot(), llvm::objcarc::GetBasicARCInstKind(), llvm::InstIterator< BB_t, BB_i_t, BI_t, II_t >::getBasicBlockIterator(), llvm::Type::getContext(), llvm::Function::getEntryBlock(), llvm::InstIterator< BB_t, BB_i_t, BI_t, II_t >::getInstructionIterator(), llvm::Type::getInt8Ty(), llvm::Instruction::getParent(), llvm::GlobalValue::getParent(), llvm::objcarc::GetRCIdentityRoot(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::PointerType::getUnqual(), I, llvm::objcarc::ImpreciseRelease, llvm::objcarc::InitWeak, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::inst_begin(), llvm::inst_end(), llvm::objcarc::IntrinsicUser, llvm::objcarc::RRInfo::IsTailCallRelease, llvm::objcarc::RRInfo::KnownSafe, LLVM_DEBUG, llvm_unreachable, llvm::objcarc::LoadWeak, llvm::objcarc::LoadWeakRetained, llvm::MayAlias, llvm::objcarc::MoveWeak, llvm::MustAlias, llvm::NoAlias, llvm::objcarc::None, llvm::objcarc::NoObjCARCExceptions, llvm::PartialAlias, llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::pred_begin(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::objcarc::Release, llvm::objcarc::RRInfo::ReleaseMetadata, llvm::Value::replaceAllUsesWith(), llvm::objcarc::Retain, llvm::reverse(), llvm::objcarc::RRInfo::ReverseInsertPts, llvm::CallBase::setDoesNotThrow(), llvm::Instruction::setMetadata(), llvm::CallInst::setTailCall(), llvm::objcarc::StoreWeak, llvm::Value::use_empty(), llvm::objcarc::User, and llvm::Value::users().
Definition at line 564 of file ObjCARCOpts.cpp.
References llvm::AnalysisUsage::addRequired(), Arg, assert(), llvm::objcarc::Autorelease, llvm::objcarc::AutoreleasePoolBoundary, llvm::objcarc::AutoreleaseRV, llvm::BasicBlock::back(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::BasicBlock::begin(), llvm::SmallPtrSetImpl< PtrType >::begin(), C, llvm::objcarc::Call, llvm::objcarc::ClaimRV, llvm::classifyEHPersonality(), llvm::colorEHFunclets(), llvm::objcarc::CopyWeak, llvm::detail::DenseSetImpl< ValueT, SmallDenseMap< ValueT, detail::DenseSetEmpty, InlineBuckets, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::count(), llvm::CallInst::Create(), llvm::dbgs(), llvm::objcarc::DestroyWeak, llvm::dyn_cast(), E, llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::Instruction::eraseFromParent(), llvm::objcarc::EraseInstruction(), F(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::objcarc::FindDependencies(), FindSingleUseIdentifiedObject(), llvm::TinyPtrVector< EltTy >::front(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::CallBase::getArgOperand(), llvm::objcarc::GetArgRCIdentityRoot(), llvm::objcarc::GetBasicARCInstKind(), llvm::Value::getContext(), llvm::objcarc::getEquivalentPHIs(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getMetadata(), llvm::Constant::getNullValue(), llvm::PHINode::getNumIncomingValues(), llvm::CallBase::getNumOperandBundles(), llvm::Instruction::getNumSuccessors(), llvm::CallBase::getOperandBundleAt(), llvm::Instruction::getParent(), llvm::Function::getPersonalityFn(), llvm::objcarc::GetRCIdentityRoot(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::Function::hasPersonalityFn(), I, llvm::objcarc::ImpreciseRelease, llvm::objcarc::InitWeak, llvm::detail::DenseSetImpl< ValueT, SmallDenseMap< ValueT, detail::DenseSetEmpty, InlineBuckets, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), llvm::Instruction::insertBefore(), llvm::inst_begin(), llvm::inst_end(), llvm::objcarc::IsAlwaysTail(), llvm::objcarc::IsAutorelease(), llvm::objcarc::IsNeverTail(), llvm::objcarc::IsNoopInstruction(), llvm::objcarc::IsNoopOnNull(), llvm::objcarc::IsNoThrow(), llvm::objcarc::IsNullOrUndef(), llvm::isScopedEHPersonality(), LLVM_DEBUG, llvm_unreachable, llvm::objcarc::LoadWeak, llvm::objcarc::LoadWeakRetained, llvm::objcarc::MoveWeak, llvm::objcarc::NeedsPositiveRetainCount, llvm::objcarc::None, llvm::objcarc::NoopCast, llvm::LLVMContext::OB_funclet, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::objcarc::Release, llvm::Value::replaceAllUsesWith(), llvm::objcarc::Retain, llvm::objcarc::RetainBlock, llvm::objcarc::RetainRV, llvm::CallBase::setArgOperand(), llvm::CallBase::setCalledFunction(), setDoesNotThrow(), llvm::Instruction::setMetadata(), llvm::AnalysisUsage::setPreservesCFG(), llvm::CallInst::setTailCall(), llvm::SmallPtrSetImplBase::size(), llvm::TinyPtrVector< EltTy >::size(), llvm::objcarc::StoreWeak, llvm::Value::use_empty(), Users, and llvm::Value::users().
|
static |
Look for an ``autorelease'' instruction dependent on Arg such that there are no instructions dependent on Arg that need a positive ref count in between the autorelease and the ret.
Definition at line 2067 of file ObjCARCOpts.cpp.
References llvm::AreStatisticsEnabled(), llvm::objcarc::Autorelease, llvm::objcarc::AutoreleaseRV, llvm::BasicBlock::back(), llvm::SmallPtrSetImpl< PtrType >::begin(), llvm::SmallPtrSetImplBase::clear(), llvm::objcarc::CopyWeak, llvm::dbgs(), llvm::objcarc::DestroyWeak, llvm::dyn_cast(), E, llvm::objcarc::EnableARCOpts, llvm::objcarc::EraseInstruction(), llvm::objcarc::FindDependencies(), FindPredecessorRetainWithSafePath(), llvm::objcarc::GetArgRCIdentityRoot(), llvm::objcarc::GetBasicARCInstKind(), llvm::Value::getName(), llvm::User::getOperand(), llvm::objcarc::GetRCIdentityRoot(), llvm::Function::getReturnType(), HasSafePathToPredecessorCall(), I, llvm::objcarc::InitWeak, llvm::inst_begin(), llvm::inst_end(), llvm::objcarc::IsAutorelease(), llvm::Type::isPointerTy(), LLVM_DEBUG, llvm::objcarc::LoadWeak, llvm::objcarc::LoadWeakRetained, llvm::objcarc::ModuleHasARC(), llvm::objcarc::MoveWeak, llvm::objcarc::NeedsPositiveRetainCount, llvm::objcarc::Release, llvm::MipsISD::Ret, llvm::objcarc::Retain, llvm::objcarc::RetainBlock, llvm::objcarc::RetainRV, runOnFunction(), llvm::SmallPtrSetImplBase::size(), and llvm::objcarc::StoreWeak.
|
static |
Find a dependent retain that precedes the given autorelease for which there is nothing in between the two instructions that can affect the ref count of Arg.
Definition at line 2042 of file ObjCARCOpts.cpp.
References Arg, llvm::SmallPtrSetImpl< PtrType >::begin(), llvm::objcarc::CanChangeRetainCount, llvm::objcarc::FindDependencies(), llvm::objcarc::GetArgRCIdentityRoot(), llvm::objcarc::GetBasicARCInstKind(), llvm::objcarc::IsRetain(), llvm::objcarc::Retain, and llvm::SmallPtrSetImplBase::size().
Referenced by FindPredecessorAutoreleaseWithSafePath().
|
static |
Check if there is a dependent call earlier that does not have anything in between the Retain and the call that can affect the reference count of their shared pointer argument.
Note that Retain need not be in BB.
Definition at line 2018 of file ObjCARCOpts.cpp.
References llvm::objcarc::Call, llvm::objcarc::CallOrUser, llvm::objcarc::CanChangeRetainCount, llvm::objcarc::FindDependencies(), llvm::objcarc::GetBasicARCInstKind(), llvm::Instruction::getParent(), and llvm::objcarc::Retain.
Referenced by FindPredecessorAutoreleaseWithSafePath().
INITIALIZE_PASS_BEGIN | ( | ObjCARCOpt | , |
"objc-arc" | , | ||
"ObjC ARC optimization" | , | ||
false | , | ||
false | |||
) |
raw_ostream & llvm::operator<< | ( | raw_ostream & | OS, |
BBState & | BBState | ||
) |
Definition at line 422 of file ObjCARCOpts.cpp.
References Arg, llvm::objcarc::AutoreleaseRV, llvm::dbgs(), E, F(), llvm::objcarc::PtrState::GetSeq(), llvm::objcarc::PtrState::HasKnownPositiveRefCount(), I, llvm::objcarc::PtrState::IsCFGHazardAfflicted(), llvm::objcarc::PtrState::IsKnownSafe(), llvm::objcarc::PtrState::IsTrackingImpreciseReleases(), LLVM_DEBUG, P, llvm::objcarc::Retain, llvm::objcarc::RetainRV, and runOnFunction().
STATISTIC | ( | NumAutoreleases | , |
"Number of autoreleases converted to releases" | |||
) |
STATISTIC | ( | NumRets | , |
"Number of return value forwarding " "retain+autoreleases eliminated" | |||
) |
STATISTIC | ( | NumRRs | , |
"Number of retain+release paths eliminated" | |||
) |
STATISTIC | ( | NumPeeps | , |
"Number of calls peephole-optimized" | |||
) |
STATISTIC | ( | NumRetainsBeforeOpt | , |
"Number of retains before optimization" | |||
) |
STATISTIC | ( | NumReleasesBeforeOpt | , |
"Number of releases before optimization" | |||
) |
STATISTIC | ( | NumRetainsAfterOpt | , |
"Number of retains after optimization" | |||
) |
STATISTIC | ( | NumReleasesAfterOpt | , |
"Number of releases after optimization" | |||
) |
objc arc |
Definition at line 562 of file ObjCARCOpts.cpp.
objc ObjC ARC false |
Definition at line 562 of file ObjCARCOpts.cpp.
|
static |
Definition at line 547 of file ObjCARCOpts.cpp.
objc ObjC ARC optimization |
Definition at line 562 of file ObjCARCOpts.cpp.
Definition at line 204 of file ObjCARCOpts.cpp.