|
MLIR 24.0.0git
|
This class contains all of the static information common to all instances of a registered Type. More...
#include "mlir/IR/TypeSupport.h"
Public Types | |
| using | HasTraitFn = llvm::unique_function<bool(TypeID) const> |
| using | WalkImmediateSubElementsFn |
| using | ReplaceImmediateSubElementsFn |
Public Member Functions | |
| Dialect & | getDialect () const |
| Return the dialect this type was registered to. | |
| template<typename T> | |
| T::Concept * | getInterface () const |
| Returns an instance of the concept object for the given interface if it was registered to this type, null otherwise. | |
| bool | hasInterface (TypeID interfaceID) const |
| Returns true if the type has the interface with the given ID. | |
| template<template< typename T > class Trait> | |
| bool | hasTrait () const |
| Returns true if the type has a particular trait. | |
| bool | hasTrait (TypeID traitID) const |
| Returns true if the type has a particular trait. | |
| void | walkImmediateSubElements (Type type, function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const |
| Walk the immediate sub-elements of the given type. | |
| Type | replaceImmediateSubElements (Type type, ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const |
| Replace the immediate sub-elements of the given type. | |
| TypeID | getTypeID () const |
| Return the unique identifier representing the concrete type class. | |
| StringRef | getName () const |
| Return the unique name representing the type. | |
Static Public Member Functions | |
| static const AbstractType & | lookup (TypeID typeID, MLIRContext *context) |
| Look up the specified abstract type in the MLIRContext and return a reference to it. | |
| static std::optional< std::reference_wrapper< const AbstractType > > | lookup (StringRef name, MLIRContext *context) |
| Look up the specified abstract type in the MLIRContext and return a reference to it if it exists. | |
| template<typename T> | |
| static AbstractType | get (Dialect &dialect) |
| This method is used by Dialect objects when they register the list of types they contain. | |
| template<typename T> | |
| static void | insert (Dialect &dialect) |
| Register the type T with dialect. | |
| static AbstractType | 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 types with custom TypeIDs. | |
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. | |
This class contains all of the static information common to all instances of a registered Type.
Definition at line 30 of file TypeSupport.h.
| using mlir::AbstractType::HasTraitFn = llvm::unique_function<bool(TypeID) const> |
Definition at line 32 of file TypeSupport.h.
Definition at line 35 of file TypeSupport.h.
Definition at line 33 of file TypeSupport.h.
|
inlinestatic |
This method is used by Dialect objects when they register the list of types they contain.
Definition at line 50 of file TypeSupport.h.
Referenced by insert(), and mlir::ExtensibleDialect::registerDynamicType().
|
inlinestatic |
This method is used by Dialect objects to register types with custom TypeIDs.
The use of this method is in general discouraged in favor of 'get<CustomType>(dialect)';
Definition at line 66 of file TypeSupport.h.
References hasTrait().
|
inline |
Return the dialect this type was registered to.
Definition at line 77 of file TypeSupport.h.
|
inline |
Returns an instance of the concept object for the given interface if it was registered to this type, null otherwise.
This should not be used directly.
Definition at line 83 of file TypeSupport.h.
Referenced by mlir::TypeInterface< ConcreteType, Traits >::getInterfaceFor().
|
inline |
Return the unique name representing the type.
Definition at line 114 of file TypeSupport.h.
Referenced by mlir::irdl::BaseTypeConstraint::verify().
|
inline |
Return the unique identifier representing the concrete type class.
Definition at line 111 of file TypeSupport.h.
Returns true if the type has the interface with the given ID.
Definition at line 88 of file TypeSupport.h.
|
inline |
Returns true if the type has a particular trait.
Definition at line 94 of file TypeSupport.h.
References mlir::TypeID::get().
Referenced by get(), and mlir::Type::hasTrait().
Returns true if the type has a particular trait.
Definition at line 99 of file TypeSupport.h.
Register the type T with dialect.
Definition at line 307 of file TypeSupport.h.
References get(), insert(), and mlir::detail::TypeUniquer::registerType().
Referenced by insert().
|
static |
Look up the specified abstract type in the MLIRContext and return a reference to it if it exists.
Definition at line 1170 of file MLIRContext.cpp.
References mlir::MLIRContext::getImpl().
|
static |
Look up the specified abstract type in the MLIRContext and return a reference to it.
Definition at line 1156 of file MLIRContext.cpp.
Referenced by getBases(), mlir::detail::TypeUniquer::getWithTypeID(), and mlir::detail::TypeUniquer::registerType().
| Type AbstractType::replaceImmediateSubElements | ( | Type | type, |
| ArrayRef< Attribute > | replAttrs, | ||
| ArrayRef< Type > | replTypes ) const |
Replace the immediate sub-elements of the given type.
Definition at line 25 of file Types.cpp.
Referenced by mlir::Type::replaceImmediateSubElements().
| void AbstractType::walkImmediateSubElements | ( | Type | type, |
| function_ref< void(Attribute)> | walkAttrsFn, | ||
| function_ref< void(Type)> | walkTypesFn ) const |
Walk the immediate sub-elements of the given type.
Definition at line 19 of file Types.cpp.
Referenced by mlir::Type::walkImmediateSubElements().
|
friend |
Give StorageUserBase access to the mutable lookup.
Definition at line 135 of file TypeSupport.h.