[PATCH] D18994: [LTO] Switch Module to std::unique_ptr<>
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 11 15:45:19 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL266009: [LTO] Switch Module to std::unique_ptr<>. (authored by davide).
Changed prior to commit:
http://reviews.llvm.org/D18994?vs=53331&id=53335#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18994
Files:
lld/trunk/ELF/LTO.cpp
lld/trunk/ELF/LTO.h
Index: lld/trunk/ELF/LTO.cpp
===================================================================
--- lld/trunk/ELF/LTO.cpp
+++ lld/trunk/ELF/LTO.cpp
@@ -140,32 +140,32 @@
// and return the resulting ObjectFile.
std::unique_ptr<InputFile> BitcodeCompiler::compile() {
for (const auto &Name : InternalizedSyms) {
- GlobalValue *GV = Combined.getNamedValue(Name.first());
+ GlobalValue *GV = Combined->getNamedValue(Name.first());
assert(GV);
internalize(*GV);
}
if (Config->SaveTemps)
- saveBCFile(Combined, ".lto.bc");
+ saveBCFile(*Combined, ".lto.bc");
std::unique_ptr<TargetMachine> TM(getTargetMachine());
- runLTOPasses(Combined, *TM);
+ runLTOPasses(*Combined, *TM);
raw_svector_ostream OS(OwningData);
legacy::PassManager CodeGenPasses;
if (TM->addPassesToEmitFile(CodeGenPasses, OS,
TargetMachine::CGFT_ObjectFile))
fatal("failed to setup codegen");
- CodeGenPasses.run(Combined);
+ CodeGenPasses.run(*Combined);
MB = MemoryBuffer::getMemBuffer(OwningData,
"LLD-INTERNAL-combined-lto-object", false);
if (Config->SaveTemps)
saveLtoObjectFile(MB->getBuffer());
return createObjectFile(*MB);
}
TargetMachine *BitcodeCompiler::getTargetMachine() {
- StringRef TripleStr = Combined.getTargetTriple();
+ StringRef TripleStr = Combined->getTargetTriple();
std::string Msg;
const Target *T = TargetRegistry::lookupTarget(TripleStr, Msg);
if (!T)
Index: lld/trunk/ELF/LTO.h
===================================================================
--- lld/trunk/ELF/LTO.h
+++ lld/trunk/ELF/LTO.h
@@ -39,12 +39,15 @@
void add(BitcodeFile &F);
std::unique_ptr<InputFile> compile();
+ BitcodeCompiler()
+ : Combined(new llvm::Module("ld-temp.o", Context)), Mover(*Combined) {}
+
private:
llvm::TargetMachine *getTargetMachine();
llvm::LLVMContext Context;
- llvm::Module Combined{"ld-temp.o", Context};
- llvm::IRMover Mover{Combined};
+ std::unique_ptr<llvm::Module> Combined;
+ llvm::IRMover Mover;
SmallString<0> OwningData;
std::unique_ptr<MemoryBuffer> MB;
llvm::StringSet<> InternalizedSyms;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18994.53335.patch
Type: text/x-patch
Size: 2179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160411/0955762a/attachment.bin>
More information about the llvm-commits
mailing list