MLIR  19.0.0git
Static Public Member Functions | List of all members
mlir::SplatElementsAttr Class Reference

An attribute that represents a reference to a splat vector or tensor constant, meaning all of the elements have the same value. More...

#include "mlir/IR/BuiltinAttributes.h"

+ Inheritance diagram for mlir::SplatElementsAttr:

Static Public Member Functions

static bool classof (Attribute attr)
 Method for support type inquiry through isa, cast and dyn_cast. More...
 
- Static Public Member Functions inherited from mlir::DenseElementsAttr
static bool classof (Attribute attr)
 Method for support type inquiry through isa, cast and dyn_cast. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< Attribute > values)
 Constructs a dense elements attribute from an array of element values. More...
 
template<typename T , typename = std::enable_if_t<std::numeric_limits<T>::is_integer || is_valid_cpp_fp_type<T>::value>>
static DenseElementsAttr get (const ShapedType &type, ArrayRef< T > values)
 Constructs a dense integer elements attribute from an array of integer or floating-point values. More...
 
template<typename T , typename = std::enable_if_t<std::numeric_limits<T>::is_integer || is_valid_cpp_fp_type<T>::value || detail::is_complex_t<T>::value>>
static DenseElementsAttr get (const ShapedType &type, T value)
 Constructs a dense integer elements attribute from a single element. More...
 
template<typename T , typename ElementT = typename T::value_type, typename = std::enable_if_t<detail::is_complex_t<T>::value && (std::numeric_limits<ElementT>::is_integer || is_valid_cpp_fp_type<ElementT>::value)>>
static DenseElementsAttr get (const ShapedType &type, ArrayRef< T > values)
 Constructs a dense complex elements attribute from an array of complex values. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< bool > values)
 Overload of the above 'get' method that is specialized for boolean values. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< StringRef > values)
 Overload of the above 'get' method that is specialized for StringRef values. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< APInt > values)
 Constructs a dense integer elements attribute from an array of APInt values. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< std::complex< APInt >> values)
 Constructs a dense complex elements attribute from an array of APInt values. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< APFloat > values)
 Constructs a dense float elements attribute from an array of APFloat values. More...
 
static DenseElementsAttr get (ShapedType type, ArrayRef< std::complex< APFloat >> values)
 Constructs a dense complex elements attribute from an array of APFloat values. More...
 
template<typename T >
static DenseElementsAttr get (const ShapedType &type, const std::initializer_list< T > &list)
 Construct a dense elements attribute for an initializer_list of values. More...
 
static DenseElementsAttr getFromRawBuffer (ShapedType type, ArrayRef< char > rawBuffer)
 Construct a dense elements attribute from a raw buffer representing the data for this attribute. More...
 
static bool isValidRawBuffer (ShapedType type, ArrayRef< char > rawBuffer, bool &detectedSplat)
 Returns true if the given buffer is a valid raw buffer for the given type. More...
 
- Static Public Member Functions inherited from mlir::Attribute
static Attribute getFromOpaquePointer (const void *ptr)
 Construct an attribute from the opaque pointer representation. More...
 

Additional Inherited Members

- Public Types inherited from mlir::DenseElementsAttr
template<typename IteratorT >
using iterator_range_impl = detail::ElementsAttrRange< IteratorT >
 The iterator range over the given iterator type T. More...
 
template<typename T , typename AttrT = DenseElementsAttr>
using iterator = decltype(std::declval< AttrT >().template value_begin< T >())
 The iterator for the given element type T. More...
 
template<typename T , typename AttrT = DenseElementsAttr>
using iterator_range = decltype(std::declval< AttrT >().template getValues< T >())
 The iterator range over the given element T. More...
 
template<typename T >
using IntFloatValueTemplateCheckT = std::enable_if_t<(!std::is_same< T, bool >::value &&std::numeric_limits< T >::is_integer)||is_valid_cpp_fp_type< T >::value >
 Try to get the held element values as a range of integer or floating-point values. More...
 
template<typename T , typename ElementT >
using ComplexValueTemplateCheckT = std::enable_if_t< detail::is_complex_t< T >::value &&(std::numeric_limits< ElementT >::is_integer||is_valid_cpp_fp_type< ElementT >::value)>
 Try to get the held element values as a range of std::complex. More...
 
template<typename T >
using StringRefValueTemplateCheckT = std::enable_if_t< std::is_same< T, StringRef >::value >
 Try to get the held element values as a range of StringRef. More...
 
template<typename T >
using AttributeValueTemplateCheckT = std::enable_if_t< std::is_same< T, Attribute >::value >
 Try to get the held element values as a range of Attributes. More...
 
template<typename T >
using DerivedAttrValueTemplateCheckT = std::enable_if_t< std::is_base_of< Attribute, T >::value &&!std::is_same< Attribute, T >::value >
 Try to get the held element values a range of T, where T is a derived attribute type. More...
 
template<typename T >
using BoolValueTemplateCheckT = std::enable_if_t< std::is_same< T, bool >::value >
 Try to get the held element values as a range of bool. More...
 
template<typename T >
using APIntValueTemplateCheckT = std::enable_if_t< std::is_same< T, APInt >::value >
 Try to get the held element values as a range of APInts. More...
 
template<typename T >
using ComplexAPIntValueTemplateCheckT = std::enable_if_t< std::is_same< T, std::complex< APInt > >::value >
 Try to get the held element values as a range of complex APInts. More...
 
template<typename T >
using APFloatValueTemplateCheckT = std::enable_if_t< std::is_same< T, APFloat >::value >
 Try to get the held element values as a range of APFloat. More...
 
template<typename T >
using ComplexAPFloatValueTemplateCheckT = std::enable_if_t< std::is_same< T, std::complex< APFloat > >::value >
 Try to get the held element values as a range of complex APFloat. More...
 
- Public Types inherited from mlir::Attribute
template<typename ConcreteType , typename BaseType , typename StorageType , template< typename T > class... Traits>
using AttrBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::AttributeUniquer, Traits... >
 Utility class for implementing attributes. More...
 
using ImplType = AttributeStorage
 
using ValueType = void
 
using AbstractTy = AbstractAttribute
 
- Public Member Functions inherited from mlir::DenseElementsAttr
 operator ElementsAttr () const
 Allow implicit conversion to ElementsAttr. More...
 
 operator TypedAttr () const
 Allow implicit conversion to TypedAttr. More...
 
bool isSplat () const
 Returns true if this attribute corresponds to a splat, i.e. More...
 
template<typename T >
std::enable_if_t<!std::is_base_of< Attribute, T >::value||std::is_same< Attribute, T >::value, T > getSplatValue () const
 Return the splat value for this attribute. More...
 
template<typename T >
std::enable_if_t< std::is_base_of< Attribute, T >::value &&!std::is_same< Attribute, T >::value, T > getSplatValue () const
 Return the splat value for derived attribute element types. More...
 
template<typename T >
auto try_value_begin () const
 Try to get an iterator of the given type to the start of the held element values. More...
 
template<typename T >
auto try_value_end () const
 Try to get an iterator of the given type to the end of the held element values. More...
 
template<typename T >
auto getValues () const
 Return the held element values as a range of the given type. More...
 
template<typename T >
auto value_begin () const
 Get an iterator of the given type to the start of the held element values. More...
 
template<typename T >
auto value_end () const
 Get an iterator of the given type to the end of the held element values. More...
 
template<typename T , typename = IntFloatValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< ElementIterator< T > > > tryGetValues () const
 
template<typename T , typename ElementT = typename T::value_type, typename = ComplexValueTemplateCheckT<T, ElementT>>
FailureOr< iterator_range_impl< ElementIterator< T > > > tryGetValues () const
 
template<typename T , typename = StringRefValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< ElementIterator< StringRef > > > tryGetValues () const
 
template<typename T , typename = AttributeValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< AttributeElementIterator > > tryGetValues () const
 
template<typename T , typename = DerivedAttrValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< DerivedAttributeElementIterator< T > > > tryGetValues () const
 
template<typename T , typename = BoolValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< BoolElementIterator > > tryGetValues () const
 
template<typename T , typename = APIntValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< IntElementIterator > > tryGetValues () const
 
template<typename T , typename = ComplexAPIntValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< ComplexIntElementIterator > > tryGetValues () const
 
template<typename T , typename = APFloatValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< FloatElementIterator > > tryGetValues () const
 
template<typename T , typename = ComplexAPFloatValueTemplateCheckT<T>>
FailureOr< iterator_range_impl< ComplexFloatElementIterator > > tryGetValues () const
 
ArrayRef< char > getRawData () const
 Return the raw storage data held by this attribute. More...
 
ArrayRef< StringRef > getRawStringData () const
 Return the raw StringRef data held by this attribute. More...
 
ShapedType getType () const
 Return the type of this ElementsAttr, guaranteed to be a vector or tensor with static shape. More...
 
Type getElementType () const
 Return the element type of this DenseElementsAttr. More...
 
int64_t getNumElements () const
 Returns the number of elements held by this attribute. More...
 
int64_t size () const
 Returns the number of elements held by this attribute. More...
 
bool empty () const
 Returns if the number of elements held by this attribute is 0. More...
 
DenseElementsAttr reshape (ShapedType newType)
 Return a new DenseElementsAttr that has the same data as the current attribute, but has been reshaped to 'newType'. More...
 
DenseElementsAttr resizeSplat (ShapedType newType)
 Return a new DenseElementsAttr that has the same data as the current attribute, but with a different shape for a splat type. More...
 
DenseElementsAttr bitcast (Type newElType)
 Return a new DenseElementsAttr that has the same data as the current attribute, but has bitcast elements to 'newElType'. More...
 
DenseElementsAttr mapValues (Type newElementType, function_ref< APInt(const APInt &)> mapping) const
 Generates a new DenseElementsAttr by mapping each int value to a new underlying APInt. More...
 
DenseElementsAttr mapValues (Type newElementType, function_ref< APInt(const APFloat &)> mapping) const
 Generates a new DenseElementsAttr by mapping each float value to a new underlying APInt. More...
 
constexpr Attribute ()=default
 
 Attribute (const ImplType *impl)
 
 Attribute (const Attribute &other)=default
 
- Public Member Functions inherited from mlir::Attribute
constexpr Attribute ()=default
 
 Attribute (const ImplType *impl)
 
 Attribute (const Attribute &other)=default
 
Attributeoperator= (const Attribute &other)=default
 
bool operator== (Attribute other) const
 
bool operator!= (Attribute other) const
 
 operator bool () const
 
bool operator! () const
 
template<typename... Tys>
bool isa () const
 Casting utility functions. More...
 
template<typename... Tys>
bool isa_and_nonnull () const
 
template<typename U >
dyn_cast () const
 
template<typename U >
dyn_cast_or_null () const
 
template<typename U >
cast () const
 
TypeID getTypeID ()
 Return a unique identifier for the concrete attribute type. More...
 
MLIRContextgetContext () const
 Return the context this attribute belongs to. More...
 
DialectgetDialect () const
 Get the dialect this attribute is registered to. More...
 
void print (raw_ostream &os, bool elideType=false) const
 Print the attribute. More...
 
void print (raw_ostream &os, AsmState &state, bool elideType=false) const
 
void dump () const
 
void printStripped (raw_ostream &os) const
 Print the attribute without dialect wrapping. More...
 
void printStripped (raw_ostream &os, AsmState &state) const
 
const void * getAsOpaquePointer () const
 Get an opaque pointer to the attribute. More...
 
template<typename InterfaceT >
bool hasPromiseOrImplementsInterface ()
 Returns true if InterfaceT has been promised by the dialect or implemented. More...
 
template<template< typename T > class Trait>
bool hasTrait ()
 Returns true if the type was registered with a particular trait. More...
 
const AbstractTygetAbstractAttribute () const
 Return the abstract descriptor for this attribute. More...
 
void walkImmediateSubElements (function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const
 Walk all of the immediately nested sub-attributes and sub-types. More...
 
auto replaceImmediateSubElements (ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const
 Replace the immediately nested sub-attributes and sub-types with those provided. More...
 
template<WalkOrder Order = WalkOrder::PostOrder, typename... WalkFns>
auto walk (WalkFns &&...walkFns)
 Walk this attribute and all attibutes/types nested within using the provided walk functions. More...
 
template<typename... ReplacementFns>
auto replace (ReplacementFns &&...replacementFns)
 Recursively replace all of the nested sub-attributes and sub-types using the provided map functions. More...
 
ImplTypegetImpl () const
 Return the internal Attribute implementation. More...
 
- Protected Member Functions inherited from mlir::DenseElementsAttr
IntElementIterator raw_int_begin () const
 Iterators to various elements that require out-of-line definition. More...
 
IntElementIterator raw_int_end () const
 
FailureOr< iterator_range_impl< ComplexIntElementIterator > > tryGetComplexIntValues () const
 
FailureOr< iterator_range_impl< FloatElementIterator > > tryGetFloatValues () const
 
FailureOr< iterator_range_impl< ComplexFloatElementIterator > > tryGetComplexFloatValues () const
 
bool isValidBool () const
 Check the information for a C++ data type, check if this type is valid for the current attribute. More...
 
bool isValidIntOrFloat (int64_t dataEltSize, bool isInt, bool isSigned) const
 
bool isValidComplex (int64_t dataEltSize, bool isInt, bool isSigned) const
 
- Static Protected Member Functions inherited from mlir::DenseElementsAttr
static DenseElementsAttr getRawComplex (ShapedType type, ArrayRef< char > data, int64_t dataEltSize, bool isInt, bool isSigned)
 Overload of the raw 'get' method that asserts that the given type is of complex type. More...
 
static DenseElementsAttr getRawIntOrFloat (ShapedType type, ArrayRef< char > data, int64_t dataEltSize, bool isInt, bool isSigned)
 Overload of the raw 'get' method that asserts that the given type is of integer or floating-point type. More...
 
- Protected Attributes inherited from mlir::Attribute
ImplTypeimpl {nullptr}
 

Detailed Description

An attribute that represents a reference to a splat vector or tensor constant, meaning all of the elements have the same value.

Definition at line 687 of file BuiltinAttributes.h.

Member Function Documentation

◆ classof()

static bool mlir::SplatElementsAttr::classof ( Attribute  attr)
inlinestatic

Method for support type inquiry through isa, cast and dyn_cast.

Definition at line 692 of file BuiltinAttributes.h.


The documentation for this class was generated from the following file: