LLVM 20.0.0git
|
Implementation of non-dependent functionality for PtrUseVisitor
.
More...
#include "llvm/Analysis/PtrUseVisitor.h"
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. | |
void | enqueueUsers (Instruction &I) |
Enqueue the users of this instruction in the visit worklist. | |
bool | adjustOffsetForGEP (GetElementPtrInst &GEPI) |
Walk the operands of a GEP and adjust the offset as appropriate. | |
Protected Attributes | |
const DataLayout & | DL |
Visitation infrastructure | |
PtrInfo | PI |
The info collected about the pointer being visited thus far. | |
SmallVector< UseToVisit, 8 > | Worklist |
The worklist of to-visit uses. | |
SmallPtrSet< Use *, 8 > | VisitedUses |
A set of visited uses to break cycles in unreachable code. | |
Per-visit state | |
This state is reset for each instruction visited. | |
Use * | U |
The use currently being visited. | |
bool | IsOffsetKnown |
True if we have a known constant offset for the use currently being visited. | |
APInt | Offset |
The constant offset of the use if that is known. | |
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 46 of file PtrUseVisitor.h.
|
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 154 of file PtrUseVisitor.h.
|
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 32 of file PtrUseVisitor.cpp.
References llvm::GetElementPtrInst::accumulateConstantOffset(), DL, llvm::Value::getType(), llvm::Offset, and llvm::APInt::sextOrTrunc().
Referenced by llvm::PtrUseVisitor< DerivedT >::visitGetElementPtrInst().
|
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 20 of file PtrUseVisitor.cpp.
References I, and llvm::Offset.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitAddrSpaceCastInst(), llvm::PtrUseVisitor< DerivedT >::visitBitCastInst(), llvm::PtrUseVisitor< DerivedT >::visitGetElementPtrInst(), and llvm::PtrUseVisitor< DerivedT >::visitPtr().
|
protected |
Definition at line 109 of file PtrUseVisitor.h.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitPtr().
|
protected |
True if we have a known constant offset for the use currently being visited.
Definition at line 145 of file PtrUseVisitor.h.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitGetElementPtrInst(), and llvm::PtrUseVisitor< DerivedT >::visitPtr().
|
protected |
The constant offset of the use if that is known.
Definition at line 148 of file PtrUseVisitor.h.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitGetElementPtrInst(), and llvm::PtrUseVisitor< DerivedT >::visitPtr().
|
protected |
The info collected about the pointer being visited thus far.
Definition at line 115 of file PtrUseVisitor.h.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitCallBase(), llvm::PtrUseVisitor< DerivedT >::visitPtr(), llvm::PtrUseVisitor< DerivedT >::visitPtrToIntInst(), and llvm::PtrUseVisitor< DerivedT >::visitStoreInst().
|
protected |
The use currently being visited.
Definition at line 141 of file PtrUseVisitor.h.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitPtr(), and llvm::PtrUseVisitor< DerivedT >::visitStoreInst().
|
protected |
A set of visited uses to break cycles in unreachable code.
Definition at line 132 of file PtrUseVisitor.h.
|
protected |
The worklist of to-visit uses.
Definition at line 129 of file PtrUseVisitor.h.
Referenced by llvm::PtrUseVisitor< DerivedT >::visitPtr().