LLVM 20.0.0git
|
A base class for visitors over the uses of a pointer value. More...
#include "llvm/Analysis/PtrUseVisitor.h"
Public Member Functions | |
PtrUseVisitor (const DataLayout &DL) | |
PtrInfo | visitPtr (Value &I) |
Recursively visit the uses of the given pointer. | |
Friends | |
class | InstVisitor< DerivedT > |
Additional Inherited Members | |
Protected Attributes inherited from llvm::detail::PtrUseVisitorBase | |
const DataLayout & | DL |
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. | |
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. | |
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 208 of file PtrUseVisitor.h.
|
inline |
Definition at line 215 of file PtrUseVisitor.h.
|
inlineprotected |
Definition at line 264 of file PtrUseVisitor.h.
References llvm::detail::PtrUseVisitorBase::enqueueUsers().
|
inlineprotected |
Definition at line 260 of file PtrUseVisitor.h.
References llvm::detail::PtrUseVisitorBase::enqueueUsers().
|
inlineprotected |
Definition at line 309 of file PtrUseVisitor.h.
References llvm::detail::PtrUseVisitorBase::PI, llvm::detail::PtrUseVisitorBase::PtrInfo::setEscaped(), and llvm::InstVisitor< DerivedT >::visitCallBase().
|
inlineprotected |
Definition at line 288 of file PtrUseVisitor.h.
|
inlineprotected |
|
inlineprotected |
Definition at line 290 of file PtrUseVisitor.h.
References II, llvm::detail::PtrUseVisitorBase::PI, llvm::detail::PtrUseVisitorBase::PtrInfo::setEscaped(), and llvm::InstVisitor< DerivedT >::visitIntrinsicInst().
|
inlineprotected |
Definition at line 289 of file PtrUseVisitor.h.
|
inline |
Recursively visit the uses of the given pointer.
PtrInfo
for details. We may also need to process Argument pointers, so the input uses is a common Value type. Definition at line 224 of file PtrUseVisitor.h.
References assert(), llvm::detail::PtrUseVisitorBase::DL, llvm::detail::PtrUseVisitorBase::enqueueUsers(), llvm::IntegerType::getBitWidth(), llvm::DataLayout::getIndexType(), llvm::PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info >::getInt(), llvm::PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info >::getPointer(), I, llvm::detail::PtrUseVisitorBase::PtrInfo::isAborted(), llvm::detail::PtrUseVisitorBase::IsOffsetKnown, llvm::detail::PtrUseVisitorBase::UseToVisit::Offset, llvm::detail::PtrUseVisitorBase::Offset, llvm::detail::PtrUseVisitorBase::PI, llvm::detail::PtrUseVisitorBase::PtrInfo::reset(), llvm::detail::PtrUseVisitorBase::U, llvm::detail::PtrUseVisitorBase::UseToVisit::UseAndIsOffsetKnown, llvm::InstVisitor< DerivedT >::visit(), and llvm::detail::PtrUseVisitorBase::Worklist.
|
inlineprotected |
Definition at line 268 of file PtrUseVisitor.h.
References I, llvm::detail::PtrUseVisitorBase::PI, and llvm::detail::PtrUseVisitorBase::PtrInfo::setEscaped().
|
inlineprotected |
Definition at line 255 of file PtrUseVisitor.h.
References llvm::detail::PtrUseVisitorBase::PI, llvm::detail::PtrUseVisitorBase::PtrInfo::setEscaped(), SI(), and llvm::detail::PtrUseVisitorBase::U.
|
friend |
Definition at line 136 of file PtrUseVisitor.h.