| 1 | //===-- mlir-c/Dialect/EmitC.h - C API for EmitC dialect ----------*- C -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM |
| 4 | // Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef MLIR_C_DIALECT_EmitC_H |
| 11 | #define MLIR_C_DIALECT_EmitC_H |
| 12 | |
| 13 | #include "mlir-c/IR.h" |
| 14 | #include "mlir-c/Support.h" |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(EmitC, emitc); |
| 21 | |
| 22 | enum MlirEmitCCmpPredicate : uint64_t { |
| 23 | MLIR_EMITC_CMP_PREDICATE_EQ = 0, |
| 24 | MLIR_EMITC_CMP_PREDICATE_NE = 1, |
| 25 | MLIR_EMITC_CMP_PREDICATE_LT = 2, |
| 26 | MLIR_EMITC_CMP_PREDICATE_LE = 3, |
| 27 | MLIR_EMITC_CMP_PREDICATE_GT = 4, |
| 28 | MLIR_EMITC_CMP_PREDICATE_GE = 5, |
| 29 | MLIR_EMITC_CMP_PREDICATE_THREE_WAY = 6, |
| 30 | }; |
| 31 | |
| 32 | //===---------------------------------------------------------------------===// |
| 33 | // ArrayType |
| 34 | //===---------------------------------------------------------------------===// |
| 35 | |
| 36 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCArrayType(MlirType type); |
| 37 | |
| 38 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCArrayTypeGetTypeID(void); |
| 39 | |
| 40 | MLIR_CAPI_EXPORTED MlirType mlirEmitCArrayTypeGet(intptr_t nDims, |
| 41 | int64_t *shape, |
| 42 | MlirType elementType); |
| 43 | |
| 44 | //===---------------------------------------------------------------------===// |
| 45 | // LValueType |
| 46 | //===---------------------------------------------------------------------===// |
| 47 | |
| 48 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCLValueType(MlirType type); |
| 49 | |
| 50 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCLValueTypeGetTypeID(void); |
| 51 | |
| 52 | MLIR_CAPI_EXPORTED MlirType mlirEmitCLValueTypeGet(MlirType valueType); |
| 53 | |
| 54 | //===---------------------------------------------------------------------===// |
| 55 | // OpaqueType |
| 56 | //===---------------------------------------------------------------------===// |
| 57 | |
| 58 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCOpaqueType(MlirType type); |
| 59 | |
| 60 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCOpaqueTypeGetTypeID(void); |
| 61 | |
| 62 | MLIR_CAPI_EXPORTED MlirType mlirEmitCOpaqueTypeGet(MlirContext ctx, |
| 63 | MlirStringRef value); |
| 64 | |
| 65 | //===---------------------------------------------------------------------===// |
| 66 | // PointerType |
| 67 | //===---------------------------------------------------------------------===// |
| 68 | |
| 69 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCPointerType(MlirType type); |
| 70 | |
| 71 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCPointerTypeGetTypeID(void); |
| 72 | |
| 73 | MLIR_CAPI_EXPORTED MlirType mlirEmitCPointerTypeGet(MlirType pointee); |
| 74 | |
| 75 | //===---------------------------------------------------------------------===// |
| 76 | // PtrDiffTType |
| 77 | //===---------------------------------------------------------------------===// |
| 78 | |
| 79 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCPtrDiffTType(MlirType type); |
| 80 | |
| 81 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCPtrDiffTTypeGetTypeID(void); |
| 82 | |
| 83 | MLIR_CAPI_EXPORTED MlirType mlirEmitCPtrDiffTTypeGet(MlirContext ctx); |
| 84 | |
| 85 | //===---------------------------------------------------------------------===// |
| 86 | // SignedSizeTType |
| 87 | //===---------------------------------------------------------------------===// |
| 88 | |
| 89 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCSignedSizeTType(MlirType type); |
| 90 | |
| 91 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCSignedSizeTTypeGetTypeID(void); |
| 92 | |
| 93 | MLIR_CAPI_EXPORTED MlirType mlirEmitCSignedSizeTTypeGet(MlirContext ctx); |
| 94 | |
| 95 | //===---------------------------------------------------------------------===// |
| 96 | // SizeTType |
| 97 | //===---------------------------------------------------------------------===// |
| 98 | |
| 99 | MLIR_CAPI_EXPORTED bool mlirTypeIsAEmitCSizeTType(MlirType type); |
| 100 | |
| 101 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCSizeTTypeGetTypeID(void); |
| 102 | |
| 103 | MLIR_CAPI_EXPORTED MlirType mlirEmitCSizeTTypeGet(MlirContext ctx); |
| 104 | |
| 105 | //===----------------------------------------------------------------------===// |
| 106 | // CmpPredicate attribute. |
| 107 | //===----------------------------------------------------------------------===// |
| 108 | |
| 109 | MLIR_CAPI_EXPORTED bool mlirAttributeIsAEmitCCmpPredicate(MlirAttribute attr); |
| 110 | |
| 111 | MLIR_CAPI_EXPORTED MlirAttribute |
| 112 | mlirEmitCCmpPredicateAttrGet(MlirContext ctx, enum MlirEmitCCmpPredicate val); |
| 113 | |
| 114 | MLIR_CAPI_EXPORTED enum MlirEmitCCmpPredicate |
| 115 | mlirEmitCCmpPredicateAttrGetValue(MlirAttribute attr); |
| 116 | |
| 117 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCCmpPredicateAttrGetTypeID(void); |
| 118 | |
| 119 | //===----------------------------------------------------------------------===// |
| 120 | // Opaque attribute. |
| 121 | //===----------------------------------------------------------------------===// |
| 122 | |
| 123 | MLIR_CAPI_EXPORTED bool mlirAttributeIsAEmitCOpaque(MlirAttribute attr); |
| 124 | |
| 125 | MLIR_CAPI_EXPORTED MlirAttribute mlirEmitCOpaqueAttrGet(MlirContext ctx, |
| 126 | MlirStringRef value); |
| 127 | |
| 128 | MLIR_CAPI_EXPORTED MlirStringRef |
| 129 | mlirEmitCOpaqueAttrGetValue(MlirAttribute attr); |
| 130 | |
| 131 | MLIR_CAPI_EXPORTED MlirTypeID mlirEmitCOpaqueAttrGetTypeID(void); |
| 132 | |
| 133 | #ifdef __cplusplus |
| 134 | } |
| 135 | #endif |
| 136 | |
| 137 | #endif // MLIR_C_DIALECT_EmitC_H |
| 138 | |