22 #ifndef LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H 23 #define LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H 57 M.
getNamedValue(
"llvm.objc.unsafeClaimAutoreleasedReturnValue") ||
83 V = cast<CallInst>(V)->getArgOperand(0);
93 if (
auto InCache = Cache.
lookup(V))
97 Cache[V] =
const_cast<Value *
>(Computed);
121 V = cast<CallInst>(V)->getArgOperand(0);
142 return isa<ConstantPointerNull>(V) || isa<UndefValue>(V);
146 return isa<BitCastInst>(
I) ||
147 (isa<GetElementPtrInst>(I) &&
148 cast<GetElementPtrInst>(
I)->hasAllZeroIndices());
155 if (isa<Constant>(Op) || isa<AllocaInst>(Op))
159 if (
Arg->hasByValAttr() ||
160 Arg->hasInAllocaAttr() ||
161 Arg->hasNestAttr() ||
162 Arg->hasStructRetAttr())
188 if (
const LoadInst *LI = dyn_cast<LoadInst>(Op))
216 if (isa<CallInst>(V) || isa<InvokeInst>(V) ||
217 isa<Argument>(V) || isa<Constant>(V) ||
221 if (
const LoadInst *LI = dyn_cast<LoadInst>(V)) {
222 const Value *Pointer =
224 if (
const GlobalVariable *GV = dyn_cast<GlobalVariable>(Pointer)) {
227 if (GV->isConstant())
232 if (Name.
startswith(
"\01l_objc_msgSend_fixup_"))
278 if (!ImpreciseReleaseMDKind)
279 ImpreciseReleaseMDKind =
281 return *ImpreciseReleaseMDKind;
283 if (!CopyOnEscapeMDKind)
286 return *CopyOnEscapeMDKind;
288 if (!NoObjCARCExceptionsMDKind)
289 NoObjCARCExceptionsMDKind =
291 return *NoObjCARCExceptionsMDKind;
A parsed version of the target data layout string in and methods for querying it. ...
This class represents an incoming formal argument to a Function.
This class represents lattice values for constants.
could call objc_release and/or "use" pointers
A Module instance is used to store all the information related to an LLVM module. ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Value * GetArgRCIdentityRoot(Value *Inst)
Assuming the given instruction is one of the special calls such as objc_retain or objc_release...
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.
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
LLVMContext & getContext() const
Get the global data context.
A Use represents the edge between a Value definition and its users.
bool IsNullOrUndef(const Value *V)
Type * getType() const
All values are typed, get the type of this value.
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.
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type. ...
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.
Class to represent pointers.
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 ...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
LLVM_NODISCARD size_t find(char C, size_t From=0) const
Search for the first character C in the string.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
A cache of MDKinds used by various ARC optimizations.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
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.
const Value * GetUnderlyingObjCPtrCached(const Value *V, const DataLayout &DL, DenseMap< const Value *, WeakTrackingVH > &Cache)
A wrapper for GetUnderlyingObjCPtr used for results memoization.
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...
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
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.
bool IsNoopInstruction(const Instruction *I)