LLVM  9.0.0svn
Macros | Functions | Variables
ObjCARCContract.cpp File Reference

This file defines late ObjC ARC optimizations. More...

#include "ARCRuntimeEntryPoints.h"
#include "DependencyAnalysis.h"
#include "ObjCARC.h"
#include "ProvenanceAnalysis.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
Include dependency graph for ObjCARCContract.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "objc-arc-contract"
 

Functions

 STATISTIC (NumPeeps, "Number of calls peephole-optimized")
 
 STATISTIC (NumStoreStrongs, "Number objc_storeStrong calls formed")
 
static StoreInstfindSafeStoreForStoreStrongContraction (LoadInst *Load, Instruction *Release, ProvenanceAnalysis &PA, AliasAnalysis *AA)
 
static InstructionfindRetainForStoreStrongContraction (Value *New, StoreInst *Store, Instruction *Release, ProvenanceAnalysis &PA)
 
static CallInstcreateCallInst (FunctionType *FTy, Value *Func, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore, const DenseMap< BasicBlock *, ColorVector > &BlockColors)
 Create a call instruction with the correct funclet token. More...
 
static CallInstcreateCallInst (FunctionCallee Func, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore, const DenseMap< BasicBlock *, ColorVector > &BlockColors)
 
 INITIALIZE_PASS_BEGIN (ObjCARCContract, "objc-arc-contract", "ObjC ARC contraction", false, false) INITIALIZE_PASS_END(ObjCARCContract
 

Variables

static cl::opt< unsignedMaxBBSize ("arc-contract-max-bb-size", cl::Hidden, cl::desc("Maximum basic block size to discover the dominance relation of " "two instructions in the same basic block"), cl::init(65535))
 
objc arc contract
 
objc arc ObjC ARC contraction
 
objc arc ObjC ARC false
 

Detailed Description

This file defines late ObjC ARC optimizations.

ARC stands for Automatic Reference Counting and is a system for managing reference counts for objects in Objective C.

This specific file mainly deals with ``contracting'' multiple lower level operations into singular higher level operations through pattern matching.

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 ObjCARCContract.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "objc-arc-contract"

Definition at line 43 of file ObjCARCContract.cpp.

Function Documentation

◆ createCallInst() [1/2]

static CallInst* createCallInst ( FunctionType FTy,
Value Func,
ArrayRef< Value *>  Args,
const Twine NameStr,
Instruction InsertBefore,
const DenseMap< BasicBlock *, ColorVector > &  BlockColors 
)
static

◆ createCallInst() [2/2]

static CallInst* createCallInst ( FunctionCallee  Func,
ArrayRef< Value *>  Args,
const Twine NameStr,
Instruction InsertBefore,
const DenseMap< BasicBlock *, ColorVector > &  BlockColors 
)
static

Definition at line 336 of file ObjCARCContract.cpp.

References Arg, llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::objcarc::Autorelease, llvm::objcarc::AutoreleaseRV, B, llvm::BasicBlock::back(), llvm::BasicBlock::begin(), C, llvm::Function::callsFunctionThatReturnsTwice(), llvm::objcarc::ClaimRV, llvm::classifyEHPersonality(), llvm::colorEHFunclets(), createCallInst(), llvm::dbgs(), llvm::dyn_cast(), E, llvm::SmallVectorBase::empty(), llvm::objcarc::EnableARCOpts, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::Instruction::eraseFromParent(), llvm::objcarc::EraseInstruction(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), findRetainForStoreStrongContraction(), findSafeStoreForStoreStrongContraction(), llvm::objcarc::FusedRetainAutorelease, llvm::objcarc::FusedRetainAutoreleaseRV, llvm::InlineAsm::get(), llvm::Use::get(), llvm::FunctionType::get(), llvm::ConstantPointerNull::get(), llvm::CallBase::getArgOperand(), llvm::objcarc::GetArgRCIdentityRoot(), llvm::objcarc::GetBasicARCInstKind(), llvm::FunctionCallee::getCallee(), llvm::Value::getContext(), llvm::Instruction::getDebugLoc(), llvm::objcarc::getEquivalentPHIs(), llvm::BasicBlock::getFirstNonPHI(), llvm::FunctionCallee::getFunctionType(), llvm::PHINode::getIncomingValueNumForOperand(), llvm::Type::getInt8Ty(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Use::getOperandNo(), llvm::PHINode::getOperandNumForIncomingValue(), llvm::Instruction::getParent(), getParent(), llvm::Function::getPersonalityFn(), llvm::getPointerOperand(), llvm::objcarc::GetRCIdentityRoot(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::getTerminator(), getType(), llvm::Value::getType(), llvm::PointerType::getUnqual(), llvm::Use::getUser(), llvm::StoreInst::getValueOperand(), llvm::Type::getVoidTy(), llvm::Function::hasPersonalityFn(), INITIALIZE_PASS_BEGIN(), INITIALIZE_PASS_DEPENDENCY, llvm::objcarc::InitWeak, llvm::inst_begin(), llvm::inst_end(), llvm::objcarc::IntrinsicUser, llvm::objcarc::IsNoopInstruction(), llvm::objcarc::IsNullOrUndef(), llvm::isScopedEHPersonality(), llvm::Function::isVarArg(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm::SPII::Load, MaxBBSize, llvm::objcarc::None, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::objcarc::Release, llvm::Value::replaceAllUsesWith(), llvm::objcarc::Retain, llvm::objcarc::RetainRV, runOnFunction(), llvm::Use::set(), llvm::Instruction::setDebugLoc(), llvm::CallBase::setDoesNotThrow(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::SPII::Store, llvm::objcarc::StoreStrong, llvm::Value::use_begin(), llvm::Value::use_end(), llvm::objcarc::User, and llvm::Value::users().

◆ findRetainForStoreStrongContraction()

static Instruction* findRetainForStoreStrongContraction ( Value New,
StoreInst Store,
Instruction Release,
ProvenanceAnalysis PA 
)
static

◆ findSafeStoreForStoreStrongContraction()

static StoreInst* findSafeStoreForStoreStrongContraction ( LoadInst Load,
Instruction Release,
ProvenanceAnalysis PA,
AliasAnalysis AA 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( ObjCARCContract  ,
"objc-arc-contract ,
"ObjC ARC contraction ,
false  ,
false   
)

Referenced by createCallInst().

◆ STATISTIC() [1/2]

STATISTIC ( NumPeeps  ,
"Number of calls peephole-optimized"   
)

◆ STATISTIC() [2/2]

STATISTIC ( NumStoreStrongs  ,
"Number objc_storeStrong calls formed"   
)

Variable Documentation

◆ contract

objc arc contract

Definition at line 758 of file ObjCARCContract.cpp.

◆ contraction

objc arc ObjC ARC contraction

Definition at line 758 of file ObjCARCContract.cpp.

◆ false

objc arc ObjC ARC false

Definition at line 758 of file ObjCARCContract.cpp.

◆ MaxBBSize

cl::opt<unsigned> MaxBBSize("arc-contract-max-bb-size", cl::Hidden, cl::desc("Maximum basic block size to discover the dominance relation of " "two instructions in the same basic block"), cl::init(65535))
static

Referenced by createCallInst().