23 #ifndef LLVM_LIB_TRANSFORMS_OBJCARC_OBJCARC_H
24 #define LLVM_LIB_TRANSFORMS_OBJCARC_OBJCARC_H
82 V = cast<CallInst>(V)->getArgOperand(0);
108 V = cast<CallInst>(V)->getArgOperand(0);
129 return isa<ConstantPointerNull>(V) || isa<UndefValue>(V);
133 return isa<BitCastInst>(
I) ||
134 (isa<GetElementPtrInst>(I) &&
135 cast<GetElementPtrInst>(
I)->hasAllZeroIndices());
146 Value *OldArg = cast<CallInst>(CI)->getArgOperand(0);
154 isa<ConstantPointerNull>(OldArg))) &&
155 "Can't delete non-forwarding instruction with users!");
169 if (isa<Constant>(Op) || isa<AllocaInst>(Op))
172 if (
const Argument *Arg = dyn_cast<Argument>(Op))
173 if (Arg->hasByValAttr() ||
174 Arg->hasInAllocaAttr() ||
175 Arg->hasNestAttr() ||
176 Arg->hasStructRetAttr())
202 if (
const LoadInst *LI = dyn_cast<LoadInst>(Op))
230 if (isa<CallInst>(V) || isa<InvokeInst>(V) ||
231 isa<Argument>(V) || isa<Constant>(V) ||
235 if (
const LoadInst *LI = dyn_cast<LoadInst>(V)) {
236 const Value *Pointer =
238 if (
const GlobalVariable *GV = dyn_cast<GlobalVariable>(Pointer)) {
241 if (GV->isConstant())
246 if (Name.
startswith(
"\01l_objc_msgSend_fixup_"))
292 if (!ImpreciseReleaseMDKind)
293 ImpreciseReleaseMDKind =
295 return *ImpreciseReleaseMDKind;
297 if (!CopyOnEscapeMDKind)
300 return *CopyOnEscapeMDKind;
302 if (!NoObjCARCExceptionsMDKind)
303 NoObjCARCExceptionsMDKind =
305 return *NoObjCARCExceptionsMDKind;
iplist< Instruction >::iterator eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing basic block and deletes it...
A parsed version of the target data layout string in and methods for querying it. ...
LLVM Argument representation.
could call objc_release and/or "use" pointers
A Module instance is used to store all the information related to an LLVM module. ...
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static ARCInstKind GetBasicARCInstKind(const Value *V)
Determine which objc runtime call instruction class V belongs to.
LoadInst - an instruction for reading from memory.
bool IsNoopOnNull(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a null pointer...
bool IsForwarding(ARCInstKind Class)
Test if the given class represents instructions which return their argument verbatim.
static ARCInstKind GetCallSiteClass(ImmutableCallSite CS)
Helper for GetARCInstKind.
virtual bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
pointsToConstantMemory - If the specified memory location is known to be constant, return true.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
A Use represents the edge between a Value definition and its users.
bool EnableARCOpts
A handy option to enable/disable all ARC Optimizations.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
PointerType - Class to represent pointers.
static bool IsNoopInstruction(const Instruction *I)
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
static bool IsObjCIdentifiedObject(const Value *V)
Return true if this value refers to a distinct and identifiable object.
A cache of MDKinds used by various ARC optimizations.
static const Value * GetUnderlyingObjCPtr(const Value *V, const DataLayout &DL)
This is a wrapper around getUnderlyingObject which also knows how to look through objc_retain and obj...
bool RecursivelyDeleteTriviallyDeadInstructions(Value *V, const TargetLibraryInfo *TLI=nullptr)
RecursivelyDeleteTriviallyDeadInstructions - If the specified value is a trivially dead instruction...
anything that is inert from an ARC perspective.
Value * GetUnderlyingObject(Value *V, const DataLayout &DL, unsigned MaxLookup=6)
GetUnderlyingObject - This method strips off any GEP address adjustments and pointer casts from the s...
static Value * GetArgRCIdentityRoot(Value *Inst)
Assuming the given instruction is one of the special calls such as objc_retain or objc_release...
static void EraseInstruction(Instruction *CI)
Erase the given instruction.
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
static bool IsNullOrUndef(const Value *V)
ARCInstKind
Equivalence classes of instructions in the ARC Model.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
static bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
ImmutableCallSite - establish a view to a call site for examination.
static const Value * GetRCIdentityRoot(const Value *V)
The RCIdentity root of a value V is a dominating value U for which retaining or releasing U is equiva...
LLVM Value Representation.
IterTy arg_begin() const
arg_begin/arg_end - Return iterators corresponding to the actual argument list for a call site...
StringRef - Represent a constant reference to a string, i.e.
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type. ...
static bool ModuleHasARC(const Module &M)
Test if the given module looks interesting to run ARC optimization on.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
LLVMContext & getContext() const
Get the global data context.