MLIR 22.0.0git
mlir::DynamicType Class Reference

A dynamic type instance. More...

#include "mlir/IR/ExtensibleDialect.h"

Inheritance diagram for mlir::DynamicType:

Public Member Functions

DynamicTypeDefinitiongetTypeDef ()
 Return the type definition of the concrete type.
ArrayRef< AttributegetParams ()
 Return the type parameters.
void print (AsmPrinter &printer)
 Print the dynamic type with the format 'type' or 'type<>' if there is no parameters, or 'type<attr (,attr)*>'.
Public Member Functions inherited from mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
ImplTypegetImpl () const
 Utility for easy access to the storage instance.

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.
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.
static bool isa (Type type, DynamicTypeDefinition *typeDef)
 Check if a type is a specific dynamic type.
static bool classof (Type type)
 Check if a type is a dynamic type.
static ParseResult parse (AsmParser &parser, DynamicTypeDefinition *typeDef, DynamicType &parsedType)
 Parse the dynamic type parameters and construct the type.
Static Public Member Functions inherited from mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
static TypeID getTypeID ()
 Return a unique identifier for the concrete type.
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.
static detail::InterfaceMap getInterfaceMap ()
 Returns an interface map for the interfaces registered to this storage user.
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.
static auto getWalkImmediateSubElementsFn ()
 Returns a function that walks immediate sub elements of a given instance of the storage user.
static auto getReplaceImmediateSubElementsFn ()
 Returns a function that replaces immediate sub elements of a given instance of the storage user.
static void attachInterface (MLIRContext &context)
 Attach the given models as implementations of the corresponding interfaces for the concrete storage user class.
static ConcreteType get (MLIRContext *ctx, Args &&...args)
 Get or create a new ConcreteT instance within the ctx.
static ConcreteType getChecked (const Location &loc, Args &&...args)
 Get or create a new ConcreteT instance within the ctx, defined at the given, potentially unknown, location.
static ConcreteType getChecked (function_ref< InFlightDiagnostic()> emitErrorFn, MLIRContext *ctx, Args... args)
 Get or create a new ConcreteT instance within the ctx.
static ConcreteType getFromOpaquePointer (const void *ptr)
 Get an instance of the concrete type from a void pointer.

Additional Inherited Members

Public Types inherited from mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
using Base
 Utility declarations for the concrete attribute class.
using ImplType
using HasTraitFn
Protected Member Functions inherited from mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
LogicalResult mutate (Args &&...args)
 Mutate the current storage instance.
Static Protected Member Functions inherited from mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
static LogicalResult verifyInvariants (Args... args)
 Default implementation that just returns success.

Detailed Description

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 isa<DynamicType>(myType), 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.

Member Function Documentation

◆ classof()

bool DynamicType::classof ( Type type)
static

Check if a type is a dynamic type.

Definition at line 150 of file ExtensibleDialect.cpp.

References mlir::Type::hasTrait().

◆ get()

DynamicType DynamicType::get ( DynamicTypeDefinition * typeDef,
ArrayRef< Attribute > params = {} )
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 126 of file ExtensibleDialect.cpp.

References mlir::emitError(), mlir::DynamicTypeDefinition::getContext(), mlir::detail::getDefaultDiagnosticEmitFn(), mlir::SelfOwningTypeID::getTypeID(), mlir::detail::TypeUniquer::getWithTypeID(), and mlir::DynamicTypeDefinition::verify().

◆ getChecked()

DynamicType DynamicType::getChecked ( function_ref< InFlightDiagnostic()> emitError,
DynamicTypeDefinition * typeDef,
ArrayRef< Attribute > params = {} )
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 136 of file ExtensibleDialect.cpp.

References mlir::emitError(), mlir::DynamicTypeDefinition::getContext(), mlir::SelfOwningTypeID::getTypeID(), mlir::detail::TypeUniquer::getWithTypeID(), and mlir::DynamicTypeDefinition::verify().

◆ getParams()

ArrayRef< Attribute > DynamicType::getParams ( )

◆ getTypeDef()

DynamicTypeDefinition * DynamicType::getTypeDef ( )

Return the type definition of the concrete type.

Definition at line 146 of file ExtensibleDialect.cpp.

References mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >::getImpl().

Referenced by print().

◆ isa()

bool mlir::DynamicType::isa ( Type type,
DynamicTypeDefinition * typeDef )
inlinestatic

Check if a type is a specific dynamic type.

Definition at line 339 of file ExtensibleDialect.h.

References mlir::SelfOwningTypeID::getTypeID(), and mlir::Type::getTypeID().

◆ parse()

ParseResult DynamicType::parse ( AsmParser & parser,
DynamicTypeDefinition * typeDef,
DynamicType & parsedType )
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 154 of file ExtensibleDialect.cpp.

References mlir::AsmParser::getChecked(), and success().

Referenced by mlir::ExtensibleDialect::parseOptionalDynamicType().

◆ print()

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 166 of file ExtensibleDialect.cpp.

References mlir::DynamicTypeDefinition::getName(), getParams(), and getTypeDef().


The documentation for this class was generated from the following files: