LLVM 22.0.0git
ObjCARCContract.cpp File Reference

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

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, AAResults *AA)
static InstructionfindRetainForStoreStrongContraction (Value *New, StoreInst *Store, Instruction *Release, ProvenanceAnalysis &PA)
static bool useClaimRuntimeCall (Module &M)
 Should we use objc_claimAutoreleasedReturnValue?
 INITIALIZE_PASS_BEGIN (ObjCARCContractLegacyPass, "objc-arc-contract", "ObjC ARC contraction", false, false) INITIALIZE_PASS_END(ObjCARCContractLegacyPass

Variables

static cl::opt< cl::boolOrDefaultUseObjCClaimRV ("arc-contract-use-objc-claim-rv", cl::desc("Enable generation of calls to objc_claimAutoreleasedReturnValue"))
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 51 of file ObjCARCContract.cpp.

Function Documentation

◆ findRetainForStoreStrongContraction()

◆ findSafeStoreForStoreStrongContraction()

◆ INITIALIZE_PASS_BEGIN()

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

◆ STATISTIC() [1/2]

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

◆ STATISTIC() [2/2]

STATISTIC ( NumStoreStrongs ,
"Number objc_storeStrong calls formed"  )

◆ useClaimRuntimeCall()

bool useClaimRuntimeCall ( Module & M)
static

Variable Documentation

◆ contract

objc arc contract

Definition at line 754 of file ObjCARCContract.cpp.

◆ contraction

objc arc ObjC ARC contraction

Definition at line 755 of file ObjCARCContract.cpp.

◆ false

objc arc ObjC ARC false

Definition at line 755 of file ObjCARCContract.cpp.

◆ UseObjCClaimRV

cl::opt< cl::boolOrDefault > UseObjCClaimRV("arc-contract-use-objc-claim-rv", cl::desc( "Enable generation of calls to objc_claimAutoreleasedReturnValue")) ( "arc-contract-use-objc-claim-rv" ,
cl::desc( "Enable generation of calls to objc_claimAutoreleasedReturnValue")  )
static

Referenced by useClaimRuntimeCall().