22#ifndef LLVM_ANALYSIS_PTRUSEVISITOR_H
23#define LLVM_ANALYSIS_PTRUSEVISITOR_H
60 AbortedInfo.setPointer(
nullptr);
61 AbortedInfo.setInt(
false);
62 EscapedInfo.setPointer(
nullptr);
63 EscapedInfo.setInt(
false);
67 bool isAborted()
const {
return AbortedInfo.getInt(); }
70 bool isEscaped()
const {
return EscapedInfo.getInt(); }
85 AbortedInfo.setInt(
true);
86 AbortedInfo.setPointer(
I);
92 EscapedInfo.setInt(
true);
93 EscapedInfo.setPointer(
I);
197template <
typename DerivedT>
206 static_assert(std::is_base_of<PtrUseVisitor, DerivedT>::value,
207 "Must pass the derived type to this template!");
216 assert(
I.getType()->isPointerTy());
234 static_cast<DerivedT*
>(
this)->
visit(
I);
243 if (
SI.getValueOperand() ==
U->get())
278 switch (
II.getIntrinsicID()) {
282 case Intrinsic::lifetime_start:
283 case Intrinsic::lifetime_end:
This file implements a class to represent arbitrary precision integral constant values and operations...
uint64_t IntrinsicInst * II
StandardInstrumentations SI(Mod->getContext(), Debug, VerifyEach)
This file defines the PointerIntPair class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
Class for arbitrary precision integers.
This class represents a conversion between pointers from one address space to another.
This class represents a no-op cast from one type to another.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
A parsed version of the target data layout string in and methods for querying it.
IntegerType * getIndexType(LLVMContext &C, unsigned AddressSpace) const
Returns the type of a GEP index in AddressSpace.
This is the common base class for debug info intrinsics.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Base class for instruction visitors.
void visitCallBase(CallBase &I)
void visitIntrinsicInst(IntrinsicInst &I)
void visit(Iterator Start, Iterator End)
Class to represent integer types.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
A wrapper class for inspecting calls to intrinsic functions.
This is the common base class for memset/memcpy/memmove.
PointerIntPair - This class implements a pair of a pointer and small integer.
PointerTy getPointer() const
This class represents a cast from a pointer to an integer.
A base class for visitors over the uses of a pointer value.
void visitCallBase(CallBase &CB)
void visitDbgInfoIntrinsic(DbgInfoIntrinsic &I)
PtrInfo visitPtr(Instruction &I)
Recursively visit the uses of the given pointer.
PtrUseVisitor(const DataLayout &DL)
void visitGetElementPtrInst(GetElementPtrInst &GEPI)
void visitAddrSpaceCastInst(AddrSpaceCastInst &ASC)
void visitBitCastInst(BitCastInst &BC)
void visitStoreInst(StoreInst &SI)
void visitIntrinsicInst(IntrinsicInst &II)
void visitPtrToIntInst(PtrToIntInst &I)
void visitMemIntrinsic(MemIntrinsic &I)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
A Use represents the edge between a Value definition and its users.
This class provides information about the result of a visit.
void setEscaped(Instruction *I=nullptr)
Mark the pointer as escaped.
Instruction * getAbortingInst() const
Get the instruction causing the visit to abort.
Instruction * getEscapingInst() const
Get the instruction causing the pointer to escape.
bool isEscaped() const
Is the pointer escaped at some point?
void reset()
Reset the pointer info, clearing all state.
bool isAborted() const
Did we abort the visit early?
void setEscapedAndAborted(Instruction *I=nullptr)
Mark the pointer as escaped, and the visit as aborted.
void setAborted(Instruction *I=nullptr)
Mark the visit as aborted.
Implementation of non-dependent functionality for PtrUseVisitor.
APInt Offset
The constant offset of the use if that is known.
PtrUseVisitorBase(const DataLayout &DL)
Note that the constructor is protected because this class must be a base class, we can't create insta...
void enqueueUsers(Instruction &I)
Enqueue the users of this instruction in the visit worklist.
SmallVector< UseToVisit, 8 > Worklist
The worklist of to-visit uses.
bool IsOffsetKnown
True if we have a known constant offset for the use currently being visited.
bool adjustOffsetForGEP(GetElementPtrInst &GEPI)
Walk the operands of a GEP and adjust the offset as appropriate.
PtrInfo PI
The info collected about the pointer being visited thus far.
Use * U
The use currently being visited.
SmallPtrSet< Use *, 8 > VisitedUses
A set of visited uses to break cycles in unreachable code.
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
A struct of the data needed to visit a particular use.
UseAndIsOffsetKnownPair UseAndIsOffsetKnown