MLIR 22.0.0git
mlir::NamedAttrList Class Reference

NamedAttrList is array of NamedAttributes that tracks whether it is sorted and does some basic work to remain sorted. More...

#include "mlir/IR/OperationSupport.h"

Public Types

using iterator = SmallVectorImpl<NamedAttribute>::iterator
using const_iterator = SmallVectorImpl<NamedAttribute>::const_iterator
using reference = NamedAttribute &
using const_reference = const NamedAttribute &
using size_type = size_t

Public Member Functions

 NamedAttrList ()
 LLVM_DEPRECATED ("Use NamedAttrList() instead", "NamedAttrList()") NamedAttrList(std
 NamedAttrList (ArrayRef< NamedAttribute > attributes)
 NamedAttrList (DictionaryAttr attributes)
 NamedAttrList (const_iterator inStart, const_iterator inEnd)
template<typename Container>
 NamedAttrList (const Container &vec)
bool operator!= (const NamedAttrList &other) const
bool operator== (const NamedAttrList &other) const
void append (StringRef name, Attribute attr)
 Add an attribute with the specified name.
void append (StringAttr name, Attribute attr)
 Add an attribute with the specified name.
void append (NamedAttribute attr)
 Append the given named attribute.
template<typename RangeT>
void append (RangeT &&newAttributes)
 Add an array of named attributes.
template<typename IteratorT, typename = std::enable_if_t<std::is_convertible< typename std::iterator_traits<IteratorT>::iterator_category, std::input_iterator_tag>::value>>
void append (IteratorT inStart, IteratorT inEnd)
 Add a range of named attributes.
void assign (const_iterator inStart, const_iterator inEnd)
 Replaces the attributes with new list of attributes.
void assign (ArrayRef< NamedAttribute > range)
 Replaces the attributes with new list of attributes.
void clear ()
bool empty () const
void reserve (size_type N)
void push_back (NamedAttribute newAttribute)
 Add an attribute with the specified name.
void pop_back ()
 Pop last element from list.
std::optional< NamedAttributefindDuplicate () const
 Returns an entry with a duplicate name the list, if it exists, else returns std::nullopt.
DictionaryAttr getDictionary (MLIRContext *context) const
 Return a dictionary attribute for the underlying dictionary.
ArrayRef< NamedAttributegetAttrs () const
 Return all of the attributes on this operation.
Attribute get (StringAttr name) const
 Return the specified attribute if present, null otherwise.
Attribute get (StringRef name) const
 Return the specified attribute if present, null otherwise.
std::optional< NamedAttributegetNamed (StringRef name) const
 Return the specified named attribute if present, std::nullopt otherwise.
std::optional< NamedAttributegetNamed (StringAttr name) const
Attribute set (StringAttr name, Attribute value)
 If the an attribute exists with the specified name, change it to the new value.
Attribute set (StringRef name, Attribute value)
Attribute erase (StringAttr name)
 Erase the attribute with the given name from the list.
Attribute erase (StringRef name)
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
NamedAttrListoperator= (const SmallVectorImpl< NamedAttribute > &rhs)
 operator ArrayRef< NamedAttribute > () const

Detailed Description

NamedAttrList is array of NamedAttributes that tracks whether it is sorted and does some basic work to remain sorted.

Definition at line 796 of file OperationSupport.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 799 of file OperationSupport.h.

◆ const_reference

Definition at line 801 of file OperationSupport.h.

◆ iterator

Definition at line 798 of file OperationSupport.h.

◆ reference

◆ size_type

Definition at line 802 of file OperationSupport.h.

Constructor & Destructor Documentation

◆ NamedAttrList() [1/5]

mlir::NamedAttrList::NamedAttrList ( )
inline

◆ NamedAttrList() [2/5]

NamedAttrList::NamedAttrList ( ArrayRef< NamedAttribute > attributes)

Definition at line 28 of file OperationSupport.cpp.

References assign().

◆ NamedAttrList() [3/5]

NamedAttrList::NamedAttrList ( DictionaryAttr attributes)

Definition at line 32 of file OperationSupport.cpp.

References NamedAttrList().

◆ NamedAttrList() [4/5]

NamedAttrList::NamedAttrList ( const_iterator inStart,
const_iterator inEnd )

Definition at line 38 of file OperationSupport.cpp.

References assign().

◆ NamedAttrList() [5/5]

template<typename Container>
mlir::NamedAttrList::NamedAttrList ( const Container & vec)
inline

Definition at line 812 of file OperationSupport.h.

References NamedAttrList().

Member Function Documentation

◆ append() [1/5]

template<typename IteratorT, typename = std::enable_if_t<std::is_convertible< typename std::iterator_traits<IteratorT>::iterator_category, std::input_iterator_tag>::value>>
void mlir::NamedAttrList::append ( IteratorT inStart,
IteratorT inEnd )
inline

Add a range of named attributes.

Definition at line 846 of file OperationSupport.h.

◆ append() [2/5]

void mlir::NamedAttrList::append ( NamedAttribute attr)
inline

Append the given named attribute.

Definition at line 833 of file OperationSupport.h.

References push_back().

◆ append() [3/5]

template<typename RangeT>
void mlir::NamedAttrList::append ( RangeT && newAttributes)
inline

Add an array of named attributes.

Definition at line 837 of file OperationSupport.h.

References append().

◆ append() [4/5]

void mlir::NamedAttrList::append ( StringAttr name,
Attribute attr )
inline

Add an attribute with the specified name.

Definition at line 828 of file OperationSupport.h.

References append().

◆ append() [5/5]

◆ assign() [1/2]

void mlir::NamedAttrList::assign ( ArrayRef< NamedAttribute > range)
inline

Replaces the attributes with new list of attributes.

Definition at line 857 of file OperationSupport.h.

References assign().

◆ assign() [2/2]

void NamedAttrList::assign ( const_iterator inStart,
const_iterator inEnd )

Replaces the attributes with new list of attributes.

Definition at line 65 of file OperationSupport.cpp.

Referenced by assign(), NamedAttrList(), NamedAttrList(), and operator=().

◆ begin() [1/2]

iterator mlir::NamedAttrList::begin ( )
inline

Definition at line 908 of file OperationSupport.h.

◆ begin() [2/2]

const_iterator mlir::NamedAttrList::begin ( ) const
inline

Definition at line 910 of file OperationSupport.h.

◆ clear()

void mlir::NamedAttrList::clear ( )
inline

Definition at line 861 of file OperationSupport.h.

◆ empty()

bool mlir::NamedAttrList::empty ( ) const
inline

Definition at line 866 of file OperationSupport.h.

Referenced by mlir::GPUFuncOpLowering::matchAndRewrite().

◆ end() [1/2]

iterator mlir::NamedAttrList::end ( )
inline

Definition at line 909 of file OperationSupport.h.

◆ end() [2/2]

const_iterator mlir::NamedAttrList::end ( ) const
inline

Definition at line 911 of file OperationSupport.h.

◆ erase() [1/2]

Attribute NamedAttrList::erase ( StringAttr name)

Erase the attribute with the given name from the list.

Return the attribute that was erased, or nullptr if there was no attribute with such name.

Definition at line 141 of file OperationSupport.cpp.

Referenced by mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::function_interface_impl::removeArgAttr(), mlir::Operation::removeAttr(), mlir::Operation::removeDiscardableAttr(), and mlir::function_interface_impl::removeResultAttr().

◆ erase() [2/2]

Attribute NamedAttrList::erase ( StringRef name)

Definition at line 146 of file OperationSupport.cpp.

◆ findDuplicate()

std::optional< NamedAttribute > NamedAttrList::findDuplicate ( ) const

Returns an entry with a duplicate name the list, if it exists, else returns std::nullopt.

Definition at line 44 of file OperationSupport.cpp.

◆ get() [1/2]

Attribute NamedAttrList::get ( StringAttr name) const

Return the specified attribute if present, null otherwise.

Definition at line 82 of file OperationSupport.cpp.

Referenced by mlir::function_interface_impl::parseFunctionOp().

◆ get() [2/2]

Attribute NamedAttrList::get ( StringRef name) const

Return the specified attribute if present, null otherwise.

Definition at line 78 of file OperationSupport.cpp.

◆ getAttrs()

ArrayRef< NamedAttribute > NamedAttrList::getAttrs ( ) const

Return all of the attributes on this operation.

Definition at line 42 of file OperationSupport.cpp.

Referenced by buildStructuredOp().

◆ getDictionary()

◆ getNamed() [1/2]

std::optional< NamedAttribute > NamedAttrList::getNamed ( StringAttr name) const

Definition at line 92 of file OperationSupport.cpp.

◆ getNamed() [2/2]

std::optional< NamedAttribute > NamedAttrList::getNamed ( StringRef name) const

Return the specified named attribute if present, std::nullopt otherwise.

Definition at line 88 of file OperationSupport.cpp.

◆ LLVM_DEPRECATED()

mlir::NamedAttrList::LLVM_DEPRECATED ( "Use NamedAttrList() instead" ,
"NamedAttrList()"  )
inline

Definition at line 805 of file OperationSupport.h.

References NamedAttrList().

◆ operator ArrayRef< NamedAttribute >()

NamedAttrList::operator ArrayRef< NamedAttribute > ( ) const

Definition at line 157 of file OperationSupport.cpp.

◆ operator!=()

bool mlir::NamedAttrList::operator!= ( const NamedAttrList & other) const
inline

Definition at line 815 of file OperationSupport.h.

References NamedAttrList().

◆ operator=()

NamedAttrList & NamedAttrList::operator= ( const SmallVectorImpl< NamedAttribute > & rhs)

Definition at line 152 of file OperationSupport.cpp.

References assign(), and rhs.

◆ operator==()

bool mlir::NamedAttrList::operator== ( const NamedAttrList & other) const
inline

Definition at line 818 of file OperationSupport.h.

References NamedAttrList().

◆ pop_back()

void mlir::NamedAttrList::pop_back ( )
inline

Pop last element from list.

Definition at line 874 of file OperationSupport.h.

◆ push_back()

void NamedAttrList::push_back ( NamedAttribute newAttribute)

Add an attribute with the specified name.

Definition at line 70 of file OperationSupport.cpp.

Referenced by append(), mlir::detail::Parser::parseAttributeDict(), and mlir::impl::parseOptionalVisibilityKeyword().

◆ reserve()

void mlir::NamedAttrList::reserve ( size_type N)
inline

Definition at line 868 of file OperationSupport.h.

Referenced by mlirOperationCreate().

◆ set() [1/2]

Attribute NamedAttrList::set ( StringAttr name,
Attribute value )

If the an attribute exists with the specified name, change it to the new value.

Otherwise, add a new attribute with the specified name/value. Returns the previous attribute value of name, or null if no attribute previously existed with name.

Otherwise, add a new attribute with the specified name/value.

Definition at line 99 of file OperationSupport.cpp.

Referenced by mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::AttrConverterConstrainedFPToLLVM(), parseDenseI64ArrayAttr(), set(), mlir::function_interface_impl::setArgAttr(), mlir::Operation::setAttr(), mlir::Operation::setDiscardableAttr(), mlir::OperationName::UnregisteredOpModel::setInherentAttr(), and mlir::function_interface_impl::setResultAttr().

◆ set() [2/2]

Attribute NamedAttrList::set ( StringRef name,
Attribute value )

Definition at line 127 of file OperationSupport.cpp.

References mlir::Attribute::getContext(), and set().


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