MLIR
20.0.0git
|
A utility class to get or create instances of "storage classes". More...
#include "mlir/Support/StorageUniquer.h"
Classes | |
class | BaseStorage |
This class acts as the base storage that all storage classes must derived from. More... | |
class | StorageAllocator |
This is a utility allocator used to allocate memory for instances of derived types. More... | |
Public Member Functions | |
StorageUniquer () | |
~StorageUniquer () | |
void | disableMultithreading (bool disable=true) |
Set the flag specifying if multi-threading is disabled within the uniquer. More... | |
template<typename Storage > | |
void | registerParametricStorageType (TypeID id) |
Register a new parametric storage class, this is necessary to create instances of this class type. More... | |
template<typename Storage > | |
void | registerParametricStorageType () |
Utility override when the storage type represents the type id. More... | |
template<typename Storage > | |
void | registerSingletonStorageType (TypeID id, function_ref< void(Storage *)> initFn) |
Register a new singleton storage class, this is necessary to get the singletone instance. More... | |
template<typename Storage > | |
void | registerSingletonStorageType (TypeID id) |
template<typename Storage > | |
void | registerSingletonStorageType (function_ref< void(Storage *)> initFn={}) |
Utility override when the storage type represents the type id. More... | |
template<typename Storage , typename... Args> | |
Storage * | get (function_ref< void(Storage *)> initFn, TypeID id, Args &&...args) |
Gets a uniqued instance of 'Storage'. More... | |
template<typename Storage , typename... Args> | |
Storage * | get (function_ref< void(Storage *)> initFn, Args &&...args) |
Utility override when the storage type represents the type id. More... | |
template<typename Storage > | |
Storage * | get (TypeID id) |
Gets a uniqued instance of 'Storage' which is a singleton storage type. More... | |
template<typename Storage > | |
Storage * | get () |
Utility override when the storage type represents the type id. More... | |
bool | isSingletonStorageInitialized (TypeID id) |
Test if there is a singleton storage uniquer initialized for the provided TypeID. More... | |
bool | isParametricStorageInitialized (TypeID id) |
Test if there is a parametric storage uniquer initialized for the provided TypeID. More... | |
template<typename Storage , typename... Args> | |
LogicalResult | mutate (TypeID id, Storage *storage, Args &&...args) |
Changes the mutable component of 'storage' by forwarding the trailing arguments to the 'mutate' function of the derived class. More... | |
A utility class to get or create instances of "storage classes".
These storage classes must derive from 'StorageUniquer::BaseStorage'.
For non-parametric storage classes, i.e. singleton classes, nothing else is needed. Instances of these classes can be created by calling get
without trailing arguments.
Otherwise, the parametric storage classes may be created with get
, and must respect the following:
Storage classes may have an optional mutable component, which must not take part in the unique immutable key. In this case, storage classes may be mutated with mutate
and must additionally respect the following:
All storage classes must be registered with the uniquer via registerParametricStorageType
or registerSingletonStorageType
using an appropriate unique TypeID
for the storage class.
Definition at line 82 of file StorageUniquer.h.
StorageUniquer::StorageUniquer | ( | ) |
Definition at line 361 of file StorageUniquer.cpp.
|
default |
void StorageUniquer::disableMultithreading | ( | bool | disable = true | ) |
Set the flag specifying if multi-threading is disabled within the uniquer.
Definition at line 365 of file StorageUniquer.cpp.
|
inline |
Utility override when the storage type represents the type id.
Definition at line 235 of file StorageUniquer.h.
|
inline |
Utility override when the storage type represents the type id.
Definition at line 222 of file StorageUniquer.h.
|
inline |
Gets a uniqued instance of 'Storage'.
'id' is the type id used when registering the storage instance. 'initFn' is an optional parameter that can be used to initialize a newly inserted storage instance. This function is used for derived types that have complex storage or uniquing constraints.
Definition at line 195 of file StorageUniquer.h.
Referenced by mlir::AffineExpr::ceilDiv(), mlir::AffineExpr::floorDiv(), mlir::pdll::ast::AttributeType::get(), mlir::pdll::ast::ConstraintType::get(), mlir::pdll::ast::RewriteType::get(), mlir::pdll::ast::TypeType::get(), mlir::pdll::ast::ValueType::get(), mlir::pdll::ast::TupleType::get(), mlir::pdll::ast::OperationType::get(), mlir::pdll::ast::RangeType::get(), mlir::pdl_to_pdl_interp::PredicateBase< ConcreteT, BaseT, void, Kind >::get(), mlir::GenericLatticeAnchorBase< ConcreteT, Value >::get(), mlir::pdl_to_pdl_interp::PredicateBase< ConcreteT, BaseT, Key, Kind >::get(), mlir::getAffineConstantExpr(), getAffineDimOrSymbol(), mlir::DataFlowSolver::getProgramPointAfter(), mlir::DataFlowSolver::getProgramPointBefore(), mlir::detail::AttributeUniquer::getWithTypeID(), mlir::detail::TypeUniquer::getWithTypeID(), mlir::AffineExpr::operator%(), mlir::AffineExpr::operator*(), and mlir::AffineExpr::operator+().
|
inline |
Gets a uniqued instance of 'Storage' which is a singleton storage type.
'id' is the type id used when registering the storage instance.
Definition at line 230 of file StorageUniquer.h.
bool StorageUniquer::isParametricStorageInitialized | ( | TypeID | id | ) |
Test if there is a parametric storage uniquer initialized for the provided TypeID.
Test is the parametric storage is initialized.
This is only useful for debugging/diagnostic purpose: the uniquer is initialized when a dialect is loaded.
Definition at line 398 of file StorageUniquer.cpp.
Referenced by mlir::detail::AttributeUniquer::getWithTypeID(), and mlir::detail::TypeUniquer::getWithTypeID().
bool StorageUniquer::isSingletonStorageInitialized | ( | TypeID | id | ) |
Test if there is a singleton storage uniquer initialized for the provided TypeID.
Test is the storage singleton is initialized.
This is only useful for debugging/diagnostic purpose: the uniquer is initialized when a dialect is loaded.
Definition at line 393 of file StorageUniquer.cpp.
Referenced by mlir::detail::AttributeUniquer::getWithTypeID(), and mlir::detail::TypeUniquer::getWithTypeID().
|
inline |
Changes the mutable component of 'storage' by forwarding the trailing arguments to the 'mutate' function of the derived class.
Definition at line 252 of file StorageUniquer.h.
Referenced by mlir::detail::AttributeUniquer::mutate(), and mlir::detail::TypeUniquer::mutate().
|
inline |
Utility override when the storage type represents the type id.
Definition at line 160 of file StorageUniquer.h.
|
inline |
Register a new parametric storage class, this is necessary to create instances of this class type.
id
is the type identifier that will be used to identify this type when creating instances of it via 'get'.
Definition at line 149 of file StorageUniquer.h.
Referenced by mlir::pdll::ast::Context::Context(), mlir::DataFlowSolver::DataFlowSolver(), mlir::DataFlowAnalysis::registerAnchorKind(), mlir::detail::AttributeUniquer::registerAttribute(), and mlir::detail::TypeUniquer::registerType().
|
inline |
Utility override when the storage type represents the type id.
Definition at line 185 of file StorageUniquer.h.
|
inline |
Definition at line 180 of file StorageUniquer.h.
|
inline |
Register a new singleton storage class, this is necessary to get the singletone instance.
id
is the type identifier that will be used to access the singleton instance via 'get'. An optional initialization function may also be provided to initialize the newly created storage instance, and used when the singleton instance is created.
Definition at line 169 of file StorageUniquer.h.
Referenced by mlir::pdll::ast::Context::Context(), mlir::detail::AttributeUniquer::registerAttribute(), and mlir::detail::TypeUniquer::registerType().