MLIR
20.0.0git
|
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< NamedAttribute > | findDuplicate () 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< NamedAttribute > | getAttrs () 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< NamedAttribute > | getNamed (StringRef name) const |
Return the specified named attribute if present, std::nullopt otherwise. More... | |
std::optional< NamedAttribute > | getNamed (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 |
NamedAttrList & | operator= (const SmallVectorImpl< NamedAttribute > &rhs) |
operator ArrayRef< NamedAttribute > () const | |
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.
Definition at line 804 of file OperationSupport.h.
using mlir::NamedAttrList::const_reference = const NamedAttribute & |
Definition at line 806 of file OperationSupport.h.
Definition at line 803 of file OperationSupport.h.
using mlir::NamedAttrList::reference = NamedAttribute & |
Definition at line 805 of file OperationSupport.h.
using mlir::NamedAttrList::size_type = size_t |
Definition at line 807 of file OperationSupport.h.
|
inline |
Definition at line 809 of file OperationSupport.h.
|
inline |
Definition at line 810 of file OperationSupport.h.
NamedAttrList::NamedAttrList | ( | ArrayRef< NamedAttribute > | attributes | ) |
Definition at line 29 of file OperationSupport.cpp.
References assign().
NamedAttrList::NamedAttrList | ( | DictionaryAttr | attributes | ) |
Definition at line 33 of file OperationSupport.cpp.
NamedAttrList::NamedAttrList | ( | const_iterator | inStart, |
const_iterator | inEnd | ||
) |
Definition at line 39 of file OperationSupport.cpp.
References assign().
|
inline |
Definition at line 816 of file OperationSupport.h.
|
inline |
Add a range of named attributes.
Definition at line 848 of file OperationSupport.h.
|
inline |
Append the given named attribute.
Definition at line 835 of file OperationSupport.h.
References push_back().
|
inline |
Add an array of named attributes.
Definition at line 839 of file OperationSupport.h.
References append().
|
inline |
Add an attribute with the specified name.
Definition at line 830 of file OperationSupport.h.
References append().
void NamedAttrList::append | ( | StringRef | name, |
Attribute | attr | ||
) |
Add an attribute with the specified name.
Definition at line 66 of file OperationSupport.cpp.
References mlir::get(), and mlir::Attribute::getContext().
Referenced by mlir::OperationState::addAttribute(), mlir::OperationState::addAttributes(), append(), mlir::ROCDL::getAMDHSAKernelsELFMetadata(), mlir::AsmParser::parseAttribute(), parseCommonStructuredOpParts(), mlir::AsmParser::parseCustomAttributeWithFallback(), mlir::function_interface_impl::parseFunctionOp(), mlir::AsmParser::parseOptionalAttribute(), mlir::AsmParser::parseOptionalSymbolName(), mlir::AsmParser::parseSymbolName(), and mlir::Operation::setDialectAttrs().
|
inline |
Replaces the attributes with new list of attributes.
Definition at line 859 of file OperationSupport.h.
References assign().
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=().
|
inline |
Definition at line 910 of file OperationSupport.h.
|
inline |
Definition at line 912 of file OperationSupport.h.
|
inline |
Definition at line 863 of file OperationSupport.h.
|
inline |
Definition at line 868 of file OperationSupport.h.
Referenced by mlir::GPUFuncOpLowering::matchAndRewrite().
|
inline |
Definition at line 911 of file OperationSupport.h.
|
inline |
Definition at line 913 of file OperationSupport.h.
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 147 of file OperationSupport.cpp.
Referenced by mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::AttrConverterConstrainedFPToLLVM(), mlir::arith::AttrConvertFastMathToLLVM< SourceOp, TargetOp >::AttrConvertFastMathToLLVM(), mlir::arith::AttrConvertOverflowToLLVM< SourceOp, TargetOp >::AttrConvertOverflowToLLVM(), mlir::GPUFuncOpLowering::matchAndRewrite(), parseAffineMapWithMinMax(), mlir::function_interface_impl::removeArgAttr(), mlir::Operation::removeAttr(), mlir::Operation::removeDiscardableAttr(), and mlir::function_interface_impl::removeResultAttr().
Attribute NamedAttrList::erase | ( | StringRef | name | ) |
Definition at line 152 of file OperationSupport.cpp.
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.
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().
Attribute NamedAttrList::get | ( | StringRef | name | ) | const |
Return the specified attribute if present, null otherwise.
Definition at line 84 of file OperationSupport.cpp.
ArrayRef< NamedAttribute > NamedAttrList::getAttrs | ( | ) | const |
Return all of the attributes on this operation.
Definition at line 43 of file OperationSupport.cpp.
Referenced by mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::AttrConverterConstrainedFPToLLVM(), mlir::arith::AttrConvertFastMathToLLVM< SourceOp, TargetOp >::AttrConvertFastMathToLLVM(), mlir::arith::AttrConvertOverflowToLLVM< SourceOp, TargetOp >::AttrConvertOverflowToLLVM(), mlir::arith::AttrConvertFastMathToLLVM< SourceOp, TargetOp >::getAttrs(), mlir::arith::AttrConvertOverflowToLLVM< SourceOp, TargetOp >::getAttrs(), mlir::arith::AttrConverterConstrainedFPToLLVM< SourceOp, TargetOp >::getAttrs(), and parseNamedStructuredOp().
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 55 of file OperationSupport.cpp.
Referenced by mlir::Operation::getAttrDictionary(), mlir::detail::Parser::parseAttribute(), parseCommonStructuredOpParts(), mlir::Operation::populateDefaultAttrs(), mlir::function_interface_impl::removeArgAttr(), mlir::Operation::removeAttr(), mlir::Operation::removeDiscardableAttr(), mlir::function_interface_impl::removeResultAttr(), mlir::function_interface_impl::setArgAttr(), mlir::Operation::setAttr(), mlir::Operation::setDialectAttrs(), mlir::Operation::setDiscardableAttr(), mlir::OperationName::UnregisteredOpModel::setInherentAttr(), and mlir::function_interface_impl::setResultAttr().
std::optional< NamedAttribute > NamedAttrList::getNamed | ( | StringAttr | name | ) | const |
Definition at line 98 of file OperationSupport.cpp.
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.
NamedAttrList::operator ArrayRef< NamedAttribute > | ( | ) | const |
Definition at line 163 of file OperationSupport.cpp.
|
inline |
Definition at line 819 of file OperationSupport.h.
NamedAttrList & NamedAttrList::operator= | ( | const SmallVectorImpl< NamedAttribute > & | rhs | ) |
Definition at line 158 of file OperationSupport.cpp.
References assign().
|
inline |
Definition at line 822 of file OperationSupport.h.
|
inline |
Pop last element from list.
Definition at line 876 of file OperationSupport.h.
Referenced by parseBound().
void NamedAttrList::push_back | ( | NamedAttribute | newAttribute | ) |
Add an attribute with the specified name.
Definition at line 76 of file OperationSupport.cpp.
Referenced by append(), mlir::detail::Parser::parseAttributeDict(), mlir::impl::parseOptionalVisibilityKeyword(), and mlir::Operation::setDialectAttrs().
|
inline |
Definition at line 870 of file OperationSupport.h.
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().
Definition at line 133 of file OperationSupport.cpp.
References mlir::get(), mlir::Attribute::getContext(), and set().