MLIR  15.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:
+ Collaboration 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 = typename std::enable_if< std::numeric_limits<T>::is_integer || is_valid_cpp_fp_type<T>::value>::type>
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 = typename std::enable_if< std::numeric_limits<T>::is_integer || is_valid_cpp_fp_type<T>::value || detail::is_complex_t<T>::value>::type>
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 = typename std::enable_if< detail::is_complex_t<T>::value && (std::numeric_limits<ElementT>::is_integer || is_valid_cpp_fp_type<ElementT>::value)>::type>
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 bool classof (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 = typename std::enable_if<(!std::is_same< T, bool >::value &&std::numeric_limits< T >::is_integer)||is_valid_cpp_fp_type< T >::value >::type
 Return the held element values as a range of integer or floating-point values. More...
 
template<typename T , typename ElementT >
using ComplexValueTemplateCheckT = typename std::enable_if< detail::is_complex_t< T >::value &&(std::numeric_limits< ElementT >::is_integer||is_valid_cpp_fp_type< ElementT >::value)>::type
 Return the held element values as a range of std::complex. More...
 
template<typename T >
using StringRefValueTemplateCheckT = typename std::enable_if< std::is_same< T, StringRef >::value >::type
 Return the held element values as a range of StringRef. More...
 
template<typename T >
using AttributeValueTemplateCheckT = typename std::enable_if< std::is_same< T, Attribute >::value >::type
 Return the held element values as a range of Attributes. More...
 
template<typename T >
using DerivedAttrValueTemplateCheckT = typename std::enable_if< std::is_base_of< Attribute, T >::value &&!std::is_same< Attribute, T >::value >::type
 Return the held element values a range of T, where T is a derived attribute type. More...
 
template<typename T >
using BoolValueTemplateCheckT = typename std::enable_if< std::is_same< T, bool >::value >::type
 Return the held element values as a range of bool. More...
 
template<typename T >
using APIntValueTemplateCheckT = typename std::enable_if< std::is_same< T, APInt >::value >::type
 Return the held element values as a range of APInts. More...
 
template<typename T >
using ComplexAPIntValueTemplateCheckT = typename std::enable_if< std::is_same< T, std::complex< APInt > >::value >::type
 Return the held element values as a range of complex APInts. More...
 
template<typename T >
using APFloatValueTemplateCheckT = typename std::enable_if< std::is_same< T, APFloat >::value >::type
 Return the held element values as a range of APFloat. More...
 
template<typename T >
using ComplexAPFloatValueTemplateCheckT = typename std::enable_if< std::is_same< T, std::complex< APFloat > >::value >::type
 Return 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...
 
bool isSplat () const
 Returns true if this attribute corresponds to a splat, i.e. More...
 
template<typename T >
std::enable_if<!std::is_base_of< Attribute, T >::value||std::is_same< Attribute, T >::value, T >::type getSplatValue () const
 Return the splat value for this attribute. More...
 
template<typename T >
std::enable_if< std::is_base_of< Attribute, T >::value &&!std::is_same< Attribute, T >::value, T >::type getSplatValue () const
 Return the splat value for derived attribute element types. More...
 
template<typename T , typename = IntFloatValueTemplateCheckT<T>>
iterator_range_impl< ElementIterator< T > > getValues () const
 
template<typename T , typename = IntFloatValueTemplateCheckT<T>>
ElementIterator< T > value_begin () const
 
template<typename T , typename = IntFloatValueTemplateCheckT<T>>
ElementIterator< T > value_end () const
 
template<typename T , typename ElementT = typename T::value_type, typename = ComplexValueTemplateCheckT<T, ElementT>>
iterator_range_impl< ElementIterator< T > > getValues () const
 
template<typename T , typename ElementT = typename T::value_type, typename = ComplexValueTemplateCheckT<T, ElementT>>
ElementIterator< T > value_begin () const
 
template<typename T , typename ElementT = typename T::value_type, typename = ComplexValueTemplateCheckT<T, ElementT>>
ElementIterator< T > value_end () const
 
template<typename T , typename = StringRefValueTemplateCheckT<T>>
iterator_range_impl< ElementIterator< StringRef > > getValues () const
 
template<typename T , typename = StringRefValueTemplateCheckT<T>>
ElementIterator< StringRef > value_begin () const
 
template<typename T , typename = StringRefValueTemplateCheckT<T>>
ElementIterator< StringRef > value_end () const
 
template<typename T , typename = AttributeValueTemplateCheckT<T>>
iterator_range_impl< AttributeElementIteratorgetValues () const
 
template<typename T , typename = AttributeValueTemplateCheckT<T>>
AttributeElementIterator value_begin () const
 
template<typename T , typename = AttributeValueTemplateCheckT<T>>
AttributeElementIterator value_end () const
 
template<typename T , typename = DerivedAttrValueTemplateCheckT<T>>
iterator_range_impl< DerivedAttributeElementIterator< T > > getValues () const
 
template<typename T , typename = DerivedAttrValueTemplateCheckT<T>>
DerivedAttributeElementIterator< T > value_begin () const
 
template<typename T , typename = DerivedAttrValueTemplateCheckT<T>>
DerivedAttributeElementIterator< T > value_end () const
 
template<typename T , typename = BoolValueTemplateCheckT<T>>
iterator_range_impl< BoolElementIteratorgetValues () const
 
template<typename T , typename = BoolValueTemplateCheckT<T>>
BoolElementIterator value_begin () const
 
template<typename T , typename = BoolValueTemplateCheckT<T>>
BoolElementIterator value_end () const
 
template<typename T , typename = APIntValueTemplateCheckT<T>>
iterator_range_impl< IntElementIteratorgetValues () const
 
template<typename T , typename = APIntValueTemplateCheckT<T>>
IntElementIterator value_begin () const
 
template<typename T , typename = APIntValueTemplateCheckT<T>>
IntElementIterator value_end () const
 
template<typename T , typename = ComplexAPIntValueTemplateCheckT<T>>
iterator_range_impl< ComplexIntElementIteratorgetValues () const
 
template<typename T , typename = ComplexAPIntValueTemplateCheckT<T>>
ComplexIntElementIterator value_begin () const
 
template<typename T , typename = ComplexAPIntValueTemplateCheckT<T>>
ComplexIntElementIterator value_end () const
 
template<typename T , typename = APFloatValueTemplateCheckT<T>>
iterator_range_impl< FloatElementIteratorgetValues () const
 
template<typename T , typename = APFloatValueTemplateCheckT<T>>
FloatElementIterator value_begin () const
 
template<typename T , typename = APFloatValueTemplateCheckT<T>>
FloatElementIterator value_end () const
 
template<typename T , typename = ComplexAPFloatValueTemplateCheckT<T>>
iterator_range_impl< ComplexFloatElementIteratorgetValues () const
 
template<typename T , typename = ComplexAPFloatValueTemplateCheckT<T>>
ComplexFloatElementIterator value_begin () const
 
template<typename T , typename = ComplexAPFloatValueTemplateCheckT<T>>
ComplexFloatElementIterator value_end () 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...
 
- Public Member Functions inherited from mlir::Attribute
constexpr Attribute ()
 
 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 U >
bool isa () const
 
template<typename First , typename Second , typename... Rest>
bool isa () const
 
template<typename First , typename... Rest>
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...
 
Type getType () const
 Return the type of this attribute. 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) const
 Print the attribute. More...
 
void dump () const
 
const voidgetAsOpaquePointer () const
 Get an opaque pointer to the attribute. 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...
 
- 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
 
iterator_range_impl< ComplexIntElementIteratorgetComplexIntValues () const
 
ComplexIntElementIterator complex_value_begin () const
 
ComplexIntElementIterator complex_value_end () const
 
iterator_range_impl< FloatElementIteratorgetFloatValues () const
 Return the held element values as a range of APFloat. More...
 
FloatElementIterator float_value_begin () const
 
FloatElementIterator float_value_end () const
 
iterator_range_impl< ComplexFloatElementIteratorgetComplexFloatValues () const
 
ComplexFloatElementIterator complex_float_value_begin () const
 
ComplexFloatElementIterator complex_float_value_end () 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 722 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 727 of file BuiltinAttributes.h.

References mlir::Attribute::dyn_cast(), and mlir::DenseElementsAttr::isSplat().


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