1 //===- PythonTestModule.cpp - Python extension for the PythonTest dialect -===// 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 9 #include "PythonTestCAPI.h" 10 #include "mlir/Bindings/Python/PybindAdaptors.h" 11 12 namespace py = pybind11; 13 14 PYBIND11_MODULE(_mlirPythonTest, m) { 15 m.def( 16 "register_python_test_dialect", 17 [](MlirContext context, bool load) { 18 MlirDialectHandle pythonTestDialect = 19 mlirGetDialectHandle__python_test__(); 20 mlirDialectHandleRegisterDialect(pythonTestDialect, context); 21 if (load) { 22 mlirDialectHandleLoadDialect(pythonTestDialect, context); 23 } 24 }, 25 py::arg("context"), py::arg("load") = true); 26 } 27