summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-05-21 20:16:41 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-05-21 20:16:41 +0000
commit9a45114b3cf80a2ffc6b86275da82d3ed91e081b (patch)
treeb8bb197005a82e83c2073d3f058eefd7a401a8ba /llvm/lib
parent9b2df56c596b4929938c44e0eb3c54d89d2ba466 (diff)
downloadbcm5719-llvm-9a45114b3cf80a2ffc6b86275da82d3ed91e081b.tar.gz
bcm5719-llvm-9a45114b3cf80a2ffc6b86275da82d3ed91e081b.zip
CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.
Part of PR37466. Differential Revision: https://reviews.llvm.org/D47089 llvm-svn: 332881
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp15
-rw-r--r--llvm/lib/CodeGen/ParallelCG.cpp2
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp5
-rw-r--r--llvm/lib/LTO/ThinLTOCodeGenerator.cpp2
-rw-r--r--llvm/lib/Target/TargetMachineC.cpp2
5 files changed, 16 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 27b1d96773e..2cd389ce2c1 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -121,8 +121,10 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
}
bool LLVMTargetMachine::addAsmPrinter(PassManagerBase &PM,
- raw_pwrite_stream &Out, CodeGenFileType FileType,
- MCContext &Context) {
+ raw_pwrite_stream &Out,
+ raw_pwrite_stream *DwoOut,
+ CodeGenFileType FileType,
+ MCContext &Context) {
if (Options.MCOptions.MCSaveTempLabels)
Context.setAllowTemporaryLabels(false);
@@ -168,8 +170,9 @@ bool LLVMTargetMachine::addAsmPrinter(PassManagerBase &PM,
Triple T(getTargetTriple().str());
AsmStreamer.reset(getTarget().createMCObjectStreamer(
T, Context, std::unique_ptr<MCAsmBackend>(MAB),
- MAB->createObjectWriter(Out), std::unique_ptr<MCCodeEmitter>(MCE), STI,
- Options.MCOptions.MCRelaxAll,
+ DwoOut ? MAB->createDwoObjectWriter(Out, *DwoOut)
+ : MAB->createObjectWriter(Out),
+ std::unique_ptr<MCCodeEmitter>(MCE), STI, Options.MCOptions.MCRelaxAll,
Options.MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ true));
break;
@@ -193,6 +196,7 @@ bool LLVMTargetMachine::addAsmPrinter(PassManagerBase &PM,
bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
raw_pwrite_stream &Out,
+ raw_pwrite_stream *DwoOut,
CodeGenFileType FileType,
bool DisableVerify,
MachineModuleInfo *MMI) {
@@ -203,7 +207,8 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
if (!Context)
return true;
- if (WillCompleteCodeGenPipeline && addAsmPrinter(PM, Out, FileType, *Context))
+ if (WillCompleteCodeGenPipeline &&
+ addAsmPrinter(PM, Out, DwoOut, FileType, *Context))
return true;
PM.add(createFreeMachineFunctionPass());
diff --git a/llvm/lib/CodeGen/ParallelCG.cpp b/llvm/lib/CodeGen/ParallelCG.cpp
index 4624b224b95..bc3f2a6e9b5 100644
--- a/llvm/lib/CodeGen/ParallelCG.cpp
+++ b/llvm/lib/CodeGen/ParallelCG.cpp
@@ -30,7 +30,7 @@ static void codegen(Module *M, llvm::raw_pwrite_stream &OS,
TargetMachine::CodeGenFileType FileType) {
std::unique_ptr<TargetMachine> TM = TMFactory();
legacy::PassManager CodeGenPasses;
- if (TM->addPassesToEmitFile(CodeGenPasses, OS, FileType))
+ if (TM->addPassesToEmitFile(CodeGenPasses, OS, nullptr, FileType))
report_fatal_error("Failed to setup codegen");
CodeGenPasses.run(*M);
}
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 6367aac11f3..983ba80c1af 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -304,7 +304,7 @@ void codegenWithSplitDwarf(Config &Conf, TargetMachine *TM,
TM->Options.MCOptions.SplitDwarfFile = DwarfFile.str().str();
legacy::PassManager CodeGenPasses;
- if (TM->addPassesToEmitFile(CodeGenPasses, OS, Conf.CGFileType))
+ if (TM->addPassesToEmitFile(CodeGenPasses, OS, nullptr, Conf.CGFileType))
report_fatal_error("Failed to setup codegen");
CodeGenPasses.run(Mod);
@@ -355,7 +355,8 @@ void codegen(Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
auto Stream = AddStream(Task);
legacy::PassManager CodeGenPasses;
- if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS, Conf.CGFileType))
+ if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS, nullptr,
+ Conf.CGFileType))
report_fatal_error("Failed to setup codegen");
CodeGenPasses.run(Mod);
}
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index f164a034a0b..872b9232e34 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -268,7 +268,7 @@ std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
PM.add(createObjCARCContractPass());
// Setup the codegen now.
- if (TM.addPassesToEmitFile(PM, OS, TargetMachine::CGFT_ObjectFile,
+ if (TM.addPassesToEmitFile(PM, OS, nullptr, TargetMachine::CGFT_ObjectFile,
/* DisableVerify */ true))
report_fatal_error("Failed to setup codegen");
diff --git a/llvm/lib/Target/TargetMachineC.cpp b/llvm/lib/Target/TargetMachineC.cpp
index d43124d7123..a6f4790b866 100644
--- a/llvm/lib/Target/TargetMachineC.cpp
+++ b/llvm/lib/Target/TargetMachineC.cpp
@@ -196,7 +196,7 @@ static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
ft = TargetMachine::CGFT_ObjectFile;
break;
}
- if (TM->addPassesToEmitFile(pass, OS, ft)) {
+ if (TM->addPassesToEmitFile(pass, OS, nullptr, ft)) {
error = "TargetMachine can't emit a file of this type";
*ErrorMessage = strdup(error.c_str());
return true;
OpenPOWER on IntegriCloud