MLIR  19.0.0git
Static Public Member Functions | List of all members
mlir::detail::TypeUniquer Struct Reference

A utility class to get, or create, unique instances of types within an MLIRContext. More...

#include "mlir/IR/TypeSupport.h"

Static Public Member Functions

template<typename T , typename... Args>
static T get (MLIRContext *ctx, Args &&...args)
 Get an uniqued instance of a type T. More...
 
template<typename T , typename... Args>
static std::enable_if_t< !std::is_same< typename T::ImplType, TypeStorage >::value, T > getWithTypeID (MLIRContext *ctx, TypeID typeID, Args &&...args)
 Get an uniqued instance of a parametric type T. More...
 
template<typename T >
static std::enable_if_t< std::is_same< typename T::ImplType, TypeStorage >::value, T > getWithTypeID (MLIRContext *ctx, TypeID typeID)
 Get an uniqued instance of a singleton type T. More...
 
template<typename T , typename... Args>
static LogicalResult mutate (MLIRContext *ctx, typename T::ImplType *impl, Args &&...args)
 Change the mutable component of the given type instance in the provided context. More...
 
template<typename T >
static void registerType (MLIRContext *ctx)
 Register a type instance T with the uniquer. More...
 
template<typename T >
static std::enable_if_t< !std::is_same< typename T::ImplType, TypeStorage >::value > registerType (MLIRContext *ctx, TypeID typeID)
 Register a parametric type instance T with the uniquer. More...
 
template<typename T >
static std::enable_if_t< std::is_same< typename T::ImplType, TypeStorage >::value > registerType (MLIRContext *ctx, TypeID typeID)
 Register a singleton type instance T with the uniquer. More...
 

Detailed Description

A utility class to get, or create, unique instances of types within an MLIRContext.

This class manages all creation and uniquing of types.

Definition at line 210 of file TypeSupport.h.

Member Function Documentation

◆ get()

template<typename T , typename... Args>
static T mlir::detail::TypeUniquer::get ( MLIRContext ctx,
Args &&...  args 
)
inlinestatic

Get an uniqued instance of a type T.

Definition at line 213 of file TypeSupport.h.

References getWithTypeID().

◆ getWithTypeID() [1/2]

template<typename T >
static std::enable_if_t< std::is_same<typename T::ImplType, TypeStorage>::value, T> mlir::detail::TypeUniquer::getWithTypeID ( MLIRContext ctx,
TypeID  typeID 
)
inlinestatic

Get an uniqued instance of a singleton type T.

The use of this method is in general discouraged in favor of 'get<T, Args>(ctx, args)'.

Definition at line 245 of file TypeSupport.h.

References mlir::StorageUniquer::get(), mlir::MLIRContext::getTypeUniquer(), and mlir::StorageUniquer::isSingletonStorageInitialized().

◆ getWithTypeID() [2/2]

template<typename T , typename... Args>
static std::enable_if_t< !std::is_same<typename T::ImplType, TypeStorage>::value, T> mlir::detail::TypeUniquer::getWithTypeID ( MLIRContext ctx,
TypeID  typeID,
Args &&...  args 
)
inlinestatic

Get an uniqued instance of a parametric type T.

The use of this method is in general discouraged in favor of 'get<T, Args>(ctx, args)'.

Definition at line 224 of file TypeSupport.h.

References mlir::StorageUniquer::get(), mlir::MLIRContext::getTypeUniquer(), mlir::StorageUniquer::isParametricStorageInitialized(), and mlir::AbstractType::lookup().

Referenced by get().

◆ mutate()

template<typename T , typename... Args>
static LogicalResult mlir::detail::TypeUniquer::mutate ( MLIRContext ctx,
typename T::ImplType *  impl,
Args &&...  args 
)
inlinestatic

Change the mutable component of the given type instance in the provided context.

Definition at line 260 of file TypeSupport.h.

References mlir::MLIRContext::getTypeUniquer(), and mlir::StorageUniquer::mutate().

◆ registerType() [1/3]

template<typename T >
static void mlir::detail::TypeUniquer::registerType ( MLIRContext ctx)
inlinestatic

Register a type instance T with the uniquer.

Definition at line 269 of file TypeSupport.h.

◆ registerType() [2/3]

template<typename T >
static std::enable_if_t< !std::is_same<typename T::ImplType, TypeStorage>::value> mlir::detail::TypeUniquer::registerType ( MLIRContext ctx,
TypeID  typeID 
)
inlinestatic

Register a parametric type instance T with the uniquer.

The use of this method is in general discouraged in favor of 'registerType<T>(ctx)'.

Definition at line 279 of file TypeSupport.h.

References mlir::MLIRContext::getTypeUniquer(), and mlir::StorageUniquer::registerParametricStorageType().

◆ registerType() [3/3]

template<typename T >
static std::enable_if_t< std::is_same<typename T::ImplType, TypeStorage>::value> mlir::detail::TypeUniquer::registerType ( MLIRContext ctx,
TypeID  typeID 
)
inlinestatic

Register a singleton type instance T with the uniquer.

The use of this method is in general discouraged in favor of 'registerType<T>(ctx)'.

Definition at line 289 of file TypeSupport.h.

References mlir::MLIRContext::getTypeUniquer(), mlir::AbstractType::lookup(), and mlir::StorageUniquer::registerSingletonStorageType().


The documentation for this struct was generated from the following file: