MLIR  15.0.0git
Public Types | Public Member Functions | List of all members
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 ()
 
 NamedAttrList (ArrayRef< NamedAttribute > attributes)
 
 NamedAttrList (DictionaryAttr attributes)
 
 NamedAttrList (const_iterator inStart, const_iterator inEnd)
 
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. More...
 
void append (StringAttr name, Attribute attr)
 Add an attribute with the specified name. More...
 
void append (NamedAttribute attr)
 Append the given named attribute. More...
 
template<typename RangeT >
void append (RangeT &&newAttributes)
 Add an array of named attributes. More...
 
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. More...
 
void assign (const_iterator inStart, const_iterator inEnd)
 Replaces the attributes with new list of attributes. More...
 
void assign (ArrayRef< NamedAttribute > range)
 Replaces the attributes with new list of attributes. More...
 
bool empty () const
 
void reserve (size_type N)
 
void push_back (NamedAttribute newAttribute)
 Add an attribute with the specified name. More...
 
void pop_back ()
 Pop last element from list. More...
 
Optional< NamedAttributefindDuplicate () const
 Returns an entry with a duplicate name the list, if it exists, else returns llvm::None. More...
 
DictionaryAttr getDictionary (MLIRContext *context) const
 Return a dictionary attribute for the underlying dictionary. More...
 
ArrayRef< NamedAttributegetAttrs () const
 Return all of the attributes on this operation. More...
 
Attribute get (StringAttr name) const
 Return the specified attribute if present, null otherwise. More...
 
Attribute get (StringRef name) const
 Return the specified attribute if present, null otherwise. More...
 
Optional< NamedAttributegetNamed (StringRef name) const
 Return the specified named attribute if present, None otherwise. More...
 
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. More...
 
Attribute set (StringRef name, Attribute value)
 
Attribute erase (StringAttr name)
 Erase the attribute with the given name from the list. More...
 
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 467 of file OperationSupport.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 470 of file OperationSupport.h.

◆ const_reference

Definition at line 472 of file OperationSupport.h.

◆ iterator

Definition at line 469 of file OperationSupport.h.

◆ reference

Definition at line 471 of file OperationSupport.h.

◆ size_type

Definition at line 473 of file OperationSupport.h.

Constructor & Destructor Documentation

◆ NamedAttrList() [1/4]

mlir::NamedAttrList::NamedAttrList ( )
inline

Definition at line 475 of file OperationSupport.h.

◆ NamedAttrList() [2/4]

NamedAttrList::NamedAttrList ( ArrayRef< NamedAttribute attributes)

Definition at line 27 of file OperationSupport.cpp.

References assign().

◆ NamedAttrList() [3/4]

NamedAttrList::NamedAttrList ( DictionaryAttr  attributes)

Definition at line 31 of file OperationSupport.cpp.

◆ NamedAttrList() [4/4]

NamedAttrList::NamedAttrList ( const_iterator  inStart,
const_iterator  inEnd 
)

Definition at line 37 of file OperationSupport.cpp.

References assign().

Member Function Documentation

◆ append() [1/5]

void NamedAttrList::append ( StringRef  name,
Attribute  attr 
)

◆ append() [2/5]

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

Add an attribute with the specified name.

Definition at line 491 of file OperationSupport.h.

◆ append() [3/5]

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

Append the given named attribute.

Definition at line 496 of file OperationSupport.h.

◆ append() [4/5]

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

Add an array of named attributes.

Definition at line 500 of file OperationSupport.h.

References value.

◆ append() [5/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 509 of file OperationSupport.h.

◆ assign() [1/2]

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

Replaces the attributes with new list of attributes.

Definition at line 69 of file OperationSupport.cpp.

Referenced by foldMemRefCast(), and NamedAttrList().

◆ assign() [2/2]

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

Replaces the attributes with new list of attributes.

Definition at line 520 of file OperationSupport.h.

◆ begin() [1/2]

iterator mlir::NamedAttrList::begin ( )
inline

Definition at line 566 of file OperationSupport.h.

◆ begin() [2/2]

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

Definition at line 568 of file OperationSupport.h.

◆ empty()

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

Definition at line 524 of file OperationSupport.h.

◆ end() [1/2]

iterator mlir::NamedAttrList::end ( )
inline

Definition at line 567 of file OperationSupport.h.

◆ end() [2/2]

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

Definition at line 569 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 145 of file OperationSupport.cpp.

Referenced by mlir::Operation::removeAttr().

◆ erase() [2/2]

Attribute NamedAttrList::erase ( StringRef  name)

Definition at line 150 of file OperationSupport.cpp.

◆ findDuplicate()

Optional< NamedAttribute > NamedAttrList::findDuplicate ( ) const

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

Definition at line 43 of file OperationSupport.cpp.

◆ get() [1/2]

Attribute NamedAttrList::get ( StringAttr  name) const

Return the specified attribute if present, null otherwise.

Definition at line 86 of file OperationSupport.cpp.

Referenced by applyTilingToAll(), foldTransferInBoundsAttribute(), mlir::function_interface_impl::parseFunctionOp(), and printTransferAttrs().

◆ get() [2/2]

Attribute NamedAttrList::get ( StringRef  name) const

Return the specified attribute if present, null otherwise.

Definition at line 82 of file OperationSupport.cpp.

◆ getAttrs()

ArrayRef< NamedAttribute > NamedAttrList::getAttrs ( ) const

Return all of the attributes on this operation.

Definition at line 41 of file OperationSupport.cpp.

Referenced by buildStructuredOp(), parseNamedStructuredOp(), and verifyNumBlockArgs().

◆ getDictionary()

DictionaryAttr NamedAttrList::getDictionary ( MLIRContext context) const

Return a dictionary attribute for the underlying dictionary.

This will return an empty dictionary attribute if empty rather than null.

Definition at line 53 of file OperationSupport.cpp.

Referenced by mlir::Operation::create(), inferOperationTypes(), mlir::detail::Parser::parseAttribute(), parseFunctionArgumentList(), mlir::Operation::removeAttr(), mlir::Operation::setAttr(), and mlir::Operation::setDialectAttrs().

◆ getNamed() [1/2]

Optional< NamedAttribute > NamedAttrList::getNamed ( StringRef  name) const

Return the specified named attribute if present, None otherwise.

Definition at line 92 of file OperationSupport.cpp.

◆ getNamed() [2/2]

Optional< NamedAttribute > NamedAttrList::getNamed ( StringAttr  name) const

Definition at line 96 of file OperationSupport.cpp.

◆ operator ArrayRef< NamedAttribute >()

NamedAttrList::operator ArrayRef< NamedAttribute > ( ) const

Definition at line 161 of file OperationSupport.cpp.

◆ operator!=()

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

Definition at line 480 of file OperationSupport.h.

◆ operator=()

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

Definition at line 156 of file OperationSupport.cpp.

◆ operator==()

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

Definition at line 483 of file OperationSupport.h.

◆ pop_back()

void mlir::NamedAttrList::pop_back ( )
inline

Pop last element from list.

Definition at line 532 of file OperationSupport.h.

References value.

Referenced by parseBound().

◆ push_back()

void NamedAttrList::push_back ( NamedAttribute  newAttribute)

◆ reserve()

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

Definition at line 526 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 103 of file OperationSupport.cpp.

References value.

Referenced by foldTransferInBoundsAttribute(), printTransferAttrs(), and mlir::Operation::setAttr().

◆ set() [2/2]

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

Definition at line 131 of file OperationSupport.cpp.

References mlir::Attribute::getContext().


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