LLVM API Documentation

Public Member Functions | Protected Member Functions | Friends
llvm::PtrUseVisitor< DerivedT > Class Template Reference

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

#include <PtrUseVisitor.h>

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

List of all members.

Public Member Functions

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

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)

Friends

class InstVisitor< DerivedT >

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 193 of file PtrUseVisitor.h.


Constructor & Destructor Documentation

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

Definition at line 199 of file PtrUseVisitor.h.


Member Function Documentation

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitBitCastInst ( BitCastInst BC) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 238 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitCallSite ( CallSite  CS) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 277 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitDbgInfoIntrinsic ( DbgInfoIntrinsic I) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 262 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitGetElementPtrInst ( GetElementPtrInst GEPI) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 246 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitIntrinsicInst ( IntrinsicInst II) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 264 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitMemIntrinsic ( MemIntrinsic I) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 263 of file PtrUseVisitor.h.

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 203 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitPtrToIntInst ( PtrToIntInst I) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 242 of file PtrUseVisitor.h.

template<typename DerivedT>
void llvm::PtrUseVisitor< DerivedT >::visitStoreInst ( StoreInst SI) [inline, protected]

Reimplemented from llvm::InstVisitor< DerivedT >.

Definition at line 233 of file PtrUseVisitor.h.


Friends And Related Function Documentation

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

Definition at line 195 of file PtrUseVisitor.h.


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