diff options
Diffstat (limited to 'llvm/lib/CodeGen/ParallelCG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ParallelCG.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/ParallelCG.cpp b/llvm/lib/CodeGen/ParallelCG.cpp index 748d3883ea1..e73ba029604 100644 --- a/llvm/lib/CodeGen/ParallelCG.cpp +++ b/llvm/lib/CodeGen/ParallelCG.cpp @@ -28,13 +28,13 @@ using namespace llvm; static void codegen(Module *M, llvm::raw_pwrite_stream &OS, const Target *TheTarget, StringRef CPU, StringRef Features, const TargetOptions &Options, Reloc::Model RM, - CodeModel::Model CM, CodeGenOpt::Level OL) { + CodeModel::Model CM, CodeGenOpt::Level OL, + TargetMachine::CodeGenFileType FileType) { std::unique_ptr<TargetMachine> TM(TheTarget->createTargetMachine( M->getTargetTriple(), CPU, Features, Options, RM, CM, OL)); legacy::PassManager CodeGenPasses; - if (TM->addPassesToEmitFile(CodeGenPasses, OS, - TargetMachine::CGFT_ObjectFile)) + if (TM->addPassesToEmitFile(CodeGenPasses, OS, FileType)) report_fatal_error("Failed to setup codegen"); CodeGenPasses.run(*M); } @@ -43,7 +43,8 @@ std::unique_ptr<Module> llvm::splitCodeGen(std::unique_ptr<Module> M, ArrayRef<llvm::raw_pwrite_stream *> OSs, StringRef CPU, StringRef Features, const TargetOptions &Options, - Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL) { + Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL, + TargetMachine::CodeGenFileType FileType) { StringRef TripleStr = M->getTargetTriple(); std::string ErrMsg; const Target *TheTarget = TargetRegistry::lookupTarget(TripleStr, ErrMsg); @@ -52,7 +53,7 @@ llvm::splitCodeGen(std::unique_ptr<Module> M, if (OSs.size() == 1) { codegen(M.get(), *OSs[0], TheTarget, CPU, Features, Options, RM, CM, - OL); + OL, FileType); return M; } @@ -69,7 +70,7 @@ llvm::splitCodeGen(std::unique_ptr<Module> M, llvm::raw_pwrite_stream *ThreadOS = OSs[Threads.size()]; Threads.emplace_back( - [TheTarget, CPU, Features, Options, RM, CM, OL, + [TheTarget, CPU, Features, Options, RM, CM, OL, FileType, ThreadOS](const SmallVector<char, 0> &BC) { LLVMContext Ctx; ErrorOr<std::unique_ptr<Module>> MOrErr = @@ -81,7 +82,7 @@ llvm::splitCodeGen(std::unique_ptr<Module> M, std::unique_ptr<Module> MPartInCtx = std::move(MOrErr.get()); codegen(MPartInCtx.get(), *ThreadOS, TheTarget, CPU, Features, - Options, RM, CM, OL); + Options, RM, CM, OL, FileType); }, // Pass BC using std::move to ensure that it get moved rather than // copied into the thread's context. |