LLVM API Documentation
#include "ObjCARC.h"
#include "ARCRuntimeEntryPoints.h"
#include "DependencyAnalysis.h"
#include "ObjCARCAliasAnalysis.h"
#include "ProvenanceAnalysis.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/CommandLine.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "objc-arc-opts" |
#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) |
Enumerations | |
enum | Sequence |
A sequence of states that a pointer may go through in which an objc_retain and objc_release are actually needed. More... | |
Functions | |
static const Value * | FindSingleUseIdentifiedObject (const Value *Arg) |
This is similar to StripPointerCastsAndObjCCalls but it stops as soon as it finds a value with multiple uses. More... | |
static bool | AreAnyUnderlyingObjectsAnAlloca (const Value *V) |
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) |
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 |
This file defines ObjC ARC optimizations. ARC stands for Automatic Reference Counting and is a system for managing reference counts for objects in Objective C.
The optimizations performed include elimination of redundant, partially redundant, and inconsequential reference count operations, elimination of redundant weak pointer operations, and numerous minor simplifications.
WARNING: This file knows about certain library functions. It recognizes them by name, and hardwires knowledge of their semantics.
WARNING: This file knows about how certain Objective-C library functions are used. Naive LLVM IR transformations which would otherwise be behavior-preserving may break these assumptions.
Definition in file ObjCARCOpts.cpp.
Definition at line 27 of file ObjCARCOpts.cpp.
enum Sequence |
A sequence of states that a pointer may go through in which an objc_retain and objc_release are actually needed.
Definition at line 279 of file ObjCARCOpts.cpp.