MLIR
20.0.0git
|
The definition of a dynamic type. More...
#include "mlir/IR/ExtensibleDialect.h"
Public Types | |
using | VerifierFn = llvm::unique_function< LogicalResult(function_ref< InFlightDiagnostic()>, ArrayRef< Attribute >) const > |
using | ParserFn = llvm::unique_function< ParseResult(AsmParser &parser, llvm::SmallVectorImpl< Attribute > &parsedAttributes) const > |
using | PrinterFn = llvm::unique_function< void(AsmPrinter &printer, ArrayRef< Attribute > params) const > |
Public Member Functions | |
void | setVerifyFn (VerifierFn &&verify) |
Sets the verifier function for this type. More... | |
void | setParseFn (ParserFn &&parse) |
Sets the static hook for parsing this type assembly. More... | |
void | setPrintFn (PrinterFn &&print) |
Sets the static hook for printing this type assembly. More... | |
LogicalResult | verify (function_ref< InFlightDiagnostic()> emitError, ArrayRef< Attribute > params) const |
Check that the type parameters are valid. More... | |
MLIRContext & | getContext () const |
Return the MLIRContext in which the dynamic types is uniqued. More... | |
StringRef | getName () const |
Return the name of the type, in the format 'typename' and not 'dialectname.typename'. More... | |
ExtensibleDialect * | getDialect () const |
Return the dialect defining the type. More... | |
Public Member Functions inherited from mlir::SelfOwningTypeID | |
SelfOwningTypeID ()=default | |
SelfOwningTypeID (const SelfOwningTypeID &)=delete | |
SelfOwningTypeID & | operator= (const SelfOwningTypeID &)=delete |
SelfOwningTypeID (SelfOwningTypeID &&)=delete | |
SelfOwningTypeID & | operator= (SelfOwningTypeID &&)=delete |
operator TypeID () const | |
Implicitly converts to the owned TypeID. More... | |
TypeID | getTypeID () const |
Return the TypeID owned by this object. More... | |
Static Public Member Functions | |
static std::unique_ptr< DynamicTypeDefinition > | get (StringRef name, ExtensibleDialect *dialect, VerifierFn &&verifier) |
Create a new dynamic type definition. More... | |
static std::unique_ptr< DynamicTypeDefinition > | get (StringRef name, ExtensibleDialect *dialect, VerifierFn &&verifier, ParserFn &&parser, PrinterFn &&printer) |
The definition of a dynamic type.
A dynamic type is a type that is defined at runtime, and that can be registered at runtime by an extensible dialect (a dialect inheriting ExtensibleDialect). This class stores the parser, the printer, and the verifier of the type. Each dynamic type definition refers to one instance of this class.
Definition at line 212 of file ExtensibleDialect.h.
using mlir::DynamicTypeDefinition::ParserFn = llvm::unique_function<ParseResult( AsmParser &parser, llvm::SmallVectorImpl<Attribute> &parsedAttributes) const> |
Definition at line 216 of file ExtensibleDialect.h.
using mlir::DynamicTypeDefinition::PrinterFn = llvm::unique_function<void( AsmPrinter &printer, ArrayRef<Attribute> params) const> |
Definition at line 219 of file ExtensibleDialect.h.
using mlir::DynamicTypeDefinition::VerifierFn = llvm::unique_function<LogicalResult( function_ref<InFlightDiagnostic()>, ArrayRef<Attribute>) const> |
Definition at line 214 of file ExtensibleDialect.h.
|
static |
Create a new dynamic type definition.
The type is registered only after passing it to the dialect using registerDynamicType.
Definition at line 60 of file ExtensibleDialect.cpp.
References typeOrAttrParser(), and typeOrAttrPrinter().
Referenced by preallocateTypeDefs(), and mlir::ExtensibleDialect::registerDynamicType().
|
static |
Definition at line 67 of file ExtensibleDialect.cpp.
|
inline |
Return the MLIRContext in which the dynamic types is uniqued.
Definition at line 248 of file ExtensibleDialect.h.
Referenced by mlir::DynamicType::get(), and mlir::DynamicType::getChecked().
|
inline |
Return the dialect defining the type.
Definition at line 255 of file ExtensibleDialect.h.
Referenced by mlir::irdl::DynParametricTypeConstraint::verify().
|
inline |
Return the name of the type, in the format 'typename' and not 'dialectname.typename'.
Definition at line 252 of file ExtensibleDialect.h.
Referenced by mlir::DynamicType::print(), mlir::ExtensibleDialect::registerDynamicType(), and mlir::irdl::DynParametricTypeConstraint::verify().
|
inline |
Sets the static hook for parsing this type assembly.
Definition at line 236 of file ExtensibleDialect.h.
References mlir::query::parse().
|
inline |
Sets the static hook for printing this type assembly.
Definition at line 239 of file ExtensibleDialect.h.
References print().
|
inline |
Sets the verifier function for this type.
It should emits an error message and returns failure if a problem is detected, or returns success if everything is ok.
Definition at line 233 of file ExtensibleDialect.h.
References verify().
|
inline |
Check that the type parameters are valid.
Definition at line 242 of file ExtensibleDialect.h.
References mlir::emitError().
Referenced by mlir::DynamicType::get(), mlir::DynamicType::getChecked(), and setVerifyFn().