MLIR 23.0.0git
Export.h
Go to the documentation of this file.
1//===- Export.h - MLIR to LLVM IR translation entry point -------*- C++ -*-===//
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#ifndef MLIR_TARGET_LLVMIR_EXPORT_H
10#define MLIR_TARGET_LLVMIR_EXPORT_H
11
12#include "llvm/ADT/StringRef.h"
13#include <memory>
14
15namespace llvm {
16class LLVMContext;
17class Module;
18namespace vfs {
19class FileSystem;
20} // namespace vfs
21} // namespace llvm
22
23namespace mlir {
24class Operation;
25
26/// Translates a given LLVM dialect `module` into an LLVM IR module living in
27/// the given context. Operates on any operation from dialects that provide a
28/// registered implementation of the LLVMTranslationDialectInterface. Returns
29/// nullptr when the translation fails.
30/// Verifies the produced LLVM module, except when `disableVerification` is set.
31/// An optional \p fs can be provided to avoid direct filesystem access (e.g.,
32/// to comply with the IO sandbox in clang -cc1). When null, the real filesystem
33/// is used.
34std::unique_ptr<llvm::Module>
35translateModuleToLLVMIR(Operation *module, llvm::LLVMContext &llvmContext,
36 llvm::StringRef name = "LLVMDialectModule",
37 bool disableVerification = false,
38 llvm::vfs::FileSystem *fs = nullptr);
39} // namespace mlir
40
41#endif // MLIR_TARGET_LLVMIR_EXPORT_H
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
Include the generated interface declarations.
std::unique_ptr< llvm::Module > translateModuleToLLVMIR(Operation *module, llvm::LLVMContext &llvmContext, llvm::StringRef name="LLVMDialectModule", bool disableVerification=false, llvm::vfs::FileSystem *fs=nullptr)
Translates a given LLVM dialect module into an LLVM IR module living in the given context.