MLIR
20.0.0git
|
This class contains all of the static information common to all instances of a registered Attribute. More...
#include "mlir/IR/AttributeSupport.h"
Public Types | |
using | HasTraitFn = llvm::unique_function< bool(TypeID) const > |
using | WalkImmediateSubElementsFn = function_ref< void(Attribute, function_ref< void(Attribute)>, function_ref< void(Type)>)> |
using | ReplaceImmediateSubElementsFn = function_ref< Attribute(Attribute, ArrayRef< Attribute >, ArrayRef< Type >)> |
Public Member Functions | |
Dialect & | getDialect () const |
Return the dialect this attribute was registered to. More... | |
template<typename T > | |
T::Concept * | getInterface () const |
Returns an instance of the concept object for the given interface if it was registered to this attribute, null otherwise. More... | |
bool | hasInterface (TypeID interfaceID) const |
Returns true if the attribute has the interface with the given ID registered. More... | |
template<template< typename T > class Trait> | |
bool | hasTrait () const |
Returns true if the attribute has a particular trait. More... | |
bool | hasTrait (TypeID traitID) const |
Returns true if the attribute has a particular trait. More... | |
void | walkImmediateSubElements (Attribute attr, function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const |
Walk the immediate sub-elements of this attribute. More... | |
Attribute | replaceImmediateSubElements (Attribute attr, ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const |
Replace the immediate sub-elements of this attribute. More... | |
TypeID | getTypeID () const |
Return the unique identifier representing the concrete attribute class. More... | |
StringRef | getName () const |
Return the unique name representing the type. More... | |
Static Public Member Functions | |
static const AbstractAttribute & | lookup (TypeID typeID, MLIRContext *context) |
Look up the specified abstract attribute in the MLIRContext and return a reference to it. More... | |
static std::optional< std::reference_wrapper< const AbstractAttribute > > | lookup (StringRef name, MLIRContext *context) |
Look up the specified abstract attribute in the MLIRContext and return a reference to it if it exists. More... | |
template<typename T > | |
static AbstractAttribute | get (Dialect &dialect) |
This method is used by Dialect objects when they register the list of attributes they contain. More... | |
static AbstractAttribute | get (Dialect &dialect, detail::InterfaceMap &&interfaceMap, HasTraitFn &&hasTrait, WalkImmediateSubElementsFn walkImmediateSubElementsFn, ReplaceImmediateSubElementsFn replaceImmediateSubElementsFn, TypeID typeID, StringRef name) |
This method is used by Dialect objects to register attributes with custom TypeIDs. More... | |
Friends | |
template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits> | |
class | detail::StorageUserBase |
Give StorageUserBase access to the mutable lookup. More... | |
This class contains all of the static information common to all instances of a registered Attribute.
Definition at line 29 of file AttributeSupport.h.
using mlir::AbstractAttribute::HasTraitFn = llvm::unique_function<bool(TypeID) const> |
Definition at line 31 of file AttributeSupport.h.
using mlir::AbstractAttribute::ReplaceImmediateSubElementsFn = function_ref<Attribute(Attribute, ArrayRef<Attribute>, ArrayRef<Type>)> |
Definition at line 34 of file AttributeSupport.h.
using mlir::AbstractAttribute::WalkImmediateSubElementsFn = function_ref<void( Attribute, function_ref<void(Attribute)>, function_ref<void(Type)>)> |
Definition at line 32 of file AttributeSupport.h.
|
inlinestatic |
This method is used by Dialect objects when they register the list of attributes they contain.
Definition at line 49 of file AttributeSupport.h.
Referenced by mlir::ExtensibleDialect::registerDynamicAttr().
|
inlinestatic |
This method is used by Dialect objects to register attributes with custom TypeIDs.
The use of this method is in general discouraged in favor of 'get<CustomAttribute>(dialect)'.
Definition at line 61 of file AttributeSupport.h.
References hasTrait().
|
inline |
Return the dialect this attribute was registered to.
Definition at line 72 of file AttributeSupport.h.
|
inline |
Returns an instance of the concept object for the given interface if it was registered to this attribute, null otherwise.
This should not be used directly.
Definition at line 78 of file AttributeSupport.h.
References mlir::detail::InterfaceMap::lookup().
Referenced by mlir::AttributeInterface< ConcreteType, Traits >::getInterfaceFor().
|
inline |
Return the unique name representing the type.
Definition at line 111 of file AttributeSupport.h.
Referenced by mlir::irdl::BaseAttrConstraint::verify().
|
inline |
Return the unique identifier representing the concrete attribute class.
Definition at line 108 of file AttributeSupport.h.
|
inline |
Returns true if the attribute has the interface with the given ID registered.
Definition at line 84 of file AttributeSupport.h.
References mlir::detail::InterfaceMap::contains().
|
inline |
Returns true if the attribute has a particular trait.
Definition at line 90 of file AttributeSupport.h.
Referenced by get(), and mlir::Attribute::hasTrait().
|
inline |
Returns true if the attribute has a particular trait.
Definition at line 95 of file AttributeSupport.h.
|
static |
Look up the specified abstract attribute in the MLIRContext and return a reference to it if it exists.
Definition at line 793 of file MLIRContext.cpp.
References mlir::MLIRContext::getImpl().
|
static |
Look up the specified abstract attribute in the MLIRContext and return a reference to it.
Get the dialect that registered the attribute with the provided typeid.
Definition at line 777 of file MLIRContext.cpp.
Referenced by mlir::detail::DistinctAttributeUniquer::get().
Attribute AbstractAttribute::replaceImmediateSubElements | ( | Attribute | attr, |
ArrayRef< Attribute > | replAttrs, | ||
ArrayRef< Type > | replTypes | ||
) | const |
Replace the immediate sub-elements of this attribute.
Definition at line 26 of file Attributes.cpp.
Referenced by mlir::Attribute::replaceImmediateSubElements().
void AbstractAttribute::walkImmediateSubElements | ( | Attribute | attr, |
function_ref< void(Attribute)> | walkAttrsFn, | ||
function_ref< void(Type)> | walkTypesFn | ||
) | const |
Walk the immediate sub-elements of this attribute.
Definition at line 19 of file Attributes.cpp.
Referenced by mlir::Attribute::walkImmediateSubElements().
|
friend |
Give StorageUserBase access to the mutable lookup.
Definition at line 128 of file AttributeSupport.h.