xref: /llvm-project/mlir/lib/CAPI/Dialect/Func.cpp (revision 86bc2e3ae905f0668f12c6f52191c1273936da80)
1 //===- Func.cpp - C Interface for Func 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 
9 #include "mlir-c/Dialect/Func.h"
10 #include "mlir-c/IR.h"
11 #include "mlir-c/Support.h"
12 #include "mlir/CAPI/Registration.h"
13 #include "mlir/Dialect/Func/IR/FuncOps.h"
14 
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Func,func,mlir::func::FuncDialect)15 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Func, func, mlir::func::FuncDialect)
16 
17 void mlirFuncSetArgAttr(MlirOperation op, intptr_t pos, MlirStringRef name,
18                         MlirAttribute attr) {
19   llvm::cast<mlir::func::FuncOp>(unwrap(op))
20       .setArgAttr(pos, unwrap(name), unwrap(attr));
21 }
22