1//===-- LLVMIR.h - C Interface for MLIR LLVMIR Target -------------*- 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 to target LLVMIR with MLIR.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_C_TARGET_LLVMIR_H
15#define MLIR_C_TARGET_LLVMIR_H
16
17#include "mlir-c/IR.h"
18#include "mlir-c/Support.h"
19#include "llvm-c/Support.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/// Translate operation that satisfies LLVM dialect module requirements into an
26/// LLVM IR module living in the given context. This translates operations from
27/// any dilalect that has a registered implementation of
28/// LLVMTranslationDialectInterface.
29///
30/// \returns the generated LLVM IR Module from the translated MLIR module, it is
31/// owned by the caller.
32MLIR_CAPI_EXPORTED LLVMModuleRef
33mlirTranslateModuleToLLVMIR(MlirOperation module, LLVMContextRef context);
34
35#ifdef __cplusplus
36}
37#endif
38
39#endif // MLIR_C_TARGET_LLVMIR_H
40

source code of mlir/include/mlir-c/Target/LLVMIR.h