MLIR
21.0.0git
|
A dynamic type instance. More...
#include "mlir/IR/ExtensibleDialect.h"
Public Types | |
using | Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits... > |
Utility declarations for the concrete attribute class. More... | |
![]() | |
using | Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits... > |
Utility declarations for the concrete attribute class. More... | |
using | ImplType = StorageT |
using | HasTraitFn = bool(*)(TypeID) |
Public Member Functions | |
DynamicTypeDefinition * | getTypeDef () |
Return the type definition of the concrete type. More... | |
ArrayRef< Attribute > | getParams () |
Return the type parameters. More... | |
void | print (AsmPrinter &printer) |
Print the dynamic type with the format 'type' or 'type<>' if there is no parameters, or 'type<attr (,attr)*>'. More... | |
![]() | |
ImplType * | getImpl () const |
Utility for easy access to the storage instance. More... | |
Static Public Member Functions | |
static DynamicType | get (DynamicTypeDefinition *typeDef, ArrayRef< Attribute > params={}) |
Return an instance of a dynamic type given a dynamic type definition and type parameters. More... | |
static DynamicType | getChecked (function_ref< InFlightDiagnostic()> emitError, DynamicTypeDefinition *typeDef, ArrayRef< Attribute > params={}) |
Return an instance of a dynamic type given a dynamic type definition and type parameters. More... | |
static bool | isa (Type type, DynamicTypeDefinition *typeDef) |
Check if a type is a specific dynamic type. More... | |
static bool | classof (Type type) |
Check if a type is a dynamic type. More... | |
static ParseResult | parse (AsmParser &parser, DynamicTypeDefinition *typeDef, DynamicType &parsedType) |
Parse the dynamic type parameters and construct the type. More... | |
![]() | |
static TypeID | getTypeID () |
Return a unique identifier for the concrete type. More... | |
template<typename T > | |
static bool | classof (T val) |
Provide an implementation of 'classof' that compares the type id of the provided value with that of the concrete type. More... | |
static detail::InterfaceMap | getInterfaceMap () |
Returns an interface map for the interfaces registered to this storage user. More... | |
static HasTraitFn | getHasTraitFn () |
Returns the function that returns true if the given Trait ID matches the IDs of any of the traits defined by the storage user. More... | |
static auto | getWalkImmediateSubElementsFn () |
Returns a function that walks immediate sub elements of a given instance of the storage user. More... | |
static auto | getReplaceImmediateSubElementsFn () |
Returns a function that replaces immediate sub elements of a given instance of the storage user. More... | |
template<typename... IfaceModels> | |
static void | attachInterface (MLIRContext &context) |
Attach the given models as implementations of the corresponding interfaces for the concrete storage user class. More... | |
template<typename... Args> | |
static ConcreteT | get (MLIRContext *ctx, Args &&...args) |
Get or create a new ConcreteT instance within the ctx. More... | |
template<typename... Args> | |
static ConcreteT | getChecked (const Location &loc, Args &&...args) |
Get or create a new ConcreteT instance within the ctx, defined at the given, potentially unknown, location. More... | |
template<typename... Args> | |
static ConcreteT | getChecked (function_ref< InFlightDiagnostic()> emitErrorFn, MLIRContext *ctx, Args... args) |
Get or create a new ConcreteT instance within the ctx. More... | |
static ConcreteT | getFromOpaquePointer (const void *ptr) |
Get an instance of the concrete type from a void pointer. More... | |
Additional Inherited Members | |
![]() | |
template<typename... Args> | |
LogicalResult | mutate (Args &&...args) |
Mutate the current storage instance. More... | |
![]() | |
template<typename... Args> | |
static LogicalResult | verifyInvariants (Args... args) |
Default implementation that just returns success. More... | |
A dynamic type instance.
This is a type whose definition is defined at runtime. It is possible to check if a type is a dynamic type using my_type.isa<DynamicType>()
, and getting the type definition of a dynamic type using the DynamicType::getTypeDef
method. All dynamic types have the same storage, which is an array of attributes.
Definition at line 312 of file ExtensibleDialect.h.
using mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::Base = StorageUserBase<ConcreteT, BaseT, StorageT, UniquerT, Traits...> |
Utility declarations for the concrete attribute class.
Definition at line 100 of file StorageUniquerSupport.h.
|
static |
Check if a type is a dynamic type.
Definition at line 151 of file ExtensibleDialect.cpp.
References mlir::Type::hasTrait().
|
static |
Return an instance of a dynamic type given a dynamic type definition and type parameters.
This asserts that the type verifier succeeded.
Definition at line 127 of file ExtensibleDialect.cpp.
References mlir::emitError(), mlir::DynamicTypeDefinition::getContext(), mlir::detail::getDefaultDiagnosticEmitFn(), mlir::SelfOwningTypeID::getTypeID(), and mlir::DynamicTypeDefinition::verify().
|
static |
Return an instance of a dynamic type given a dynamic type definition and type parameters.
If the parameters provided are invalid, errors are emitted using the provided location and a null object is returned.
Definition at line 137 of file ExtensibleDialect.cpp.
References mlir::emitError(), mlir::DynamicTypeDefinition::getContext(), mlir::SelfOwningTypeID::getTypeID(), and mlir::DynamicTypeDefinition::verify().
Return the type parameters.
Definition at line 149 of file ExtensibleDialect.cpp.
References mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getImpl().
Referenced by print().
DynamicTypeDefinition * DynamicType::getTypeDef | ( | ) |
Return the type definition of the concrete type.
Definition at line 147 of file ExtensibleDialect.cpp.
References mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getImpl().
Referenced by print().
|
inlinestatic |
Check if a type is a specific dynamic type.
Definition at line 339 of file ExtensibleDialect.h.
References mlir::Type::getTypeID(), and mlir::SelfOwningTypeID::getTypeID().
|
static |
Parse the dynamic type parameters and construct the type.
The parameters are either empty, and nothing is parsed, or they are in the format '<>' or '<attr (,attr)*>'.
Definition at line 155 of file ExtensibleDialect.cpp.
References mlir::AsmParser::getChecked().
Referenced by mlir::ExtensibleDialect::parseOptionalDynamicType().
void DynamicType::print | ( | AsmPrinter & | printer | ) |
Print the dynamic type with the format 'type' or 'type<>' if there is no parameters, or 'type<attr (,attr)*>'.
Definition at line 167 of file ExtensibleDialect.cpp.
References mlir::DynamicTypeDefinition::getName(), getParams(), and getTypeDef().