• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- NVVMIR.h - MLIR to LLVM + NVVM IR conversion -------------*- 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 // This file declares the entry point for the MLIR to LLVM + NVVM IR conversion.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_TARGET_NVVMIR_H
14 #define MLIR_TARGET_NVVMIR_H
15 
16 #include "llvm/ADT/StringRef.h"
17 #include <memory>
18 
19 // Forward-declare LLVM classes.
20 namespace llvm {
21 class LLVMContext;
22 class Module;
23 } // namespace llvm
24 
25 namespace mlir {
26 class Operation;
27 
28 /// Convert the given LLVM-module-like operation into NVVM IR. This conversion
29 /// requires the registration of the LLVM IR dialect and will extract the LLVM
30 /// context from the registered LLVM IR dialect.  In case of error, report it to
31 /// the error handler registered with the MLIR context, if any (obtained from
32 /// the MLIR module), and return `nullptr`.
33 std::unique_ptr<llvm::Module>
34 translateModuleToNVVMIR(Operation *m, llvm::LLVMContext &llvmContext,
35                         llvm::StringRef name = "LLVMDialectModule");
36 
37 } // namespace mlir
38 
39 #endif // MLIR_TARGET_NVVMIR_H
40