MLIR  20.0.0git
Transform.cpp
Go to the documentation of this file.
1 //===- Transform.cpp - C Interface for Transform 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 
10 #include "mlir-c/Support.h"
11 #include "mlir/CAPI/Registration.h"
14 
15 using namespace mlir;
16 
18  transform::TransformDialect)
19 
20 //===---------------------------------------------------------------------===//
21 // AnyOpType
22 //===---------------------------------------------------------------------===//
23 
24 bool mlirTypeIsATransformAnyOpType(MlirType type) {
25  return isa<transform::AnyOpType>(unwrap(type));
26 }
27 
29  return wrap(transform::AnyOpType::getTypeID());
30 }
31 
32 MlirType mlirTransformAnyOpTypeGet(MlirContext ctx) {
34 }
35 
36 //===---------------------------------------------------------------------===//
37 // AnyParamType
38 //===---------------------------------------------------------------------===//
39 
40 bool mlirTypeIsATransformAnyParamType(MlirType type) {
41  return isa<transform::AnyParamType>(unwrap(type));
42 }
43 
45  return wrap(transform::AnyParamType::getTypeID());
46 }
47 
48 MlirType mlirTransformAnyParamTypeGet(MlirContext ctx) {
50 }
51 
52 //===---------------------------------------------------------------------===//
53 // AnyValueType
54 //===---------------------------------------------------------------------===//
55 
56 bool mlirTypeIsATransformAnyValueType(MlirType type) {
57  return isa<transform::AnyValueType>(unwrap(type));
58 }
59 
61  return wrap(transform::AnyValueType::getTypeID());
62 }
63 
64 MlirType mlirTransformAnyValueTypeGet(MlirContext ctx) {
66 }
67 
68 //===---------------------------------------------------------------------===//
69 // OperationType
70 //===---------------------------------------------------------------------===//
71 
72 bool mlirTypeIsATransformOperationType(MlirType type) {
73  return isa<transform::OperationType>(unwrap(type));
74 }
75 
77  return wrap(transform::OperationType::getTypeID());
78 }
79 
80 MlirType mlirTransformOperationTypeGet(MlirContext ctx,
81  MlirStringRef operationName) {
82  return wrap(
83  transform::OperationType::get(unwrap(ctx), unwrap(operationName)));
84 }
85 
87  return wrap(cast<transform::OperationType>(unwrap(type)).getOperationName());
88 }
89 
90 //===---------------------------------------------------------------------===//
91 // ParamType
92 //===---------------------------------------------------------------------===//
93 
94 bool mlirTypeIsATransformParamType(MlirType type) {
95  return isa<transform::ParamType>(unwrap(type));
96 }
97 
99  return wrap(transform::ParamType::getTypeID());
100 }
101 
102 MlirType mlirTransformParamTypeGet(MlirContext ctx, MlirType type) {
103  return wrap(transform::ParamType::get(unwrap(ctx), unwrap(type)));
104 }
105 
106 MlirType mlirTransformParamTypeGetType(MlirType type) {
107  return wrap(cast<transform::ParamType>(unwrap(type)).getType());
108 }
MlirTypeID mlirTransformAnyValueTypeGetTypeID(void)
Definition: Transform.cpp:60
MlirTypeID mlirTransformOperationTypeGetTypeID(void)
Definition: Transform.cpp:76
bool mlirTypeIsATransformAnyValueType(MlirType type)
Definition: Transform.cpp:56
MlirType mlirTransformParamTypeGetType(MlirType type)
Definition: Transform.cpp:106
MlirTypeID mlirTransformAnyOpTypeGetTypeID(void)
Definition: Transform.cpp:28
MlirTypeID mlirTransformAnyParamTypeGetTypeID(void)
Definition: Transform.cpp:44
MlirTypeID mlirTransformParamTypeGetTypeID(void)
Definition: Transform.cpp:98
bool mlirTypeIsATransformParamType(MlirType type)
Definition: Transform.cpp:94
bool mlirTypeIsATransformAnyParamType(MlirType type)
Definition: Transform.cpp:40
bool mlirTypeIsATransformOperationType(MlirType type)
Definition: Transform.cpp:72
MlirType mlirTransformAnyOpTypeGet(MlirContext ctx)
Definition: Transform.cpp:32
MlirType mlirTransformOperationTypeGet(MlirContext ctx, MlirStringRef operationName)
Definition: Transform.cpp:80
MlirType mlirTransformParamTypeGet(MlirContext ctx, MlirType type)
Definition: Transform.cpp:102
MlirType mlirTransformAnyParamTypeGet(MlirContext ctx)
Definition: Transform.cpp:48
MlirType mlirTransformAnyValueTypeGet(MlirContext ctx)
Definition: Transform.cpp:64
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Transform, transform, transform::TransformDialect) bool mlirTypeIsATransformAnyOpType(MlirType type)
Definition: Transform.cpp:17
MlirStringRef mlirTransformOperationTypeGetOperationName(MlirType type)
Definition: Transform.cpp:86
MLIR_CAPI_EXPORTED bool mlirTypeIsATransformAnyOpType(MlirType type)
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
Definition: Diagnostics.h:19
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition: Diagnostics.h:24
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
Definition: Utils.cpp:305
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition: Support.h:73