MLIR  14.0.0git
Public Types | 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 >:
Inheritance graph
[legend]
Collaboration diagram for mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >:
Collaboration graph
[legend]

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)
 

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...
 
ImplTypegetImpl () const
 Utility for easy access to the 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 84 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 89 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 91 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 90 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 123 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 98 of file StorageUniquerSupport.h.

References 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

◆ 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

◆ 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 157 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 166 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 112 of file StorageUniquerSupport.h.

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

◆ 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
inlineprotected

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

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

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

Referenced by mlir::LLVM::LLVMStructType::setBody().

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

References mlir::success().


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