1 //===-- llvm/CodeGen/ParallelCG.h - Parallel code generation ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header declares functions that can be used for parallel code generation.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CODEGEN_PARALLELCG_H
15 #define LLVM_CODEGEN_PARALLELCG_H
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/Support/CodeGen.h"
19 #include "llvm/Target/TargetMachine.h"
25 class raw_pwrite_stream;
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.
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);