annotate mlir/test/python/lib/PythonTestCAPI.cpp @ 243:a916df8444bf

add tag
author matac
date Fri, 11 Aug 2023 15:57:02 +0900
parents c4bab56944e8
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
236
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
1 //===- PythonTestCAPI.cpp - C API for the PythonTest dialect --------------===//
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
2 //
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
6 //
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
8
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
9 #include "PythonTestCAPI.h"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
10 #include "PythonTestDialect.h"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
11 #include "mlir/CAPI/Registration.h"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
12 #include "mlir/CAPI/Wrap.h"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
13
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
14 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(PythonTest, python_test,
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
15 python_test::PythonTestDialect)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
16
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
17 bool mlirAttributeIsAPythonTestTestAttribute(MlirAttribute attr) {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
18 return unwrap(attr).isa<python_test::TestAttrAttr>();
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
19 }
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
20
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
21 MlirAttribute mlirPythonTestTestAttributeGet(MlirContext context) {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
22 return wrap(python_test::TestAttrAttr::get(unwrap(context)));
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
23 }
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
24
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
25 bool mlirTypeIsAPythonTestTestType(MlirType type) {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
26 return unwrap(type).isa<python_test::TestTypeType>();
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
27 }
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
28
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
29 MlirType mlirPythonTestTestTypeGet(MlirContext context) {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
30 return wrap(python_test::TestTypeType::get(unwrap(context)));
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
31 }