LLVM  8.0.1
Public Member Functions | Protected Member Functions | Friends | List of all members
llvm::PtrUseVisitor< DerivedT > Class Template Reference

A base class for visitors over the uses of a pointer value. More...

#include "llvm/Analysis/PtrUseVisitor.h"

Inheritance diagram for llvm::PtrUseVisitor< DerivedT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::PtrUseVisitor< DerivedT >:
Collaboration graph
[legend]

Public Member Functions

 PtrUseVisitor (const DataLayout &DL)
 
PtrInfo visitPtr (Instruction &I)
 Recursively visit the uses of the given pointer. More...
 

Protected Member Functions

void visitStoreInst (StoreInst &SI)
 
void visitBitCastInst (BitCastInst &BC)
 
void visitPtrToIntInst (PtrToIntInst &I)
 
void visitGetElementPtrInst (GetElementPtrInst &GEPI)
 
void visitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
 
void visitMemIntrinsic (MemIntrinsic &I)
 
void visitIntrinsicInst (IntrinsicInst &II)
 
void visitCallSite (CallSite CS)
 
- Protected Member Functions inherited from llvm::InstVisitor< DerivedT >
void visit (Iterator Start, Iterator End)
 
void visit (Module &M)
 
void visit (Function &F)
 
void visit (BasicBlock &BB)
 
void visit (Module *M)
 
void visit (Function *F)
 
void visit (BasicBlock *BB)
 
void visit (Instruction *I)
 
void visit (Instruction &I)
 
void visitModule (Module &M)
 
void visitFunction (Function &F)
 
void visitBasicBlock (BasicBlock &BB)
 
void visitICmpInst (ICmpInst &I)
 
void visitFCmpInst (FCmpInst &I)
 
void visitAllocaInst (AllocaInst &I)
 
void visitLoadInst (LoadInst &I)
 
void visitStoreInst (StoreInst &I)
 
void visitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
 
void visitAtomicRMWInst (AtomicRMWInst &I)
 
void visitFenceInst (FenceInst &I)
 
void visitGetElementPtrInst (GetElementPtrInst &I)
 
void visitPHINode (PHINode &I)
 
void visitTruncInst (TruncInst &I)
 
void visitZExtInst (ZExtInst &I)
 
void visitSExtInst (SExtInst &I)
 
void visitFPTruncInst (FPTruncInst &I)
 
void visitFPExtInst (FPExtInst &I)
 
void visitFPToUIInst (FPToUIInst &I)
 
void visitFPToSIInst (FPToSIInst &I)
 
void visitUIToFPInst (UIToFPInst &I)
 
void visitSIToFPInst (SIToFPInst &I)
 
void visitPtrToIntInst (PtrToIntInst &I)
 
void visitIntToPtrInst (IntToPtrInst &I)
 
void visitBitCastInst (BitCastInst &I)
 
void visitAddrSpaceCastInst (AddrSpaceCastInst &I)
 
void visitSelectInst (SelectInst &I)
 
void visitVAArgInst (VAArgInst &I)
 
void visitExtractElementInst (ExtractElementInst &I)
 
void visitInsertElementInst (InsertElementInst &I)
 
void visitShuffleVectorInst (ShuffleVectorInst &I)
 
void visitExtractValueInst (ExtractValueInst &I)
 
void visitInsertValueInst (InsertValueInst &I)
 
void visitLandingPadInst (LandingPadInst &I)
 
void visitFuncletPadInst (FuncletPadInst &I)
 
void visitCleanupPadInst (CleanupPadInst &I)
 
void visitCatchPadInst (CatchPadInst &I)
 
void visitDbgDeclareInst (DbgDeclareInst &I)
 
void visitDbgValueInst (DbgValueInst &I)
 
void visitDbgVariableIntrinsic (DbgVariableIntrinsic &I)
 
void visitDbgLabelInst (DbgLabelInst &I)
 
void visitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
 
void visitMemSetInst (MemSetInst &I)
 
void visitMemCpyInst (MemCpyInst &I)
 
void visitMemMoveInst (MemMoveInst &I)
 
void visitMemTransferInst (MemTransferInst &I)
 
void visitMemIntrinsic (MemIntrinsic &I)
 
void visitVAStartInst (VAStartInst &I)
 
void visitVAEndInst (VAEndInst &I)
 
void visitVACopyInst (VACopyInst &I)
 
void visitIntrinsicInst (IntrinsicInst &I)
 
void visitCallInst (CallInst &I)
 
void visitInvokeInst (InvokeInst &I)
 
void visitReturnInst (ReturnInst &I)
 
void visitBranchInst (BranchInst &I)
 
void visitSwitchInst (SwitchInst &I)
 
void visitIndirectBrInst (IndirectBrInst &I)
 
void visitResumeInst (ResumeInst &I)
 
void visitUnreachableInst (UnreachableInst &I)
 
void visitCleanupReturnInst (CleanupReturnInst &I)
 
void visitCatchReturnInst (CatchReturnInst &I)
 
void visitCatchSwitchInst (CatchSwitchInst &I)
 
void visitTerminator (Instruction &I)
 
void visitCastInst (CastInst &I)
 
void visitUnaryOperator (UnaryOperator &I)
 
void visitBinaryOperator (BinaryOperator &I)
 
void visitCmpInst (CmpInst &I)
 
void visitUnaryInstruction (UnaryInstruction &I)
 
void visitCallBase (CallBase &I)
 
void visitCallSite (CallSite CS)
 
void visitInstruction (Instruction &I)
 
- Protected Member Functions inherited from llvm::detail::PtrUseVisitorBase
 PtrUseVisitorBase (const DataLayout &DL)
 Note that the constructor is protected because this class must be a base class, we can't create instances directly of this class. More...
 
void enqueueUsers (Instruction &I)
 Enqueue the users of this instruction in the visit worklist. More...
 
bool adjustOffsetForGEP (GetElementPtrInst &GEPI)
 Walk the operands of a GEP and adjust the offset as appropriate. More...
 

Friends

class InstVisitor< DerivedT >
 

Additional Inherited Members

- Protected Attributes inherited from llvm::detail::PtrUseVisitorBase
const DataLayoutDL
 
PtrInfo PI
 The info collected about the pointer being visited thus far. More...
 
SmallVector< UseToVisit, 8 > Worklist
 The worklist of to-visit uses. More...
 
SmallPtrSet< Use *, 8 > VisitedUses
 A set of visited uses to break cycles in unreachable code. More...
 
UseU
 The use currently being visited. More...
 
bool IsOffsetKnown
 True if we have a known constant offset for the use currently being visited. More...
 
APInt Offset
 The constant offset of the use if that is known. More...
 

Detailed Description

template<typename DerivedT>
class llvm::PtrUseVisitor< DerivedT >

A base class for visitors over the uses of a pointer value.

Once constructed, a user can call visit on a pointer value, and this will walk its uses and visit each instruction using an InstVisitor. It also provides visit methods which will recurse through any pointer-to-pointer transformations such as GEPs and bitcasts.

During the visit, the current Use* being visited is available to the subclass, as well as the current offset from the original base pointer if known.

The recursive visit of uses is accomplished with a worklist, so the only ordering guarantee is that an instruction is visited before any uses of it are visited. Note that this does not mean before any of its users are visited! This is because users can be visited multiple times due to multiple, different uses of pointers derived from the same base.

A particular Use will only be visited once, but a User may be visited multiple times, once per Use. This visits may notably have different offsets.

All visit methods on the underlying InstVisitor return a boolean. This return short-circuits the visit, stopping it immediately.

FIXME: Generalize this for all values rather than just instructions.

Definition at line 207 of file PtrUseVisitor.h.

Constructor & Destructor Documentation

◆ PtrUseVisitor()

template<typename DerivedT>
llvm::PtrUseVisitor< DerivedT >::PtrUseVisitor ( const DataLayout DL)
inline

Definition at line 214 of file PtrUseVisitor.h.

Member Function Documentation

◆ visitBitCastInst()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitBitCastInst ( BitCastInst BC)
inlineprotected

Definition at line 256 of file PtrUseVisitor.h.

◆ visitCallSite()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitCallSite ( CallSite  CS)
inlineprotected

Definition at line 295 of file PtrUseVisitor.h.

◆ visitDbgInfoIntrinsic()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitDbgInfoIntrinsic ( DbgInfoIntrinsic I)
inlineprotected

Definition at line 280 of file PtrUseVisitor.h.

◆ visitGetElementPtrInst()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitGetElementPtrInst ( GetElementPtrInst GEPI)
inlineprotected

Definition at line 264 of file PtrUseVisitor.h.

◆ visitIntrinsicInst()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitIntrinsicInst ( IntrinsicInst II)
inlineprotected

Definition at line 282 of file PtrUseVisitor.h.

◆ visitMemIntrinsic()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitMemIntrinsic ( MemIntrinsic I)
inlineprotected

Definition at line 281 of file PtrUseVisitor.h.

◆ visitPtr()

template<typename DerivedT>
PtrInfo llvm::PtrUseVisitor< DerivedT >::visitPtr ( Instruction I)
inline

Recursively visit the uses of the given pointer.

Returns
An info struct about the pointer. See PtrInfo for details.

Definition at line 221 of file PtrUseVisitor.h.

Referenced by AllocaSlices::SliceBuilder::SliceBuilder().

◆ visitPtrToIntInst()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitPtrToIntInst ( PtrToIntInst I)
inlineprotected

Definition at line 260 of file PtrUseVisitor.h.

◆ visitStoreInst()

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitStoreInst ( StoreInst SI)
inlineprotected

Definition at line 251 of file PtrUseVisitor.h.

Friends And Related Function Documentation

◆ InstVisitor< DerivedT >

template<typename DerivedT>
friend class InstVisitor< DerivedT >
friend

Definition at line 209 of file PtrUseVisitor.h.


The documentation for this class was generated from the following file: