23 #ifndef LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H
24 #define LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H
83 V = cast<CallInst>(V)->getArgOperand(0);
109 V = cast<CallInst>(V)->getArgOperand(0);
130 return isa<ConstantPointerNull>(V) || isa<UndefValue>(V);
134 return isa<BitCastInst>(
I) ||
135 (isa<GetElementPtrInst>(I) &&
136 cast<GetElementPtrInst>(
I)->hasAllZeroIndices());
143 if (isa<Constant>(Op) || isa<AllocaInst>(Op))
146 if (
const Argument *Arg = dyn_cast<Argument>(Op))
147 if (Arg->hasByValAttr() ||
148 Arg->hasInAllocaAttr() ||
149 Arg->hasNestAttr() ||
150 Arg->hasStructRetAttr())
176 if (
const LoadInst *LI = dyn_cast<LoadInst>(Op))
204 if (isa<CallInst>(V) || isa<InvokeInst>(V) ||
205 isa<Argument>(V) || isa<Constant>(V) ||
209 if (
const LoadInst *LI = dyn_cast<LoadInst>(V)) {
210 const Value *Pointer =
212 if (
const GlobalVariable *GV = dyn_cast<GlobalVariable>(Pointer)) {
215 if (GV->isConstant())
220 if (Name.
startswith(
"\01l_objc_msgSend_fixup_"))
266 if (!ImpreciseReleaseMDKind)
267 ImpreciseReleaseMDKind =
269 return *ImpreciseReleaseMDKind;
271 if (!CopyOnEscapeMDKind)
274 return *CopyOnEscapeMDKind;
276 if (!NoObjCARCExceptionsMDKind)
277 NoObjCARCExceptionsMDKind =
279 return *NoObjCARCExceptionsMDKind;
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. ...
Value * GetArgRCIdentityRoot(Value *Inst)
Assuming the given instruction is one of the special calls such as objc_retain or objc_release...
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
An instruction for reading from memory.
bool IsForwarding(ARCInstKind Class)
Test if the given class represents instructions which return their argument verbatim.
bool IsObjCIdentifiedObject(const Value *V)
Return true if this value refers to a distinct and identifiable object.
A Use represents the edge between a Value definition and its users.
bool IsNullOrUndef(const Value *V)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
bool EnableARCOpts
A handy option to enable/disable all ARC Optimizations.
bool ModuleHasARC(const Module &M)
Test if the given module looks interesting to run ARC optimization on.
Class to represent pointers.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
Checks whether the given location points to constant memory, or if OrLocal is true whether it points ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
A cache of MDKinds used by various ARC optimizations.
anything that is inert from an ARC perspective.
Value * GetUnderlyingObject(Value *V, const DataLayout &DL, unsigned MaxLookup=6)
This method strips off any GEP address adjustments and pointer casts from the specified value...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ARCInstKind GetBasicARCInstKind(const Value *V)
Determine which objc runtime call instruction class V belongs to.
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.
ImmutableCallSite - establish a view to a call site for examination.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
ARCInstKind GetCallSiteClass(ImmutableCallSite CS)
Helper for GetARCInstKind.
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...
LLVM Value Representation.
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...
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. ...
bool IsNoopInstruction(const Instruction *I)
LLVMContext & getContext() const
Get the global data context.