MLIR
20.0.0git
|
Utility class for implementing users of storage classes uniqued by a StorageUniquer. More...
#include "mlir/IR/StorageUniquerSupport.h"
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 | |
ImplType * | getImpl () 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... | |
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.
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.
using mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::HasTraitFn = bool (*)(TypeID) |
Definition at line 102 of file StorageUniquerSupport.h.
using mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::ImplType = StorageT |
Definition at line 101 of file StorageUniquerSupport.h.
|
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().
|
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().
|
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().
|
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().
|
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.
|
inlinestatic |
Get an instance of the concrete type from a void pointer.
Definition at line 207 of file StorageUniquerSupport.h.
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
inlinestaticprotected |
Default implementation that just returns success.
Definition at line 229 of file StorageUniquerSupport.h.