|
MLIR 22.0.0git
|
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"
Static Public Member Functions | |
| static bool | classof (Attribute attr) |
| Method for support type inquiry through isa, cast and dyn_cast. | |
| Static Public Member Functions inherited from mlir::DenseElementsAttr | |
| static bool | classof (Attribute attr) |
| Method for support type inquiry through isa, cast and dyn_cast. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< Attribute > values) |
| Constructs a dense elements attribute from an array of element values. | |
| 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. | |
| 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. | |
| 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. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< bool > values) |
| Overload of the above 'get' method that is specialized for boolean values. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< StringRef > values) |
| Overload of the above 'get' method that is specialized for StringRef values. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< APInt > values) |
| Constructs a dense integer elements attribute from an array of APInt values. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< std::complex< APInt > > values) |
| Constructs a dense complex elements attribute from an array of APInt values. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< APFloat > values) |
| Constructs a dense float elements attribute from an array of APFloat values. | |
| static DenseElementsAttr | get (ShapedType type, ArrayRef< std::complex< APFloat > > values) |
| Constructs a dense complex elements attribute from an array of APFloat values. | |
| 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. | |
| static DenseElementsAttr | getFromRawBuffer (ShapedType type, ArrayRef< char > rawBuffer) |
| Construct a dense elements attribute from a raw buffer representing the data for this attribute. | |
| 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. | |
| Static Public Member Functions inherited from mlir::Attribute | |
| static Attribute | getFromOpaquePointer (const void *ptr) |
| Construct an attribute from the opaque pointer representation. | |
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. | |
| template<typename T, typename AttrT = DenseElementsAttr> | |
| using | iterator = decltype(std::declval<AttrT>().template value_begin<T>()) |
| The iterator for the given element type T. | |
| template<typename T, typename AttrT = DenseElementsAttr> | |
| using | iterator_range |
| The iterator range over the given element T. | |
| template<typename T> | |
| using | IntFloatValueTemplateCheckT |
| Try to get the held element values as a range of integer or floating-point values. | |
| template<typename T, typename ElementT> | |
| using | ComplexValueTemplateCheckT |
| Try to get the held element values as a range of std::complex. | |
| template<typename T> | |
| using | StringRefValueTemplateCheckT |
| Try to get the held element values as a range of StringRef. | |
| template<typename T> | |
| using | AttributeValueTemplateCheckT |
| Try to get the held element values as a range of Attributes. | |
| template<typename T> | |
| using | DerivedAttrValueTemplateCheckT |
| Try to get the held element values a range of T, where T is a derived attribute type. | |
| template<typename T> | |
| using | BoolValueTemplateCheckT |
| Try to get the held element values as a range of bool. | |
| template<typename T> | |
| using | APIntValueTemplateCheckT |
| Try to get the held element values as a range of APInts. | |
| template<typename T> | |
| using | ComplexAPIntValueTemplateCheckT |
| Try to get the held element values as a range of complex APInts. | |
| template<typename T> | |
| using | APFloatValueTemplateCheckT |
| Try to get the held element values as a range of APFloat. | |
| template<typename T> | |
| using | ComplexAPFloatValueTemplateCheckT |
| Try to get the held element values as a range of complex APFloat. | |
| Public Types inherited from mlir::Attribute | |
| template<typename ConcreteType, typename BaseType, typename StorageType, template< typename T > class... Traits> | |
| using | AttrBase |
| Utility class for implementing attributes. | |
| using | ImplType = AttributeStorage |
| using | ValueType = void |
| using | AbstractTy = AbstractAttribute |
| Public Member Functions inherited from mlir::DenseElementsAttr | |
| operator ElementsAttr () const | |
| Allow implicit conversion to ElementsAttr. | |
| operator TypedAttr () const | |
| Allow implicit conversion to TypedAttr. | |
| bool | isSplat () const |
| Returns true if this attribute corresponds to a splat, i.e. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| template<typename T> | |
| auto | getValues () const |
| Return the held element values as a range of the given type. | |
| template<typename T> | |
| auto | value_begin () const |
| Get an iterator of the given type to the start of the held element values. | |
| template<typename T> | |
| auto | value_end () const |
| Get an iterator of the given type to the end of the held element values. | |
| 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. | |
| ArrayRef< StringRef > | getRawStringData () const |
| Return the raw StringRef data held by this attribute. | |
| ShapedType | getType () const |
| Return the type of this ElementsAttr, guaranteed to be a vector or tensor with static shape. | |
| Type | getElementType () const |
| Return the element type of this DenseElementsAttr. | |
| int64_t | getNumElements () const |
| Returns the number of elements held by this attribute. | |
| int64_t | size () const |
| Returns the number of elements held by this attribute. | |
| bool | empty () const |
| Returns if the number of elements held by this attribute is 0. | |
| DenseElementsAttr | reshape (ShapedType newType) |
| Return a new DenseElementsAttr that has the same data as the current attribute, but has been reshaped to 'newType'. | |
| 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. | |
| DenseElementsAttr | bitcast (Type newElType) |
| Return a new DenseElementsAttr that has the same data as the current attribute, but has bitcast elements to 'newElType'. | |
| 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. | |
| 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. | |
| 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 | |
| Attribute & | operator= (const Attribute &other)=default |
| bool | operator== (Attribute other) const |
| bool | operator!= (Attribute other) const |
| operator bool () const | |
| bool | operator! () const |
| TypeID | getTypeID () |
| Return a unique identifier for the concrete attribute type. | |
| MLIRContext * | getContext () const |
| Return the context this attribute belongs to. | |
| Dialect & | getDialect () const |
| Get the dialect this attribute is registered to. | |
| void | print (raw_ostream &os, bool elideType=false) const |
| Print the attribute. | |
| 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. | |
| void | printStripped (raw_ostream &os, AsmState &state) const |
| const void * | getAsOpaquePointer () const |
| Get an opaque pointer to the attribute. | |
| friend::llvm::hash_code | hash_value (Attribute arg) |
| template<typename InterfaceT> | |
| bool | hasPromiseOrImplementsInterface () |
| Returns true if InterfaceT has been promised by the dialect or implemented. | |
| template<template< typename T > class Trait> | |
| bool | hasTrait () |
| Returns true if the type was registered with a particular trait. | |
| const AbstractTy & | getAbstractAttribute () const |
| Return the abstract descriptor for this attribute. | |
| void | walkImmediateSubElements (function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const |
| Walk all of the immediately nested sub-attributes and sub-types. | |
| auto | replaceImmediateSubElements (ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const |
| Replace the immediately nested sub-attributes and sub-types with those provided. | |
| 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. | |
| template<typename... ReplacementFns> | |
| auto | replace (ReplacementFns &&...replacementFns) |
| Recursively replace all of the nested sub-attributes and sub-types using the provided map functions. | |
| ImplType * | getImpl () const |
| Return the internal Attribute implementation. | |
| Protected Member Functions inherited from mlir::DenseElementsAttr | |
| IntElementIterator | raw_int_begin () const |
| Iterators to various elements that require out-of-line definition. | |
| 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. | |
| 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. | |
| 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. | |
| Protected Attributes inherited from mlir::Attribute | |
| ImplType * | impl {nullptr} |
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.
Method for support type inquiry through isa, cast and dyn_cast.
Definition at line 692 of file BuiltinAttributes.h.
References mlir::DenseElementsAttr::Attribute().