22 #ifndef LLVM_ANALYSIS_PTRUSEVISITOR_H
23 #define LLVM_ANALYSIS_PTRUSEVISITOR_H
192 template <
typename DerivedT>
225 static_cast<DerivedT*
>(
this)->
visit(I);
269 case Intrinsic::lifetime_start:
270 case Intrinsic::lifetime_end:
Value * getValueOperand()
A parsed version of the target data layout string in and methods for querying it. ...
bool isEscaped() const
Is the pointer escaped at some point?
void setEscaped(Instruction *I=nullptr)
Mark the pointer as escaped.
void visitCallSite(CallSite CS)
Base class for instruction visitors.
void visitCallSite(CallSite CS)
void visitMemIntrinsic(MemIntrinsic &I)
Use * U
The use currently being visited.
SmallPtrSet< Use *, 8 > VisitedUses
A set of visited uses to break cycles in unreachable code.
InstrTy * getInstruction() const
Intrinsic::ID getIntrinsicID() const
getIntrinsicID - Return the intrinsic ID of this intrinsic.
Implementation of non-dependent functionality for PtrUseVisitor.
Instruction * getAbortingInst() const
Get the instruction causing the visit to abort.
This class provides information about the result of a visit.
PtrUseVisitor(const DataLayout &DL)
void visitBitCastInst(BitCastInst &BC)
void visitIntrinsicInst(IntrinsicInst &I)
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.
void visitStoreInst(StoreInst &SI)
void setPointer(PointerTy PtrVal)
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.
void visit(Iterator Start, Iterator End)
A base class for visitors over the uses of a pointer value.
SmallVector< UseToVisit, 8 > Worklist
The worklist of to-visit uses.
void setAborted(Instruction *I=nullptr)
Mark the visit as aborted.
This class represents a no-op cast from one type to another.
StoreInst - an instruction for storing to memory.
void visitDbgInfoIntrinsic(DbgInfoIntrinsic &I)
void setInt(IntType IntVal)
GetElementPtrInst - an instruction for type-safe pointer arithmetic to access elements of arrays and ...
void enqueueUsers(Instruction &I)
Enqueue the users of this instruction in the visit worklist.
Class to represent integer types.
bool isPointerTy() const
isPointerTy - True if this is an instance of PointerType.
PtrInfo PI
The info collected about the pointer being visited thus far.
bool adjustOffsetForGEP(GetElementPtrInst &GEPI)
Walk the operands of a GEP and adjust the offset as appropriate.
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...
PointerTy getPointer() const
MemIntrinsic - 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...
Type * getType() const
All values are typed, get the type of this value.
DbgInfoIntrinsic - 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)
PointerIntPair< Use *, 1, bool > UseAndIsOffsetKnownPair
Instruction * getEscapingInst() const
Get the instruction causing the pointer to escape.
Class for arbitrary precision integers.
void visitIntrinsicInst(IntrinsicInst &II)
void visitPtrToIntInst(PtrToIntInst &I)
UseAndIsOffsetKnownPair UseAndIsOffsetKnown
void reset()
Reset the pointer info, clearing all state.
APInt Offset
The constant offset of the use if that is known.
PtrInfo visitPtr(Instruction &I)
Recursively visit the uses of the given pointer.
bool isAborted() const
Did we abort the visit early?
IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic functions.