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/ADT/ArrayRef.h"
18 #include "llvm/Support/CodeGen.h"
19 #include "llvm/Target/TargetMachine.h"
20 
21 namespace llvm {
22 
23 class Module;
24 class TargetOptions;
25 class raw_pwrite_stream;
26 
27 /// Split M into OSs.size() partitions, and generate code for each. Writes
28 /// OSs.size() output files to the output streams in OSs. The resulting output
29 /// files if linked together are intended to be equivalent to the single output
30 /// file that would have been code generated from M.
31 ///
32 /// \returns M if OSs.size() == 1, otherwise returns std::unique_ptr<Module>().
33 std::unique_ptr<Module>
34 splitCodeGen(std::unique_ptr<Module> M, ArrayRef<raw_pwrite_stream *> OSs,
35              StringRef CPU, StringRef Features, const TargetOptions &Options,
36              Reloc::Model RM = Reloc::Default,
37              CodeModel::Model CM = CodeModel::Default,
38              CodeGenOpt::Level OL = CodeGenOpt::Default,
39              TargetMachine::CodeGenFileType FT = TargetMachine::CGFT_ObjectFile);
40 
41 } // namespace llvm
42 
43 #endif
44