LLVM: llvm::PtrUseVisitor< DerivedT > Class Template Reference (original) (raw)

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