MLIR  20.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 (std::nullopt_t none)
 
 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. 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...
 
void clear ()
 
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...
 
std::optional< NamedAttributefindDuplicate () const
 Returns an entry with a duplicate name the list, if it exists, else returns std::nullopt. 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...
 
std::optional< NamedAttributegetNamed (StringRef name) const
 Return the specified named attribute if present, std::nullopt otherwise. More...
 
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. 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 801 of file OperationSupport.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 804 of file OperationSupport.h.

◆ const_reference

Definition at line 806 of file OperationSupport.h.

◆ iterator

Definition at line 803 of file OperationSupport.h.

◆ reference

Definition at line 805 of file OperationSupport.h.

◆ size_type

Definition at line 807 of file OperationSupport.h.

Constructor & Destructor Documentation

◆ NamedAttrList() [1/6]

mlir::NamedAttrList::NamedAttrList ( )
inline

Definition at line 809 of file OperationSupport.h.

◆ NamedAttrList() [2/6]

mlir::NamedAttrList::NamedAttrList ( std::nullopt_t  none)
inline

Definition at line 810 of file OperationSupport.h.

◆ NamedAttrList() [3/6]

NamedAttrList::NamedAttrList ( ArrayRef< NamedAttribute attributes)

Definition at line 29 of file OperationSupport.cpp.

References assign().

◆ NamedAttrList() [4/6]

NamedAttrList::NamedAttrList ( DictionaryAttr  attributes)

Definition at line 33 of file OperationSupport.cpp.

◆ NamedAttrList() [5/6]

NamedAttrList::NamedAttrList ( const_iterator  inStart,
const_iterator  inEnd 
)

Definition at line 39 of file OperationSupport.cpp.

References assign().

◆ NamedAttrList() [6/6]

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

Definition at line 816 of file OperationSupport.h.

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 848 of file OperationSupport.h.

◆ append() [2/5]

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

Append the given named attribute.

Definition at line 835 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 839 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 830 of file OperationSupport.h.

References append().

◆ append() [5/5]

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

◆ assign() [1/2]

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

Replaces the attributes with new list of attributes.

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

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

◆ begin() [1/2]

iterator mlir::NamedAttrList::begin ( )
inline

Definition at line 910 of file OperationSupport.h.

◆ begin() [2/2]

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

Definition at line 912 of file OperationSupport.h.

◆ clear()

void mlir::NamedAttrList::clear ( )
inline

Definition at line 863 of file OperationSupport.h.

◆ empty()

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

Definition at line 868 of file OperationSupport.h.

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

◆ end() [1/2]

iterator mlir::NamedAttrList::end ( )
inline

Definition at line 911 of file OperationSupport.h.

◆ end() [2/2]

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

Definition at line 913 of file OperationSupport.h.

◆ erase() [1/2]

Attribute NamedAttrList::erase ( StringAttr  name)

◆ erase() [2/2]

Attribute NamedAttrList::erase ( StringRef  name)

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

◆ get() [1/2]

Attribute NamedAttrList::get ( StringAttr  name) const

Return the specified attribute if present, null otherwise.

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

◆ getAttrs()

ArrayRef< NamedAttribute > NamedAttrList::getAttrs ( ) const

◆ getDictionary()

DictionaryAttr NamedAttrList::getDictionary ( MLIRContext context) const

◆ getNamed() [1/2]

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

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

◆ operator ArrayRef< NamedAttribute >()

NamedAttrList::operator ArrayRef< NamedAttribute > ( ) const

Definition at line 163 of file OperationSupport.cpp.

◆ operator!=()

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

Definition at line 819 of file OperationSupport.h.

◆ operator=()

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

Definition at line 158 of file OperationSupport.cpp.

References assign().

◆ operator==()

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

Definition at line 822 of file OperationSupport.h.

◆ pop_back()

void mlir::NamedAttrList::pop_back ( )
inline

Pop last element from list.

Definition at line 876 of file OperationSupport.h.

Referenced by parseBound().

◆ push_back()

void NamedAttrList::push_back ( NamedAttribute  newAttribute)

◆ reserve()

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

Definition at line 870 of file OperationSupport.h.

◆ 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 105 of file OperationSupport.cpp.

Referenced by mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::AttrConverterConstrainedFPToLLVM(), mlir::arith::AttrConvertFastMathToLLVM< SourceOp, TargetOp >::AttrConvertFastMathToLLVM(), parseCmpOp(), 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 133 of file OperationSupport.cpp.

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


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