| 1 | //===-- mlir-c/Dialect/Func.h - C API for Func 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 | // This header declares the C interface for registering and accessing the |
| 11 | // Func dialect. A dialect should be registered with a context to make it |
| 12 | // available to users of the context. These users must load the dialect |
| 13 | // before using any of its attributes, operations or types. Parser and pass |
| 14 | // manager can load registered dialects automatically. |
| 15 | // |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | |
| 18 | #ifndef MLIR_C_DIALECT_FUNC_H |
| 19 | #define MLIR_C_DIALECT_FUNC_H |
| 20 | |
| 21 | #include <stdint.h> |
| 22 | |
| 23 | #include "mlir-c/IR.h" |
| 24 | #include "mlir-c/Support.h" |
| 25 | |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Func, func); |
| 31 | |
| 32 | /// Sets the argument attribute 'name' of an argument at index 'pos'. |
| 33 | /// Asserts that the operation is a FuncOp. |
| 34 | MLIR_CAPI_EXPORTED void mlirFuncSetArgAttr(MlirOperation op, intptr_t pos, |
| 35 | MlirStringRef name, |
| 36 | MlirAttribute attr); |
| 37 | |
| 38 | MLIR_CAPI_EXPORTED void mlirFuncSetResultAttr(MlirOperation op, intptr_t pos, |
| 39 | MlirStringRef name, |
| 40 | MlirAttribute attr); |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | #endif // MLIR_C_DIALECT_FUNC_H |
| 47 | |