]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/CodeGen/ParallelCG.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / CodeGen / ParallelCG.h
1 //===-- llvm/CodeGen/ParallelCG.h - Parallel code generation ----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header declares functions that can be used for parallel code generation.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CODEGEN_PARALLELCG_H
15 #define LLVM_CODEGEN_PARALLELCG_H
16
17 #include "llvm/Support/CodeGen.h"
18 #include "llvm/Target/TargetMachine.h"
19
20 #include <functional>
21
22 namespace llvm {
23
24 template <typename T> class ArrayRef;
25 class Module;
26 class TargetOptions;
27 class raw_pwrite_stream;
28
29 /// Split M into OSs.size() partitions, and generate code for each. Takes a
30 /// factory function for the TargetMachine TMFactory. Writes OSs.size() output
31 /// files to the output streams in OSs. The resulting output files if linked
32 /// together are intended to be equivalent to the single output file that would
33 /// have been code generated from M.
34 ///
35 /// Writes bitcode for individual partitions into output streams in BCOSs, if
36 /// BCOSs is not empty.
37 ///
38 /// \returns M if OSs.size() == 1, otherwise returns std::unique_ptr<Module>().
39 std::unique_ptr<Module>
40 splitCodeGen(std::unique_ptr<Module> M, ArrayRef<raw_pwrite_stream *> OSs,
41              ArrayRef<llvm::raw_pwrite_stream *> BCOSs,
42              const std::function<std::unique_ptr<TargetMachine>()> &TMFactory,
43              TargetMachine::CodeGenFileType FileType = TargetMachine::CGFT_ObjectFile,
44              bool PreserveLocals = false);
45
46 } // namespace llvm
47
48 #endif