You've already forked llvm-project
mirror of
https://github.com/AdaCore/llvm-project.git
synced 2026-02-12 13:52:35 -08:00
27 lines
929 B
C++
27 lines
929 B
C++
|
|
//===- PythonTestModule.cpp - Python extension for the PythonTest dialect -===//
|
||
|
|
//
|
||
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
||
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||
|
|
//
|
||
|
|
//===----------------------------------------------------------------------===//
|
||
|
|
|
||
|
|
#include "PythonTestCAPI.h"
|
||
|
|
#include "mlir/Bindings/Python/PybindAdaptors.h"
|
||
|
|
|
||
|
|
namespace py = pybind11;
|
||
|
|
|
||
|
|
PYBIND11_MODULE(_mlirPythonTest, m) {
|
||
|
|
m.def(
|
||
|
|
"register_python_test_dialect",
|
||
|
|
[](MlirContext context, bool load) {
|
||
|
|
MlirDialectHandle pythonTestDialect =
|
||
|
|
mlirGetDialectHandle__python_test__();
|
||
|
|
mlirDialectHandleRegisterDialect(pythonTestDialect, context);
|
||
|
|
if (load) {
|
||
|
|
mlirDialectHandleLoadDialect(pythonTestDialect, context);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
py::arg("context"), py::arg("load") = true);
|
||
|
|
}
|