Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- llvm/CodeGen/ParallelCG.h - Parallel code generation ----*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This header declares functions that can be used for parallel code generation. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_CODEGEN_PARALLELCG_H |
| 14 | #define LLVM_CODEGEN_PARALLELCG_H |
| 15 | |
| 16 | #include "llvm/Support/CodeGen.h" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 17 | #include <functional> |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 18 | #include <memory> |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | template <typename T> class ArrayRef; |
| 23 | class Module; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 24 | class TargetMachine; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 25 | class raw_pwrite_stream; |
| 26 | |
| 27 | /// Split M into OSs.size() partitions, and generate code for each. Takes a |
| 28 | /// factory function for the TargetMachine TMFactory. Writes OSs.size() output |
| 29 | /// files to the output streams in OSs. The resulting output files if linked |
| 30 | /// together are intended to be equivalent to the single output file that would |
| 31 | /// have been code generated from M. |
| 32 | /// |
| 33 | /// Writes bitcode for individual partitions into output streams in BCOSs, if |
| 34 | /// BCOSs is not empty. |
| 35 | /// |
| 36 | /// \returns M if OSs.size() == 1, otherwise returns std::unique_ptr<Module>(). |
| 37 | std::unique_ptr<Module> |
| 38 | splitCodeGen(std::unique_ptr<Module> M, ArrayRef<raw_pwrite_stream *> OSs, |
| 39 | ArrayRef<llvm::raw_pwrite_stream *> BCOSs, |
| 40 | const std::function<std::unique_ptr<TargetMachine>()> &TMFactory, |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 41 | CodeGenFileType FileType = CGFT_ObjectFile, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 42 | bool PreserveLocals = false); |
| 43 | |
| 44 | } // namespace llvm |
| 45 | |
| 46 | #endif |