MLIR  20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits > Class Template Reference

Utility class for implementing users of storage classes uniqued by a StorageUniquer. More...

#include "mlir/IR/StorageUniquerSupport.h"

+ Inheritance diagram for mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >:

Public Types

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

ImplTypegetImpl () const
 Utility for easy access to the storage instance. More...
 

Static Public Member Functions

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...
 

Protected Member Functions

template<typename... Args>
LogicalResult mutate (Args &&...args)
 Mutate the current storage instance. More...
 

Static Protected Member Functions

template<typename... Args>
static LogicalResult verifyInvariants (Args... args)
 Default implementation that just returns success. More...
 

Detailed Description

template<typename ConcreteT, typename BaseT, typename StorageT, typename UniquerT, template< typename T > class... Traits>
class mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >

Utility class for implementing users of storage classes uniqued by a StorageUniquer.

Clients are not expected to interact with this class directly.

Definition at line 95 of file StorageUniquerSupport.h.

Member Typedef Documentation

◆ Base

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
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.

◆ HasTraitFn

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
using mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::HasTraitFn = bool (*)(TypeID)

Definition at line 102 of file StorageUniquerSupport.h.

◆ ImplType

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
using mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::ImplType = StorageT

Definition at line 101 of file StorageUniquerSupport.h.

Member Function Documentation

◆ attachInterface()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename... IfaceModels>
static void mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::attachInterface ( MLIRContext context)
inlinestatic

Attach the given models as implementations of the corresponding interfaces for the concrete storage user class.

The type must be registered with the context, i.e. the dialect to which the type belongs must be loaded. The call will abort otherwise.

Definition at line 155 of file StorageUniquerSupport.h.

References mlir::dialect_extension_detail::handleAdditionOfUndefinedPromisedInterface().

◆ classof()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename T >
static bool mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::classof ( val)
inlinestatic

Provide an implementation of 'classof' that compares the type id of the provided value with that of the concrete type.

Definition at line 110 of file StorageUniquerSupport.h.

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

◆ get()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename... Args>
static ConcreteT mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::get ( MLIRContext ctx,
Args &&...  args 
)
inlinestatic

Get or create a new ConcreteT instance within the ctx.

This function is guaranteed to return a non null object and will assert if the arguments provided are invalid.

Definition at line 177 of file StorageUniquerSupport.h.

References mlir::detail::getDefaultDiagnosticEmitFn().

Referenced by mlirGPUAsyncTokenTypeGet().

◆ getChecked() [1/2]

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename... Args>
static ConcreteT mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getChecked ( const Location loc,
Args &&...  args 
)
inlinestatic

Get or create a new ConcreteT instance within the ctx, defined at the given, potentially unknown, location.

If the arguments provided are invalid, errors are emitted using the provided location and a null object is returned.

Definition at line 189 of file StorageUniquerSupport.h.

References mlir::detail::getDefaultDiagnosticEmitFn().

◆ getChecked() [2/2]

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename... Args>
static ConcreteT mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getChecked ( function_ref< InFlightDiagnostic()>  emitErrorFn,
MLIRContext ctx,
Args...  args 
)
inlinestatic

Get or create a new ConcreteT instance within the ctx.

If the arguments provided are invalid, errors are emitted using the provided emitError and a null object is returned.

Definition at line 198 of file StorageUniquerSupport.h.

◆ getFromOpaquePointer()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
static ConcreteT mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getFromOpaquePointer ( const void *  ptr)
inlinestatic

Get an instance of the concrete type from a void pointer.

Definition at line 207 of file StorageUniquerSupport.h.

◆ getHasTraitFn()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
static HasTraitFn mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getHasTraitFn ( )
inlinestatic

Returns the function that returns true if the given Trait ID matches the IDs of any of the traits defined by the storage user.

Definition at line 124 of file StorageUniquerSupport.h.

References mlir::detail::storage_user_base_impl::hasTrait().

Referenced by mlir::ExtensibleDialect::registerDynamicAttr(), and mlir::ExtensibleDialect::registerDynamicType().

◆ getImpl()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
ImplType* mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getImpl ( ) const
inline

Utility for easy access to the storage instance.

Definition at line 212 of file StorageUniquerSupport.h.

Referenced by mlir::spirv::ImageType::getArrayedInfo(), mlir::spirv::ArrayType::getArrayStride(), mlir::spirv::RuntimeArrayType::getArrayStride(), mlir::DynamicAttr::getAttrDef(), mlir::LLVM::LLVMStructType::getBody(), mlir::spirv::VerCapExtAttr::getCapabilitiesAttr(), mlir::spirv::TargetEnvAttr::getClientAPI(), mlir::spirv::CooperativeMatrixType::getColumns(), mlir::spirv::MatrixType::getColumnType(), mlir::spirv::ImageType::getDepthInfo(), mlir::spirv::TargetEnvAttr::getDeviceID(), mlir::spirv::TargetEnvAttr::getDeviceType(), mlir::spirv::ImageType::getDim(), mlir::gpu::MMAMatrixType::getElementType(), mlir::spirv::ArrayType::getElementType(), mlir::spirv::ImageType::getElementType(), mlir::spirv::RuntimeArrayType::getElementType(), mlir::spirv::CooperativeMatrixType::getElementType(), mlir::spirv::MatrixType::getElementType(), mlir::spirv::StructType::getElementType(), mlir::spirv::StructType::getElementTypes(), mlir::spirv::VerCapExtAttr::getExtensionsAttr(), mlir::spirv::StructType::getIdentifier(), mlir::spirv::ImageType::getImageFormat(), mlir::spirv::SampledImageType::getImageType(), mlir::spirv::StructType::getMemberDecorations(), mlir::spirv::StructType::getMemberOffset(), mlir::LLVM::LLVMStructType::getName(), mlir::spirv::MatrixType::getNumColumns(), mlir::gpu::MMAMatrixType::getNumDims(), mlir::spirv::ArrayType::getNumElements(), mlir::spirv::StructType::getNumElements(), mlir::spirv::MatrixType::getNumElements(), mlir::spirv::MatrixType::getNumRows(), mlir::gpu::MMAMatrixType::getOperand(), mlir::DynamicAttr::getParams(), mlir::DynamicType::getParams(), mlir::spirv::PointerType::getPointeeType(), mlir::spirv::TargetEnvAttr::getResourceLimits(), mlir::spirv::CooperativeMatrixType::getRows(), mlir::spirv::ImageType::getSamplerUseInfo(), mlir::spirv::ImageType::getSamplingInfo(), mlir::spirv::CooperativeMatrixType::getScope(), mlir::gpu::MMAMatrixType::getShape(), mlir::spirv::PointerType::getStorageClass(), mlir::spirv::TargetEnvAttr::getTripleAttr(), mlir::DynamicType::getTypeDef(), mlir::spirv::CooperativeMatrixType::getUse(), mlir::spirv::TargetEnvAttr::getVendorID(), mlir::spirv::StructType::hasOffset(), mlir::LLVM::LLVMStructType::isIdentified(), mlir::spirv::StructType::isIdentified(), mlir::LLVM::LLVMStructType::isInitialized(), mlir::LLVM::LLVMStructType::isOpaque(), mlir::LLVM::LLVMStructType::isPacked(), and mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::mutate().

◆ getInterfaceMap()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
static detail::InterfaceMap mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getInterfaceMap ( )
inlinestatic

Returns an interface map for the interfaces registered to this storage user.

This should not be used directly.

Definition at line 118 of file StorageUniquerSupport.h.

Referenced by mlir::ExtensibleDialect::registerDynamicAttr(), and mlir::ExtensibleDialect::registerDynamicType().

◆ getReplaceImmediateSubElementsFn()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
static auto mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getReplaceImmediateSubElementsFn ( )
inlinestatic

Returns a function that replaces immediate sub elements of a given instance of the storage user.

Definition at line 142 of file StorageUniquerSupport.h.

References mlir::detail::replaceImmediateSubElementsImpl().

Referenced by mlir::ExtensibleDialect::registerDynamicAttr(), and mlir::ExtensibleDialect::registerDynamicType().

◆ getTypeID()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
static TypeID mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getTypeID ( )
inlinestatic

Return a unique identifier for the concrete type.

Definition at line 105 of file StorageUniquerSupport.h.

Referenced by mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::classof().

◆ getWalkImmediateSubElementsFn()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
static auto mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getWalkImmediateSubElementsFn ( )
inlinestatic

Returns a function that walks immediate sub elements of a given instance of the storage user.

Definition at line 132 of file StorageUniquerSupport.h.

References mlir::detail::walkImmediateSubElementsImpl().

Referenced by mlir::ExtensibleDialect::registerDynamicAttr(), and mlir::ExtensibleDialect::registerDynamicType().

◆ mutate()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename... Args>
LogicalResult mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::mutate ( Args &&...  args)
inlineprotected

Mutate the current storage instance.

This will not change the unique key. The arguments are forwarded to 'ConcreteT::mutate'.

Definition at line 218 of file StorageUniquerSupport.h.

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

◆ verifyInvariants()

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
template<typename... Args>
static LogicalResult mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::verifyInvariants ( Args...  args)
inlinestaticprotected

Default implementation that just returns success.

Definition at line 229 of file StorageUniquerSupport.h.


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