23 #ifndef LLVM_ANALYSIS_PTRUSEVISITOR_H 24 #define LLVM_ANALYSIS_PTRUSEVISITOR_H 44 #include <type_traits> 206 template <
typename DerivedT>
215 static_assert(std::is_base_of<PtrUseVisitor, DerivedT>::value,
216 "Must pass the derived type to this template!");
243 static_cast<DerivedT*
>(
this)->visit(I);
285 return Base::visitIntrinsicInst(II);
297 Base::visitCallSite(CS);
303 #endif // LLVM_ANALYSIS_PTRUSEVISITOR_H Value * getValueOperand()
A parsed version of the target data layout string in and methods for querying it. ...
void setEscaped(Instruction *I=nullptr)
Mark the pointer as escaped.
void setInt(IntType IntVal)
Base class for instruction visitors.
void visitCallSite(CallSite CS)
void visitMemIntrinsic(MemIntrinsic &I)
This class represents lattice values for constants.
PointerTy getPointer() const
Use * U
The use currently being visited.
SmallPtrSet< Use *, 8 > VisitedUses
A set of visited uses to break cycles in unreachable code.
Implementation of non-dependent functionality for PtrUseVisitor.
This class provides information about the result of a visit.
Instruction * getAbortingInst() const
Get the instruction causing the visit to abort.
PtrUseVisitor(const DataLayout &DL)
This defines the Use class.
void visitBitCastInst(BitCastInst &BC)
void setPointer(PointerTy PtrVal)
bool IsOffsetKnown
True if we have a known constant offset for the use currently being visited.
A Use represents the edge between a Value definition and its users.
bool isAborted() const
Did we abort the visit early?
InstrTy * getInstruction() const
void visitStoreInst(StoreInst &SI)
PtrUseVisitorBase(const DataLayout &DL)
Note that the constructor is protected because this class must be a base class, we can't create insta...
This file implements a class to represent arbitrary precision integral constant values and operations...
This class represents a cast from a pointer to an integer.
A struct of the data needed to visit a particular use.
A base class for visitors over the uses of a pointer value.
SmallVector< UseToVisit, 8 > Worklist
The worklist of to-visit uses.
Type * getType() const
All values are typed, get the type of this value.
void setAborted(Instruction *I=nullptr)
Mark the visit as aborted.
This class represents a no-op cast from one type to another.
An instruction for storing to memory.
void visitDbgInfoIntrinsic(DbgInfoIntrinsic &I)
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
void enqueueUsers(Instruction &I)
Enqueue the users of this instruction in the visit worklist.
bool isPointerTy() const
True if this is an instance of PointerType.
Class to represent integer types.
PtrInfo PI
The info collected about the pointer being visited thus far.
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
bool adjustOffsetForGEP(GetElementPtrInst &GEPI)
Walk the operands of a GEP and adjust the offset as appropriate.
This is the common base class for memset/memcpy/memmove.
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...
This is the common base class for debug info intrinsics.
void setEscapedAndAborted(Instruction *I=nullptr)
Mark the pointer as escaped, and the visit as aborted.
void visitGetElementPtrInst(GetElementPtrInst &GEPI)
Class for arbitrary precision integers.
void visitIntrinsicInst(IntrinsicInst &II)
void visitPtrToIntInst(PtrToIntInst &I)
UseAndIsOffsetKnownPair UseAndIsOffsetKnown
Instruction * getEscapingInst() const
Get the instruction causing the pointer to escape.
void reset()
Reset the pointer info, clearing all state.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
APInt Offset
The constant offset of the use if that is known.
PtrInfo visitPtr(Instruction &I)
Recursively visit the uses of the given pointer.
A wrapper class for inspecting calls to intrinsic functions.
bool isEscaped() const
Is the pointer escaped at some point?