LLVM  8.0.1
Classes | Protected Member Functions | Protected Attributes | List of all members
llvm::detail::PtrUseVisitorBase Class Reference

Implementation of non-dependent functionality for PtrUseVisitor. More...

#include "llvm/Analysis/PtrUseVisitor.h"

Inheritance diagram for llvm::detail::PtrUseVisitorBase:
Inheritance graph
[legend]
Collaboration diagram for llvm::detail::PtrUseVisitorBase:
Collaboration graph
[legend]

Classes

class  PtrInfo
 This class provides information about the result of a visit. More...
 
struct  UseToVisit
 A struct of the data needed to visit a particular use. More...
 

Protected Member Functions

 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...
 

Protected Attributes

const DataLayoutDL
 
Visitation infrastructure
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...
 
Per-visit state

This state is reset for each instruction visited.

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

Implementation of non-dependent functionality for PtrUseVisitor.

See PtrUseVisitor for the public interface and detailed comments about usage. This class is just a helper base class which is not templated and contains all common code to be shared between different instantiations of PtrUseVisitor.

Definition at line 56 of file PtrUseVisitor.h.

Constructor & Destructor Documentation

◆ PtrUseVisitorBase()

llvm::detail::PtrUseVisitorBase::PtrUseVisitorBase ( const DataLayout DL)
inlineprotected

Note that the constructor is protected because this class must be a base class, we can't create instances directly of this class.

Definition at line 164 of file PtrUseVisitor.h.

References adjustOffsetForGEP(), enqueueUsers(), and I.

Member Function Documentation

◆ adjustOffsetForGEP()

bool detail::PtrUseVisitorBase::adjustOffsetForGEP ( GetElementPtrInst GEPI)
protected

Walk the operands of a GEP and adjust the offset as appropriate.

This routine does the heavy lifting of the pointer walk by computing offsets and looking through GEPs.

Definition at line 34 of file PtrUseVisitor.cpp.

References llvm::GetElementPtrInst::accumulateConstantOffset(), DL, IsOffsetKnown, and Offset.

Referenced by PtrUseVisitorBase(), and llvm::PtrUseVisitor< SliceBuilder >::visitGetElementPtrInst().

◆ enqueueUsers()

void detail::PtrUseVisitorBase::enqueueUsers ( Instruction I)
protected

Enqueue the users of this instruction in the visit worklist.

This will visit the users with the same offset of the current visit (including an unknown offset if that is the current state).

Definition at line 22 of file PtrUseVisitor.cpp.

References IsOffsetKnown, Offset, U, llvm::Value::uses(), VisitedUses, and Worklist.

Referenced by PtrUseVisitorBase(), llvm::PtrUseVisitor< SliceBuilder >::visitBitCastInst(), llvm::PtrUseVisitor< SliceBuilder >::visitGetElementPtrInst(), and llvm::PtrUseVisitor< SliceBuilder >::visitPtr().

Member Data Documentation

◆ DL

const DataLayout& llvm::detail::PtrUseVisitorBase::DL
protected

◆ IsOffsetKnown

bool llvm::detail::PtrUseVisitorBase::IsOffsetKnown
protected

True if we have a known constant offset for the use currently being visited.

Definition at line 155 of file PtrUseVisitor.h.

Referenced by adjustOffsetForGEP(), enqueueUsers(), llvm::PtrUseVisitor< SliceBuilder >::visitGetElementPtrInst(), and llvm::PtrUseVisitor< SliceBuilder >::visitPtr().

◆ Offset

APInt llvm::detail::PtrUseVisitorBase::Offset
protected

◆ PI

PtrInfo llvm::detail::PtrUseVisitorBase::PI
protected

◆ U

Use* llvm::detail::PtrUseVisitorBase::U
protected

The use currently being visited.

Definition at line 151 of file PtrUseVisitor.h.

Referenced by enqueueUsers(), llvm::PtrUseVisitor< SliceBuilder >::visitPtr(), and llvm::PtrUseVisitor< SliceBuilder >::visitStoreInst().

◆ VisitedUses

SmallPtrSet<Use *, 8> llvm::detail::PtrUseVisitorBase::VisitedUses
protected

A set of visited uses to break cycles in unreachable code.

Definition at line 142 of file PtrUseVisitor.h.

Referenced by enqueueUsers().

◆ Worklist

SmallVector<UseToVisit, 8> llvm::detail::PtrUseVisitorBase::Worklist
protected

The worklist of to-visit uses.

Definition at line 139 of file PtrUseVisitor.h.

Referenced by enqueueUsers(), and llvm::PtrUseVisitor< SliceBuilder >::visitPtr().


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