llvm::def_chain_iterator

Forward iterator over the defining-access chain of a MemoryDef or MemoryUse.

Synopsis

Declared in <llvm/Analysis/MemorySSA.h>

template<
    class T,
    bool UseOptimizedChain = false>
struct def_chain_iterator
    : iterator_facade_base<def_chain_iterator<T, UseOptimizedChain>, std::forward_iterator_tag, MemoryAccess*>

Description

Stops after we hit something that has no defining use (e.g. a MemoryPhi or liveOnEntry). Note that, when comparing against a null def_chain_iterator, this will compare equal only after walking said Phi/liveOnEntry.

The UseOptimizedChain flag specifies whether to walk the clobbering access chain, or all the accesses.

Normally, MemoryDef are all just def/use linked together, so a def_chain on a MemoryDef will walk all MemoryDefs above it in the program until it hits a phi node. The optimized chain walks the clobbering access of a store. So if you are just trying to find, given a store, what the next thing that would clobber the same memory is, you want the optimized chain.

Base Classes

NameDescription
iterator_facade_base<def_chain_iterator<T, UseOptimizedChain>, std::forward_iterator_tag, MemoryAccess*>CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of the interface.

Type Aliases

NameDescription
difference_type Signed type used to express the distance between iterators.
iterator_category Iterator category tag for this facade.
pointer Pointer type returned by the iterator.
reference Reference type returned by the iterator.
value_type Value type produced by the iterator.

Enums

NameDescription
Unnamed enum Capability flags for the iterator category.

Member Functions

NameDescription
def_chain_iterator [constructor]Constructors
operator* Return the current memory access in the chain.
operator+ Advance the iterator by n and return the result.
operator++ Increment operators
operator- Retreat the iterator by n and return the result.
operator-- Decrement operators
operator-> Return a proxy pointer to the current element.
operator[] Return a proxy to the element at offset n.
operator== Return true if this iterator refers to the same access as O.
operator<= Return true if this iterator is less than or equal to RHS.
operator> Return true if this iterator is greater than RHS.
operator>= Return true if this iterator is greater than or equal to RHS.

Protected Types

NameDescription
PointerProxy Proxy that yields a pointer from a copied reference.
ReferenceProxy Proxy that yields a reference from a copied iterator.

Non-Member Functions

NameDescription
def_chainReturn a range walking defining accesses from MA up to UpTo.
optimized_def_chainReturn a range walking the optimized clobbering-access chain from MA.