[BOLT] Add --pad-funcs-before=func:n (#117924)
[llvm-project.git] / mlir / lib / CAPI / IR / DialectHandle.cpp
blob19f64d9482179e575ac1ed949323c9d0099fcf9c
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 //===----------------------------------------------------------------------===//
9 #include "mlir/CAPI/Registration.h"
11 static inline const MlirDialectRegistrationHooks *
12 unwrap(MlirDialectHandle handle) {
13 return (const MlirDialectRegistrationHooks *)handle.ptr;
16 MlirStringRef mlirDialectHandleGetNamespace(MlirDialectHandle handle) {
17 return unwrap(handle)->getNamespaceHook();
20 void mlirDialectHandleInsertDialect(MlirDialectHandle handle,
21 MlirDialectRegistry registry) {
22 unwrap(handle)->insertHook(registry);
25 void mlirDialectHandleRegisterDialect(MlirDialectHandle handle,
26 MlirContext ctx) {
27 mlir::DialectRegistry registry;
28 mlirDialectHandleInsertDialect(handle, wrap(&registry));
29 unwrap(ctx)->appendDialectRegistry(registry);
32 MlirDialect mlirDialectHandleLoadDialect(MlirDialectHandle handle,
33 MlirContext ctx) {
34 return unwrap(handle)->loadHook(ctx);