114c92070SAlex Zinenko //===- PythonTestCAPI.cpp - C API for the PythonTest dialect --------------===// 214c92070SAlex Zinenko // 314c92070SAlex Zinenko // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 414c92070SAlex Zinenko // See https://llvm.org/LICENSE.txt for license information. 514c92070SAlex Zinenko // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 614c92070SAlex Zinenko // 714c92070SAlex Zinenko //===----------------------------------------------------------------------===// 814c92070SAlex Zinenko 914c92070SAlex Zinenko #include "PythonTestCAPI.h" 1014c92070SAlex Zinenko #include "PythonTestDialect.h" 1114c92070SAlex Zinenko #include "mlir/CAPI/Registration.h" 12*89a92fb3SAlex Zinenko #include "mlir/CAPI/Wrap.h" 1314c92070SAlex Zinenko MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(PythonTest,python_test,python_test::PythonTestDialect)1414c92070SAlex ZinenkoMLIR_DEFINE_CAPI_DIALECT_REGISTRATION(PythonTest, python_test, 1514c92070SAlex Zinenko python_test::PythonTestDialect) 16*89a92fb3SAlex Zinenko 17*89a92fb3SAlex Zinenko bool mlirAttributeIsAPythonTestTestAttribute(MlirAttribute attr) { 18*89a92fb3SAlex Zinenko return unwrap(attr).isa<python_test::TestAttrAttr>(); 19*89a92fb3SAlex Zinenko } 20*89a92fb3SAlex Zinenko mlirPythonTestTestAttributeGet(MlirContext context)21*89a92fb3SAlex ZinenkoMlirAttribute mlirPythonTestTestAttributeGet(MlirContext context) { 22*89a92fb3SAlex Zinenko return wrap(python_test::TestAttrAttr::get(unwrap(context))); 23*89a92fb3SAlex Zinenko } 24*89a92fb3SAlex Zinenko mlirTypeIsAPythonTestTestType(MlirType type)25*89a92fb3SAlex Zinenkobool mlirTypeIsAPythonTestTestType(MlirType type) { 26*89a92fb3SAlex Zinenko return unwrap(type).isa<python_test::TestTypeType>(); 27*89a92fb3SAlex Zinenko } 28*89a92fb3SAlex Zinenko mlirPythonTestTestTypeGet(MlirContext context)29*89a92fb3SAlex ZinenkoMlirType mlirPythonTestTestTypeGet(MlirContext context) { 30*89a92fb3SAlex Zinenko return wrap(python_test::TestTypeType::get(unwrap(context))); 31*89a92fb3SAlex Zinenko } 32