MLIR  16.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 >:
+ Collaboration 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...
 
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 verify (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 94 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 99 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 101 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 100 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 134 of file StorageUniquerSupport.h.

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

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

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

References mlir::detail::getDefaultDiagnosticEmitFn(), mlir::succeeded(), and mlir::verify().

◆ 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 162 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 170 of file StorageUniquerSupport.h.

References mlir::failed(), and mlir::verify().

◆ 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 179 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 123 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 184 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::CooperativeMatrixNVType::getColumns(), mlir::spirv::JointMatrixINTELType::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::CooperativeMatrixNVType::getElementType(), mlir::spirv::JointMatrixINTELType::getElementType(), mlir::spirv::MatrixType::getElementType(), mlir::spirv::StructType::getElementType(), mlir::spirv::StructType::getElementTypes(), mlir::DataLayoutSpecAttr::getEntries(), mlir::spirv::VerCapExtAttr::getExtensionsAttr(), mlir::spirv::StructType::getIdentifier(), mlir::spirv::ImageType::getImageFormat(), mlir::spirv::SampledImageType::getImageType(), mlir::DataLayoutEntryAttr::getKey(), mlir::spirv::JointMatrixINTELType::getMatrixLayout(), 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::CooperativeMatrixNVType::getRows(), mlir::spirv::JointMatrixINTELType::getRows(), mlir::spirv::ImageType::getSamplerUseInfo(), mlir::spirv::ImageType::getSamplingInfo(), mlir::spirv::CooperativeMatrixNVType::getScope(), mlir::spirv::JointMatrixINTELType::getScope(), mlir::gpu::MMAMatrixType::getShape(), mlir::spirv::PointerType::getStorageClass(), mlir::spirv::TargetEnvAttr::getTripleAttr(), mlir::DynamicType::getTypeDef(), mlir::DataLayoutEntryAttr::getValue(), 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 117 of file StorageUniquerSupport.h.

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

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

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

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

◆ verify()

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 >::verify ( Args...  args)
inlinestaticprotected

Default implementation that just returns success.

Definition at line 201 of file StorageUniquerSupport.h.

References mlir::success().


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