MLIR  21.0.0git
Classes | Namespaces | Macros | Functions
TypeID.h File Reference
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/TypeName.h"

Go to the source code of this file.

Classes

class  mlir::TypeID
 This class provides an efficient unique identifier for a specific C++ type. More...
 
class  mlir::detail::FallbackTypeIDResolver
 This class provides a fallback for resolving TypeIDs. More...
 
struct  mlir::detail::is_fully_resolved_t< T >
 
class  mlir::detail::TypeIDResolver< T, Enable >
 This class provides a resolver for getting the ID for a given class T. More...
 
struct  mlir::detail::InlineTypeIDResolver
 This class provides utilities for resolving the TypeID of a class that provides a static TypeID resolveTypeID() method. More...
 
class  mlir::detail::TypeIDResolver< T, std::enable_if_t< InlineTypeIDResolver::has_resolve_typeid< T >::value > >
 This class provides a resolver for getting the ID for a given class T, when the class provides a static TypeID resolveTypeID() method. More...
 
class  mlir::TypeIDAllocator
 This class provides a way to define new TypeIDs at runtime. More...
 
class  mlir::SelfOwningTypeID
 Defines a TypeID for each instance of this class by using a pointer to the instance. More...
 
struct  llvm::DenseMapInfo< mlir::TypeID >
 
struct  llvm::PointerLikeTypeTraits< mlir::TypeID >
 We align TypeID::Storage by 8, so allow LLVM to steal the low bits. More...
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::detail
 AttrTypeReplacer.
 
 llvm
 The OpAsmOpInterface, see OpAsmInterface.td for more details.
 

Macros

#define MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
 
#define MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
 
#define MLIR_DECLARE_EXPLICIT_FALLBACK_TYPE_ID(CLASS_NAME)
 Declare/define an explicit specialization for TypeID using the string comparison fallback. More...
 
#define MLIR_DEFINE_EXPLICIT_FALLBACK_TYPE_ID(CLASS_NAME)
 
#define MLIR_USE_FALLBACK_TYPE_IDS   false
 
#define MLIR_DECLARE_EXPLICIT_TYPE_ID(CLASS_NAME)    MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
 
#define MLIR_DEFINE_EXPLICIT_TYPE_ID(CLASS_NAME)    MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
 
#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CLASS_NAME)
 

Functions

inline ::llvm::hash_code mlir::hash_value (TypeID id)
 Enable hashing TypeID. More...
 
template<typename T >
constexpr bool mlir::detail::is_fully_resolved ()
 

Macro Definition Documentation

◆ MLIR_DECLARE_EXPLICIT_FALLBACK_TYPE_ID

#define MLIR_DECLARE_EXPLICIT_FALLBACK_TYPE_ID (   CLASS_NAME)
Value:
namespace mlir { \
namespace detail { \
template <> \
class TypeIDResolver<CLASS_NAME> : public FallbackTypeIDResolver { \
public: \
static TypeID resolveTypeID() { \
static_assert(is_fully_resolved<CLASS_NAME>(), \
"TypeID::get<> requires the complete definition of `T`"); \
static TypeID id = \
registerImplicitTypeID(llvm::getTypeName<CLASS_NAME>()); \
return id; \
} \
}; \
} /* namespace detail */ \
} /* namespace mlir */
Include the generated interface declarations.

Declare/define an explicit specialization for TypeID using the string comparison fallback.

This is useful for complex shared library setups where it may be difficult to agree on a source of truth for specific type ID resolution. As long as there is a single resolution for registerImplicitTypeID, all type IDs can be reference a shared registration. This way types which are logically shared across multiple DSOs can have the same type ID, even if their definitions are duplicated.

Definition at line 291 of file TypeID.h.

◆ MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID

#define MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID (   CLASS_NAME)
Value:
namespace mlir { \
namespace detail { \
template <> \
class TypeIDResolver<CLASS_NAME> { \
public: \
static TypeID resolveTypeID() { return id; } \
\
private: \
static SelfOwningTypeID id; \
}; \
} /* namespace detail */ \
} /* namespace mlir */

Definition at line 262 of file TypeID.h.

◆ MLIR_DECLARE_EXPLICIT_TYPE_ID

#define MLIR_DECLARE_EXPLICIT_TYPE_ID (   CLASS_NAME)     MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)

Definition at line 321 of file TypeID.h.

◆ MLIR_DEFINE_EXPLICIT_FALLBACK_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_FALLBACK_TYPE_ID (   CLASS_NAME)

Definition at line 308 of file TypeID.h.

◆ MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID (   CLASS_NAME)
Value:
static ::mlir::TypeID resolveTypeID() { \
static ::mlir::SelfOwningTypeID id; \
return id; \
} \
static_assert( \
CLASS_NAME>::value, \
"`MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID` must be placed in a " \
"public section of `" #CLASS_NAME "`");
llvm::is_detected< has_resolve_typeid_trait, T > has_resolve_typeid
Definition: TypeID.h:224

Definition at line 331 of file TypeID.h.

◆ MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID (   CLASS_NAME)
Value:
namespace mlir { \
namespace detail { \
SelfOwningTypeID TypeIDResolver<CLASS_NAME>::id = {}; \
} /* namespace detail */ \
} /* namespace mlir */

Definition at line 276 of file TypeID.h.

◆ MLIR_DEFINE_EXPLICIT_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_TYPE_ID (   CLASS_NAME)     MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)

Definition at line 323 of file TypeID.h.

◆ MLIR_USE_FALLBACK_TYPE_IDS

#define MLIR_USE_FALLBACK_TYPE_IDS   false

Definition at line 312 of file TypeID.h.