LLVM API Documentation
Macros | |
#define | ARC_ANNOTATIONS |
#define | ANNOTATE_BOTTOMUP(inst, ptr, old, new) |
#define | ANNOTATE_TOPDOWN(inst, ptr, old, new) |
#define | ANNOTATE_BB(_states, _bb, _name, _type, _direction) |
#define | ANNOTATE_BOTTOMUP_BBSTART(_states, _basicblock) |
#define | ANNOTATE_BOTTOMUP_BBEND(_states, _basicblock) |
#define | ANNOTATE_TOPDOWN_BBSTART(_states, _basicblock) |
#define | ANNOTATE_TOPDOWN_BBEND(_states, _basicblock) |
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") | |
static Sequence | MergeSeqs (Sequence A, Sequence B, bool TopDown) |
static MDString * | AppendMDNodeToSourcePtr (unsigned NodeId, Value *Ptr) |
static std::string | SequenceToString (Sequence A) |
static MDString * | SequenceToMDString (LLVMContext &Context, Sequence A) |
static void | AppendMDNodeToInstForPtr (unsigned NodeId, Instruction *Inst, Value *Ptr, MDString *PtrSourceMDNodeID, Sequence OldSeq, Sequence NewSeq) |
static void | GenerateARCBBEntranceAnnotation (const char *Name, BasicBlock *BB, Value *Ptr, Sequence Seq) |
static void | GenerateARCBBTerminatorAnnotation (const char *Name, BasicBlock *BB, Value *Ptr, Sequence Seq) |
static void | GenerateARCAnnotation (unsigned InstMDId, unsigned PtrMDId, Instruction *Inst, Value *Ptr, Sequence OldSeq, Sequence NewSeq) |
INITIALIZE_PASS_BEGIN (ObjCARCOpt,"objc-arc","ObjC ARC optimization", false, false) INITIALIZE_PASS_END(ObjCARCOpt | |
static void | CheckForUseCFGHazard (const Sequence SuccSSeq, const bool SuccSRRIKnownSafe, PtrState &S, bool &SomeSuccHasSame, bool &AllSuccsHaveSame, bool &NotAllSeqEqualButKnownSafe, bool &ShouldContinue) |
static void | CheckForCanReleaseCFGHazard (const Sequence SuccSSeq, const bool SuccSRRIKnownSafe, PtrState &S, bool &SomeSuccHasSame, bool &AllSuccsHaveSame, bool &NotAllSeqEqualButKnownSafe) |
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, SmallPtrSet< Instruction *, 4 > &DepInsts, SmallPtrSet< const BasicBlock *, 4 > &Visited, ProvenanceAnalysis &PA) |
static CallInst * | FindPredecessorRetainWithSafePath (const Value *Arg, BasicBlock *BB, Instruction *Autorelease, SmallPtrSet< Instruction *, 4 > &DepInsts, SmallPtrSet< const BasicBlock *, 4 > &Visited, ProvenanceAnalysis &PA) |
static CallInst * | FindPredecessorAutoreleaseWithSafePath (const Value *Arg, BasicBlock *BB, ReturnInst *Ret, SmallPtrSet< Instruction *, 4 > &DepInsts, SmallPtrSet< const BasicBlock *, 4 > &V, ProvenanceAnalysis &PA) |
Pass * | llvm::createObjCARCOptPass () |
Variables | |
static cl::opt< bool > | EnableARCAnnotations ("enable-objc-arc-annotations", cl::init(false), cl::desc("Enable emission of arc data flow analysis ""annotations")) |
Enable/disable ARC sequence annotations. More... | |
static cl::opt< bool > | DisableCheckForCFGHazards ("disable-objc-arc-checkforcfghazards", cl::init(false), cl::desc("Disable check for cfg hazards when ""annotating")) |
static cl::opt< std::string > | ARCAnnotationTargetIdentifier ("objc-arc-annotation-target-identifier", cl::init(""), cl::desc("filter out all data flow annotations ""but those that apply to the given ""target llvm identifier.")) |
objc | arc |
objc ObjC ARC | optimization |
objc ObjC ARC | false |
static char | ObjCARCOpt::ID = 0 |
#define ANNOTATE_BB | ( | _states, | |
_bb, | |||
_name, | |||
_type, | |||
_direction | |||
) |
Definition at line 1036 of file ObjCARCOpts.cpp.
#define ANNOTATE_BOTTOMUP | ( | inst, | |
ptr, | |||
old, | |||
new | |||
) |
Use this macro to annotate a sequence state change when processing instructions bottom up,
Definition at line 1025 of file ObjCARCOpts.cpp.
#define ANNOTATE_BOTTOMUP_BBEND | ( | _states, | |
_basicblock | |||
) |
Definition at line 1051 of file ObjCARCOpts.cpp.
#define ANNOTATE_BOTTOMUP_BBSTART | ( | _states, | |
_basicblock | |||
) |
Definition at line 1048 of file ObjCARCOpts.cpp.
#define ANNOTATE_TOPDOWN | ( | inst, | |
ptr, | |||
old, | |||
new | |||
) |
Use this macro to annotate a sequence state change when processing instructions top down.
Definition at line 1031 of file ObjCARCOpts.cpp.
#define ANNOTATE_TOPDOWN_BBEND | ( | _states, | |
_basicblock | |||
) |
Definition at line 1057 of file ObjCARCOpts.cpp.
#define ANNOTATE_TOPDOWN_BBSTART | ( | _states, | |
_basicblock | |||
) |
Definition at line 1054 of file ObjCARCOpts.cpp.
#define ARC_ANNOTATIONS |
Definition at line 793 of file ObjCARCOpts.cpp.
|
static |
A simple function to generate a MDNode which describes the change in state for Value *Ptr caused by Instruction *Inst.
Definition at line 880 of file ObjCARCOpts.cpp.
References llvm::MDNode::get(), llvm::Value::getContext(), SequenceToMDString(), and llvm::Instruction::setMetadata().
Referenced by GenerateARCAnnotation().
This function appends a unique ARCAnnotationProvenanceSourceMDKind id to an instruction so that we can track backwards when post processing via the llvm arc annotation processor tool. If the function is an
Definition at line 822 of file ObjCARCOpts.cpp.
References llvm::MDString::get(), llvm::MDNode::get(), llvm::Value::getContext(), llvm::Value::getName(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), and llvm::raw_string_ostream::str().
Referenced by GenerateARCAnnotation().
|
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 1597 of file ObjCARCOpts.cpp.
References llvm_unreachable.
|
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 1559 of file ObjCARCOpts.cpp.
References llvm_unreachable.
|
static |
The visited set, for doing DFS walks.
Definition at line 2177 of file ObjCARCOpts.cpp.
References llvm::SmallVectorTemplateCommon< T >::back(), llvm::BasicBlock::back(), llvm::Function::begin(), llvm::SmallPtrSetImpl::clear(), llvm::SmallPtrSet< PtrType, SmallSize >::count(), llvm::SmallVectorBase::empty(), llvm::Function::end(), llvm::SmallPtrSet< PtrType, SmallSize >::erase(), llvm::Function::getEntryBlock(), I, llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::pop_back(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::pred_begin(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Definition at line 1186 of file ObjCARCOpts.cpp.
|
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 2913 of file ObjCARCOpts.cpp.
References llvm::SmallPtrSet< PtrType, SmallSize >::begin(), llvm::objcarc::FindDependencies(), llvm::objcarc::GetBasicInstructionClass(), llvm::objcarc::GetObjCArg(), llvm::objcarc::IsAutorelease(), llvm::objcarc::NeedsPositiveRetainCount, and llvm::SmallPtrSetImpl::size().
|
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 2886 of file ObjCARCOpts.cpp.
References llvm::SmallPtrSet< PtrType, SmallSize >::begin(), llvm::objcarc::CanChangeRetainCount, llvm::objcarc::FindDependencies(), llvm::objcarc::GetBasicInstructionClass(), llvm::objcarc::GetObjCArg(), llvm::objcarc::IsRetain(), and llvm::SmallPtrSetImpl::size().
|
static |
Adds a source annotation to pointer and a state change annotation to Inst referencing the source annotation and the old/new state of pointer.
Definition at line 985 of file ObjCARCOpts.cpp.
References AppendMDNodeToInstForPtr(), AppendMDNodeToSourcePtr(), ARCAnnotationTargetIdentifier, EnableARCAnnotations, llvm::StringRef::equals(), and llvm::Value::getName().
|
static |
Add to the beginning of the basic block llvm.ptr.annotations which show the state of a pointer at the entrance to a basic block.
Definition at line 900 of file ObjCARCOpts.cpp.
References ARCAnnotationTargetIdentifier, llvm::CallingConv::C, llvm::StringRef::equals(), llvm::FunctionType::get(), llvm::Module::getContext(), llvm::BasicBlock::getFirstInsertionPt(), llvm::Module::getGlobalVariable(), llvm::Type::getInt8Ty(), llvm::Value::getName(), llvm::Module::getOrInsertFunction(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::PointerType::getUnqual(), llvm::Type::getVoidTy(), llvm::GlobalValue::InternalLinkage, and SequenceToString().
|
static |
Add to the end of the basic block llvm.ptr.annotations which show the state of the pointer at the bottom of the basic block.
Definition at line 943 of file ObjCARCOpts.cpp.
References ARCAnnotationTargetIdentifier, llvm::CallingConv::C, llvm::IRBuilder< preserveNames, T, Inserter >::CreateCall2(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateGlobalStringPtr(), llvm::BasicBlock::end(), llvm::StringRef::equals(), llvm::FunctionType::get(), llvm::Module::getContext(), llvm::Module::getGlobalVariable(), llvm::Type::getInt8Ty(), llvm::Value::getName(), llvm::Module::getOrInsertFunction(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::PointerType::getUnqual(), llvm::Type::getVoidTy(), llvm::GlobalValue::InternalLinkage, llvm::prior(), and SequenceToString().
|
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 2858 of file ObjCARCOpts.cpp.
References llvm::objcarc::CanChangeRetainCount, llvm::objcarc::FindDependencies(), llvm::objcarc::GetBasicInstructionClass(), llvm::Instruction::getParent(), llvm::objcarc::IC_Call, and llvm::objcarc::IC_CallOrUser.
INITIALIZE_PASS_BEGIN | ( | ObjCARCOpt | , |
"objc-arc" | , | ||
"ObjC ARC optimization" | , | ||
false | , | ||
false | |||
) |
Definition at line 312 of file ObjCARCOpts.cpp.
References llvm::ARM_PROC::A, and std::swap().
|
static |
Helper function to change a Sequence into a String object using our overload for raw_ostream so we only have printing code in one location.
Definition at line 873 of file ObjCARCOpts.cpp.
References llvm::MDString::get(), and SequenceToString().
Referenced by AppendMDNodeToInstForPtr().
|
static |
Definition at line 864 of file ObjCARCOpts.cpp.
References llvm::ARM_PROC::A, and llvm::raw_string_ostream::str().
Referenced by GenerateARCBBEntranceAnnotation(), GenerateARCBBTerminatorAnnotation(), and SequenceToMDString().
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" | |||
) |
objc arc |
Definition at line 1184 of file ObjCARCOpts.cpp.
|
static |
Referenced by GenerateARCAnnotation(), GenerateARCBBEntranceAnnotation(), and GenerateARCBBTerminatorAnnotation().
|
static |
|
static |
Enable/disable ARC sequence annotations.
Referenced by GenerateARCAnnotation().
objc ObjC ARC false |
Definition at line 1184 of file ObjCARCOpts.cpp.
|
static |
Definition at line 1172 of file ObjCARCOpts.cpp.
objc ObjC ARC optimization |
Definition at line 1184 of file ObjCARCOpts.cpp.