|
MLIR 24.0.0git
|
This is the implementation of the StorageUniquer class. More...
Classes | |
| struct | TransientState |
| Bundled state dynamically allocated when entering a transient scope. More... | |
Public Types | |
| using | BaseStorage = StorageUniquer::BaseStorage |
| using | StorageAllocator = StorageUniquer::StorageAllocator |
Public Member Functions | |
| bool | hasParametricStorage (TypeID id) |
| Check if an instance of a parametric storage class exists. | |
| BaseStorage * | getOrCreate (TypeID id, unsigned hashValue, function_ref< bool(const BaseStorage *)> isEqual, function_ref< BaseStorage *(StorageAllocator &)> ctorFn) |
| Get or create an instance of a parametric type. | |
| LogicalResult | mutate (TypeID id, BaseStorage *storage, function_ref< LogicalResult(StorageAllocator &)> mutationFn) |
| Run a mutation function on the provided storage object in a thread-safe way. | |
| StorageAllocator & | getThreadSafeAllocator () |
| Return an allocator that can be used to safely allocate instances on the current thread. | |
| void | beginTransientScope () |
| void | endTransientScope () |
| bool | isInTransientScope () const |
| BaseStorage * | getSingleton (TypeID id) |
| Get or create an instance of a singleton storage class. | |
| bool | hasSingleton (TypeID id) const |
| Check if an instance of a singleton storage class exists. | |
Public Attributes | |
| StorageAllocator | allocator |
| Main allocator used for uniquing singleton instances, and other state when thread safety is guaranteed. | |
| std::unique_ptr< TransientState > | transientState |
| Transient state bundled into a unique pointer (nullptr when inactive). | |
| DenseMap< TypeID, std::unique_ptr< ParametricStorageUniquer > > | parametricUniquers |
| Map of type ids to the storage uniquer to use for registered objects. | |
| DenseMap< TypeID, BaseStorage * > | singletonInstances |
| Map of type ids to a singleton instance when the storage class is a singleton. | |
| bool | threadingIsEnabled = true |
| Flag specifying if multi-threading is enabled within the uniquer. | |
This is the implementation of the StorageUniquer class.
Definition at line 343 of file StorageUniquer.cpp.
Definition at line 344 of file StorageUniquer.cpp.
Definition at line 345 of file StorageUniquer.cpp.
|
inline |
Definition at line 449 of file StorageUniquer.cpp.
References parametricUniquers, and transientState.
|
inline |
Definition at line 457 of file StorageUniquer.cpp.
References parametricUniquers, and transientState.
|
inline |
Get or create an instance of a parametric type.
Definition at line 376 of file StorageUniquer.cpp.
References getThreadSafeAllocator(), parametricUniquers, and threadingIsEnabled.
|
inline |
Get or create an instance of a singleton storage class.
Definition at line 473 of file StorageUniquer.cpp.
References singletonInstances, and transientState.
|
inline |
Return an allocator that can be used to safely allocate instances on the current thread.
Definition at line 402 of file StorageUniquer.cpp.
References allocator, threadingIsEnabled, and transientState.
Referenced by getOrCreate(), and mutate().
Check if an instance of a parametric storage class exists.
Definition at line 372 of file StorageUniquer.cpp.
References parametricUniquers.
Check if an instance of a singleton storage class exists.
Definition at line 485 of file StorageUniquer.cpp.
References singletonInstances, and transientState.
|
inline |
Definition at line 466 of file StorageUniquer.cpp.
References transientState.
|
inline |
Run a mutation function on the provided storage object in a thread-safe way.
Definition at line 390 of file StorageUniquer.cpp.
References getThreadSafeAllocator(), parametricUniquers, and threadingIsEnabled.
| StorageAllocator mlir::detail::StorageUniquerImpl::allocator |
Main allocator used for uniquing singleton instances, and other state when thread safety is guaranteed.
Definition at line 509 of file StorageUniquer.cpp.
Referenced by getThreadSafeAllocator().
| DenseMap<TypeID, std::unique_ptr<ParametricStorageUniquer> > mlir::detail::StorageUniquerImpl::parametricUniquers |
Map of type ids to the storage uniquer to use for registered objects.
Definition at line 516 of file StorageUniquer.cpp.
Referenced by beginTransientScope(), endTransientScope(), getOrCreate(), hasParametricStorage(), and mutate().
| DenseMap<TypeID, BaseStorage *> mlir::detail::StorageUniquerImpl::singletonInstances |
Map of type ids to a singleton instance when the storage class is a singleton.
Definition at line 520 of file StorageUniquer.cpp.
Referenced by getSingleton(), and hasSingleton().
Flag specifying if multi-threading is enabled within the uniquer.
Definition at line 523 of file StorageUniquer.cpp.
Referenced by getOrCreate(), getThreadSafeAllocator(), and mutate().
| std::unique_ptr<TransientState> mlir::detail::StorageUniquerImpl::transientState |
Transient state bundled into a unique pointer (nullptr when inactive).
Definition at line 512 of file StorageUniquer.cpp.
Referenced by beginTransientScope(), endTransientScope(), getSingleton(), getThreadSafeAllocator(), hasSingleton(), and isInTransientScope().