[Alignment][NFC] Support compile time constants
[llvm-core.git] / include / llvm / CodeGen / ParallelCG.h
bloba44715d4fc4fa316db20093e397cf044187f19ce
1 //===-- llvm/CodeGen/ParallelCG.h - Parallel code generation ----*- 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 header declares functions that can be used for parallel code generation.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CODEGEN_PARALLELCG_H
14 #define LLVM_CODEGEN_PARALLELCG_H
16 #include "llvm/Support/CodeGen.h"
17 #include "llvm/Target/TargetMachine.h"
19 #include <functional>
21 namespace llvm {
23 template <typename T> class ArrayRef;
24 class Module;
25 class TargetOptions;
26 class raw_pwrite_stream;
28 /// Split M into OSs.size() partitions, and generate code for each. Takes a
29 /// factory function for the TargetMachine TMFactory. Writes OSs.size() output
30 /// files to the output streams in OSs. The resulting output files if linked
31 /// together are intended to be equivalent to the single output file that would
32 /// have been code generated from M.
33 ///
34 /// Writes bitcode for individual partitions into output streams in BCOSs, if
35 /// BCOSs is not empty.
36 ///
37 /// \returns M if OSs.size() == 1, otherwise returns std::unique_ptr<Module>().
38 std::unique_ptr<Module>
39 splitCodeGen(std::unique_ptr<Module> M, ArrayRef<raw_pwrite_stream *> OSs,
40 ArrayRef<llvm::raw_pwrite_stream *> BCOSs,
41 const std::function<std::unique_ptr<TargetMachine>()> &TMFactory,
42 TargetMachine::CodeGenFileType FileType = TargetMachine::CGFT_ObjectFile,
43 bool PreserveLocals = false);
45 } // namespace llvm
47 #endif