MLIR  19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
mlir::DynamicType Class Reference

A dynamic type instance. More...

#include "mlir/IR/ExtensibleDialect.h"

+ Inheritance diagram for mlir::DynamicType:

Public Types

using Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits... >
 Utility declarations for the concrete attribute class. More...
 
- Public Types inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
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

DynamicTypeDefinitiongetTypeDef ()
 Return the type definition of the concrete type. More...
 
ArrayRef< AttributegetParams ()
 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...
 
- Public Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
ImplTypegetImpl () 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 Public Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
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

- Protected Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
template<typename... Args>
LogicalResult mutate (Args &&...args)
 Mutate the current storage instance. More...
 
- Static Protected Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
template<typename... Args>
static LogicalResult verify (Args... args)
 Default implementation that just returns success. More...
 

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 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 313 of file ExtensibleDialect.h.

Member Typedef Documentation

◆ Base

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 101 of file StorageUniquerSupport.h.

Member Function Documentation

◆ classof()

bool DynamicType::classof ( Type  type)
static

Check if a type is a dynamic type.

Definition at line 152 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 128 of file ExtensibleDialect.cpp.

References mlir::emitError(), mlir::DynamicTypeDefinition::getContext(), mlir::detail::getDefaultDiagnosticEmitFn(), mlir::SelfOwningTypeID::getTypeID(), mlir::succeeded(), 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 138 of file ExtensibleDialect.cpp.

References mlir::emitError(), mlir::failed(), mlir::DynamicTypeDefinition::getContext(), mlir::SelfOwningTypeID::getTypeID(), and mlir::DynamicTypeDefinition::verify().

◆ getParams()

ArrayRef< Attribute > DynamicType::getParams ( )

Return the type parameters.

Definition at line 150 of file ExtensibleDialect.cpp.

References mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getImpl().

Referenced by print().

◆ getTypeDef()

DynamicTypeDefinition * DynamicType::getTypeDef ( )

Return the type definition of the concrete type.

Definition at line 148 of file ExtensibleDialect.cpp.

References mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getImpl().

Referenced by print().

◆ isa()

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

Check if a type is a specific dynamic type.

Definition at line 340 of file ExtensibleDialect.h.

References mlir::Type::getTypeID(), and mlir::SelfOwningTypeID::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 156 of file ExtensibleDialect.cpp.

References mlir::failed(), mlir::failure(), mlir::AsmParser::getChecked(), and mlir::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 168 of file ExtensibleDialect.cpp.

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


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