LLVM 23.0.0git
Registry.h File Reference

Go to the source code of this file.

Classes

class  llvm::SimpleRegistryEntry< T, CtorParamTypes >
 A simple registry entry which provides only a name, description, and an CtorParamTypes&& variadic parameterized constructor. More...
struct  llvm::detail::IsRegistryType< R >
struct  llvm::detail::IsRegistryType< Registry< T, CtorParamTypes... > >
struct  llvm::detail::RegistryLinkListStorage< R >
 The endpoint to the instance to hold registered components by a linked list. More...
struct  llvm::detail::RegistryLinkListDeclarationMarker< R >
 Utility to guard against missing declarations or mismatched use of LLVM_DECLARE_REGISTRY and LLVM_INSTANTIATE_REGISTRY. More...
class  llvm::Registry< T, CtorParamTypes >
 A global registry used in conjunction with static constructors to make pluggable components (like targets or garbage collectors) "just work" when linked with an executable. More...
class  llvm::Registry< T, CtorParamTypes >::node
 Node in linked list of entries. More...
class  llvm::Registry< T, CtorParamTypes >::iterator
 Iterators for registry entries. More...
class  llvm::Registry< T, CtorParamTypes >::Add< V >
 A static registration template. More...

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
namespace  llvm::detail
 A self-contained host- and target-independent arbitrary-precision floating-point software implementation.

Macros

#define LLVM_DECLARE_REGISTRY(REGISTRY_CLASS)
 Helper macro to declare registry class.
#define LLVM_DEFINE_REGISTRY(REGISTRY_CLASS)
 Helper macro to define registry class.
#define LLVM_DETAIL_INSTANTIATE_REGISTRY_1(ABITAG, REGISTRY_CLASS)
#define LLVM_INSTANTIATE_REGISTRY(REGISTRY_CLASS)
 Old style helper macro to instantiate registry class.

Functions

template<typename R>
RegistryLinkListStorage< R > & llvm::detail::getRegistryLinkListInstance ()
 The accessor to the endpoint.

Macro Definition Documentation

◆ LLVM_DECLARE_REGISTRY

#define LLVM_DECLARE_REGISTRY ( REGISTRY_CLASS)
Value:
namespace llvm::detail { \
template <> \
struct RegistryLinkListDeclarationMarker<REGISTRY_CLASS> : std::true_type { \
}; \
template <> \
LLVM_ABI_EXPORT RegistryLinkListStorage<REGISTRY_CLASS> & \
getRegistryLinkListInstance<REGISTRY_CLASS>(); \
}
#define LLVM_ABI_EXPORT
Definition Compiler.h:216
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Definition ADL.h:123

Helper macro to declare registry class.

The LLVM_ABI_EXPORT (i.e. __delcpsec(dllexport) on Win32) attached to the declaration is mandatory since MSVC disallows adding dllexport after the first non-exported specialization declaration, and it is generally safe. All of link.exe, ld.bfd, and lld-link will attempt to import undefined symbols (including template specializations) from DLLs, even if the symbol is declared with dllexport, just like non-imported symbols. The dllimport attribute is not eligible here, since the specialization may or may not be defined in the same object, a static library, or an import library.

Definition at line 221 of file Registry.h.

◆ LLVM_DEFINE_REGISTRY

#define LLVM_DEFINE_REGISTRY ( REGISTRY_CLASS)
Value:
namespace llvm::detail { \
static_assert(RegistryLinkListDeclarationMarker<REGISTRY_CLASS>::value, \
"Missing matching registry delcaration of " #REGISTRY_CLASS \
". Place `LLVM_DECLARE_REGISTRY(" #REGISTRY_CLASS \
")` in a header."); \
template <> \
LLVM_ABI_EXPORT RegistryLinkListStorage<REGISTRY_CLASS> & \
getRegistryLinkListInstance<REGISTRY_CLASS>() { \
static RegistryLinkListStorage<REGISTRY_CLASS> Instance; \
return Instance; \
} \
}

Helper macro to define registry class.

Technically, these macros don't instantiate Registry despite the name. They handle underlying storage that used by Registry indirectly, enforcing proper declarations/definitions by compilers or linkers. If you forget to place LLVM_DEFINE_REGISTRY, your linker will complain about a missing getRegistryLinkListInstance definiton.

Definition at line 238 of file Registry.h.

◆ LLVM_DETAIL_INSTANTIATE_REGISTRY_1

#define LLVM_DETAIL_INSTANTIATE_REGISTRY_1 ( ABITAG,
REGISTRY_CLASS )
Value:
LLVM_DECLARE_REGISTRY(REGISTRY_CLASS) \
LLVM_DEFINE_REGISTRY(REGISTRY_CLASS) \
namespace llvm { \
template class ABITAG Registry<REGISTRY_CLASS::type>; \
static_assert(!REGISTRY_CLASS::HasCtorParamTypes, \
"LLVM_INSTANTIATE_REGISTRY can't be used with extra " \
"constructor parameter types. Use " \
"LLVM_DECLARE/DEFINE_REGISTRY istead."); \
}
#define LLVM_DECLARE_REGISTRY(REGISTRY_CLASS)
Helper macro to declare registry class.
Definition Registry.h:221
This is an optimization pass for GlobalISel generic memory operations.

Definition at line 252 of file Registry.h.

◆ LLVM_INSTANTIATE_REGISTRY

#define LLVM_INSTANTIATE_REGISTRY ( REGISTRY_CLASS)
Value:
#define LLVM_DETAIL_INSTANTIATE_REGISTRY_1(ABITAG, REGISTRY_CLASS)
Definition Registry.h:252

Old style helper macro to instantiate registry class.

Definition at line 269 of file Registry.h.