aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/CAPI/Dialect/Func.cpp
blob: 8265b61b984269174744b9bf265df57cf9c49e73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//===- Func.cpp - C Interface for Func dialect ----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "mlir-c/Dialect/Func.h"
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Func, func, mlir::func::FuncDialect)

void mlirFuncSetArgAttr(MlirOperation op, intptr_t pos, MlirStringRef name,
                        MlirAttribute attr) {
  llvm::cast<mlir::func::FuncOp>(unwrap(op))
      .setArgAttr(pos, unwrap(name), unwrap(attr));
}

void mlirFuncSetResultAttr(MlirOperation op, intptr_t pos, MlirStringRef name,
                           MlirAttribute attr) {
  llvm::cast<mlir::func::FuncOp>(unwrap(op))
      .setResultAttr(pos, unwrap(name), unwrap(attr));
}