MLIR 22.0.0git
DialectHandle.cpp
Go to the documentation of this file.
1//===- DialectHandle.cpp - C Interface for MLIR Dialect Operations -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11static inline const MlirDialectRegistrationHooks *
13 return (const MlirDialectRegistrationHooks *)handle.ptr;
14}
15
19
21 MlirDialectRegistry registry) {
22 unwrap(handle)->insertHook(registry);
23}
24
26 MlirContext ctx) {
27 mlir::DialectRegistry registry;
28 mlirDialectHandleInsertDialect(handle, wrap(&registry));
29 unwrap(ctx)->appendDialectRegistry(registry);
30}
31
33 MlirContext ctx) {
34 return unwrap(handle)->loadHook(ctx);
35}
MlirDialect mlirDialectHandleLoadDialect(MlirDialectHandle handle, MlirContext ctx)
Loads the dialect associated with the provided dialect handle.
void mlirDialectHandleInsertDialect(MlirDialectHandle handle, MlirDialectRegistry registry)
Inserts the dialect associated with the provided dialect handle into the provided dialect registry.
void mlirDialectHandleRegisterDialect(MlirDialectHandle handle, MlirContext ctx)
Registers the dialect associated with the provided dialect handle.
static const MlirDialectRegistrationHooks * unwrap(MlirDialectHandle handle)
MlirStringRef mlirDialectHandleGetNamespace(MlirDialectHandle handle)
Returns the namespace associated with the provided dialect handle.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition Diagnostics.h:24
Structure of dialect registration hooks.
MlirDialectGetNamespaceHook getNamespaceHook
MlirContextLoadDialectHook loadHook
MlirDialectRegistryInsertDialectHook insertHook
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:73