23 #ifndef LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H 24 #define LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H 58 M.
getNamedValue(
"llvm.objc.unsafeClaimAutoreleasedReturnValue") ||
84 V = cast<CallInst>(V)->getArgOperand(0);
94 if (
auto InCache = Cache.
lookup(V))
98 Cache[V] =
const_cast<Value *
>(Computed);
122 V = cast<CallInst>(V)->getArgOperand(0);
143 return isa<ConstantPointerNull>(V) || isa<UndefValue>(V);
147 return isa<BitCastInst>(
I) ||
148 (isa<GetElementPtrInst>(I) &&
149 cast<GetElementPtrInst>(
I)->hasAllZeroIndices());
156 if (isa<Constant>(Op) || isa<AllocaInst>(Op))
160 if (
Arg->hasByValAttr() ||
161 Arg->hasInAllocaAttr() ||
162 Arg->hasNestAttr() ||
163 Arg->hasStructRetAttr())
189 if (
const LoadInst *LI = dyn_cast<LoadInst>(Op))
217 if (isa<CallInst>(V) || isa<InvokeInst>(V) ||
218 isa<Argument>(V) || isa<Constant>(V) ||
222 if (
const LoadInst *LI = dyn_cast<LoadInst>(V)) {
223 const Value *Pointer =
225 if (
const GlobalVariable *GV = dyn_cast<GlobalVariable>(Pointer)) {
228 if (GV->isConstant())
233 if (Name.
startswith(
"\01l_objc_msgSend_fixup_"))
279 if (!ImpreciseReleaseMDKind)
280 ImpreciseReleaseMDKind =
282 return *ImpreciseReleaseMDKind;
284 if (!CopyOnEscapeMDKind)
287 return *CopyOnEscapeMDKind;
289 if (!NoObjCARCExceptionsMDKind)
290 NoObjCARCExceptionsMDKind =
292 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. ...
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.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
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.
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...
A cache of MDKinds used by various ARC optimizations.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
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.
amdgpu Simplify well known AMD library false Value Value * Arg
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.
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.
bool IsNoopInstruction(const Instruction *I)