MLIR
20.0.0git
|
Class used for convenient access and iteration over GEP indices. More...
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
Classes | |
class | iterator |
Public Types | |
using | value_type = std::conditional_t< std::is_base_of< Attribute, llvm::detail::ValueOfRange< DynamicRange > >::value, Attribute, PointerUnion< IntegerAttr, llvm::detail::ValueOfRange< DynamicRange > >> |
Return type of 'operator[]' and the iterators 'operator*'. More... | |
Public Member Functions | |
GEPIndicesAdaptor (DenseI32ArrayAttr rawConstantIndices, DynamicRange values) | |
Constructs a GEPIndicesAdaptor with the raw constant indices of a GEPOp and the range that is indexed into for retrieving dynamic indices. More... | |
value_type | operator[] (size_t index) const |
Returns the GEP index at the given position. More... | |
bool | isDynamicIndex (size_t index) const |
Returns whether the GEP index at the given position is a dynamic index. More... | |
size_t | size () const |
Returns the amount of indices of the GEPOp. More... | |
bool | empty () const |
Returns true if this GEPOp does not have any indices. More... | |
iterator | begin () const |
Returns the begin iterator, iterating over all GEP indices. More... | |
iterator | end () const |
Returns the end iterator, iterating over all GEP indices. More... | |
Class used for convenient access and iteration over GEP indices.
This class is templated to support not only retrieving the dynamic operands of a GEP operation, but also as an adaptor during folding or conversion to LLVM IR.
GEP indices may either be constant indices or dynamic indices. The 'rawConstantIndices' is specially encoded by GEPOp and contains either the constant index or the information that an index is a dynamic index.
When an access to such an index is made it is done through the 'DynamicRange' of this class. This way it can be used as getter in GEPOp via 'GEPIndicesAdaptor<ValueRange>' or during folding via 'GEPIndicesAdaptor<ArrayRef<Attribute>>'.
Definition at line 114 of file LLVMDialect.h.
using mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::value_type = std::conditional_t< std::is_base_of<Attribute, llvm::detail::ValueOfRange<DynamicRange> >::value, Attribute, PointerUnion<IntegerAttr, llvm::detail::ValueOfRange<DynamicRange> >> |
Return type of 'operator[]' and the iterators 'operator*'.
It is depended upon the value type of 'DynamicRange'. If 'DynamicRange' contains Attributes or subclasses thereof, then value_type is 'Attribute'. In all other cases it is a pointer union between the value type of 'DynamicRange' and IntegerAttr.
Definition at line 121 of file LLVMDialect.h.
|
inline |
Constructs a GEPIndicesAdaptor with the raw constant indices of a GEPOp and the range that is indexed into for retrieving dynamic indices.
Definition at line 129 of file LLVMDialect.h.
|
inline |
Returns the begin iterator, iterating over all GEP indices.
Definition at line 191 of file LLVMDialect.h.
References mlir::detail::DenseArrayAttrImpl< T >::asArrayRef().
Referenced by mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::operator[]().
|
inline |
Returns true if this GEPOp does not have any indices.
Definition at line 151 of file LLVMDialect.h.
|
inline |
Returns the end iterator, iterating over all GEP indices.
Definition at line 197 of file LLVMDialect.h.
References mlir::detail::DenseArrayAttrImpl< T >::asArrayRef().
|
inline |
Returns whether the GEP index at the given position is a dynamic index.
Definition at line 143 of file LLVMDialect.h.
|
inline |
Returns the GEP index at the given position.
Note that this operation has a linear complexity in regards to the accessed position. To iterate over all indices, use the iterators.
This operation is invalid if the index is out of bounds.
Definition at line 137 of file LLVMDialect.h.
References mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::begin(), and mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::size().
|
inline |
Returns the amount of indices of the GEPOp.
Definition at line 148 of file LLVMDialect.h.
Referenced by mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::operator[](), and verifyStructIndices().