9 #ifndef MLIR_CAPI_REGISTRATION_H
10 #define MLIR_CAPI_REGISTRATION_H
24 MlirDialectRegistry registry);
36 #define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName) \
37 static void mlirDialectRegistryInsert##Name##Dialect( \
38 MlirDialectRegistry registry) { \
39 unwrap(registry)->insert<ClassName>(); \
41 static MlirDialect mlirContextLoad##Name##Dialect(MlirContext context) { \
42 return wrap(unwrap(context)->getOrLoadDialect<ClassName>()); \
44 static MlirStringRef mlir##Name##DialectGetNamespace() { \
45 return wrap(ClassName::getDialectNamespace()); \
47 MlirDialectHandle mlirGetDialectHandle__##Namespace##__() { \
48 static MlirDialectRegistrationHooks hooks = { \
49 mlirDialectRegistryInsert##Name##Dialect, \
50 mlirContextLoad##Name##Dialect, mlir##Name##DialectGetNamespace}; \
51 return MlirDialectHandle{&hooks}; \
MlirStringRef(* MlirDialectGetNamespaceHook)()
MlirDialect(* MlirContextLoadDialectHook)(MlirContext context)
void(* MlirDialectRegistryInsertDialectHook)(MlirDialectRegistry registry)
Hooks for dynamic discovery of dialects.
struct MlirStringRef MlirStringRef
Structure of dialect registration hooks.
MlirDialectGetNamespaceHook getNamespaceHook
MlirContextLoadDialectHook loadHook
MlirDialectRegistryInsertDialectHook insertHook