forked from OSchip/llvm-project
[ELF] Be compliant with LLVM and rename Lto into LTO. NFCI.
llvm-svn: 287967
This commit is contained in:
parent
696bd63550
commit
3bfa081aa9
|
@ -82,8 +82,8 @@ struct Configuration {
|
|||
llvm::StringRef Emulation;
|
||||
llvm::StringRef Fini;
|
||||
llvm::StringRef Init;
|
||||
llvm::StringRef LtoAAPipeline;
|
||||
llvm::StringRef LtoNewPmPasses;
|
||||
llvm::StringRef LTOAAPipeline;
|
||||
llvm::StringRef LTONewPmPasses;
|
||||
llvm::StringRef OutputFile;
|
||||
llvm::StringRef SoName;
|
||||
llvm::StringRef Sysroot;
|
||||
|
@ -153,10 +153,10 @@ struct Configuration {
|
|||
uint64_t ImageBase;
|
||||
uint64_t MaxPageSize;
|
||||
uint64_t ZStackSize;
|
||||
unsigned LtoPartitions;
|
||||
unsigned LtoO;
|
||||
unsigned LTOPartitions;
|
||||
unsigned LTOO;
|
||||
unsigned Optimize;
|
||||
unsigned ThinLtoJobs;
|
||||
unsigned ThinLTOJobs;
|
||||
};
|
||||
|
||||
// The only instance of Configuration struct.
|
||||
|
|
|
@ -540,21 +540,21 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
|
|||
Config->Entry = getString(Args, OPT_entry);
|
||||
Config->Fini = getString(Args, OPT_fini, "_fini");
|
||||
Config->Init = getString(Args, OPT_init, "_init");
|
||||
Config->LtoAAPipeline = getString(Args, OPT_lto_aa_pipeline);
|
||||
Config->LtoNewPmPasses = getString(Args, OPT_lto_newpm_passes);
|
||||
Config->LTOAAPipeline = getString(Args, OPT_lto_aa_pipeline);
|
||||
Config->LTONewPmPasses = getString(Args, OPT_lto_newpm_passes);
|
||||
Config->OutputFile = getString(Args, OPT_o);
|
||||
Config->SoName = getString(Args, OPT_soname);
|
||||
Config->Sysroot = getString(Args, OPT_sysroot);
|
||||
|
||||
Config->Optimize = getInteger(Args, OPT_O, 1);
|
||||
Config->LtoO = getInteger(Args, OPT_lto_O, 2);
|
||||
if (Config->LtoO > 3)
|
||||
Config->LTOO = getInteger(Args, OPT_lto_O, 2);
|
||||
if (Config->LTOO > 3)
|
||||
error("invalid optimization level for LTO: " + getString(Args, OPT_lto_O));
|
||||
Config->LtoPartitions = getInteger(Args, OPT_lto_partitions, 1);
|
||||
if (Config->LtoPartitions == 0)
|
||||
Config->LTOPartitions = getInteger(Args, OPT_lto_partitions, 1);
|
||||
if (Config->LTOPartitions == 0)
|
||||
error("--lto-partitions: number of threads must be > 0");
|
||||
Config->ThinLtoJobs = getInteger(Args, OPT_thinlto_jobs, -1u);
|
||||
if (Config->ThinLtoJobs == 0)
|
||||
Config->ThinLTOJobs = getInteger(Args, OPT_thinlto_jobs, -1u);
|
||||
if (Config->ThinLTOJobs == 0)
|
||||
error("--thinlto-jobs: number of threads must be > 0");
|
||||
|
||||
Config->ZCombreloc = !hasZOption(Args, "nocombreloc");
|
||||
|
@ -794,7 +794,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
|
|||
Symtab.scanDynamicList();
|
||||
Symtab.scanVersionScript();
|
||||
|
||||
Symtab.addCombinedLtoObject();
|
||||
Symtab.addCombinedLTOObject();
|
||||
if (ErrorCount)
|
||||
return;
|
||||
|
||||
|
|
|
@ -75,24 +75,24 @@ static std::unique_ptr<lto::LTO> createLTO() {
|
|||
Conf.RelocModel = Config->Pic ? Reloc::PIC_ : Reloc::Static;
|
||||
Conf.DisableVerify = Config->DisableVerify;
|
||||
Conf.DiagHandler = diagnosticHandler;
|
||||
Conf.OptLevel = Config->LtoO;
|
||||
Conf.OptLevel = Config->LTOO;
|
||||
|
||||
// Set up a custom pipeline if we've been asked to.
|
||||
Conf.OptPipeline = Config->LtoNewPmPasses;
|
||||
Conf.AAPipeline = Config->LtoAAPipeline;
|
||||
Conf.OptPipeline = Config->LTONewPmPasses;
|
||||
Conf.AAPipeline = Config->LTOAAPipeline;
|
||||
|
||||
if (Config->SaveTemps)
|
||||
checkError(Conf.addSaveTemps(std::string(Config->OutputFile) + ".",
|
||||
/*UseInputModulePath*/ true));
|
||||
|
||||
lto::ThinBackend Backend;
|
||||
if (Config->ThinLtoJobs != -1u)
|
||||
Backend = lto::createInProcessThinBackend(Config->ThinLtoJobs);
|
||||
if (Config->ThinLTOJobs != -1u)
|
||||
Backend = lto::createInProcessThinBackend(Config->ThinLTOJobs);
|
||||
return llvm::make_unique<lto::LTO>(std::move(Conf), Backend,
|
||||
Config->LtoPartitions);
|
||||
Config->LTOPartitions);
|
||||
}
|
||||
|
||||
BitcodeCompiler::BitcodeCompiler() : LtoObj(createLTO()) {}
|
||||
BitcodeCompiler::BitcodeCompiler() : LTOObj(createLTO()) {}
|
||||
|
||||
BitcodeCompiler::~BitcodeCompiler() = default;
|
||||
|
||||
|
@ -128,17 +128,17 @@ void BitcodeCompiler::add(BitcodeFile &F) {
|
|||
if (R.Prevailing)
|
||||
undefine(Sym);
|
||||
}
|
||||
checkError(LtoObj->add(std::move(F.Obj), Resols));
|
||||
checkError(LTOObj->add(std::move(F.Obj), Resols));
|
||||
}
|
||||
|
||||
// Merge all the bitcode files we have seen, codegen the result
|
||||
// and return the resulting ObjectFile(s).
|
||||
std::vector<InputFile *> BitcodeCompiler::compile() {
|
||||
std::vector<InputFile *> Ret;
|
||||
unsigned MaxTasks = LtoObj->getMaxTasks();
|
||||
unsigned MaxTasks = LTOObj->getMaxTasks();
|
||||
Buff.resize(MaxTasks);
|
||||
|
||||
checkError(LtoObj->run([&](size_t Task) {
|
||||
checkError(LTOObj->run([&](size_t Task) {
|
||||
return llvm::make_unique<lto::NativeObjectStream>(
|
||||
llvm::make_unique<raw_svector_ostream>(Buff[Task]));
|
||||
}));
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
std::vector<InputFile *> compile();
|
||||
|
||||
private:
|
||||
std::unique_ptr<llvm::lto::LTO> LtoObj;
|
||||
std::unique_ptr<llvm::lto::LTO> LTOObj;
|
||||
std::vector<SmallString<0>> Buff;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -108,16 +108,16 @@ template <class ELFT> void SymbolTable<ELFT>::addFile(InputFile *File) {
|
|||
// using LLVM functions and replaces bitcode symbols with the results.
|
||||
// Because all bitcode files that consist of a program are passed
|
||||
// to the compiler at once, it can do whole-program optimization.
|
||||
template <class ELFT> void SymbolTable<ELFT>::addCombinedLtoObject() {
|
||||
template <class ELFT> void SymbolTable<ELFT>::addCombinedLTOObject() {
|
||||
if (BitcodeFiles.empty())
|
||||
return;
|
||||
|
||||
// Compile bitcode files and replace bitcode symbols.
|
||||
Lto.reset(new BitcodeCompiler);
|
||||
LTO.reset(new BitcodeCompiler);
|
||||
for (BitcodeFile *F : BitcodeFiles)
|
||||
Lto->add(*F);
|
||||
LTO->add(*F);
|
||||
|
||||
for (InputFile *File : Lto->compile()) {
|
||||
for (InputFile *File : LTO->compile()) {
|
||||
ObjectFile<ELFT> *Obj = cast<ObjectFile<ELFT>>(File);
|
||||
DenseSet<CachedHashStringRef> DummyGroups;
|
||||
Obj->parse(DummyGroups);
|
||||
|
|
|
@ -42,7 +42,7 @@ template <class ELFT> class SymbolTable {
|
|||
|
||||
public:
|
||||
void addFile(InputFile *File);
|
||||
void addCombinedLtoObject();
|
||||
void addCombinedLTOObject();
|
||||
|
||||
ArrayRef<Symbol *> getSymbols() const { return SymVector; }
|
||||
ArrayRef<ObjectFile<ELFT> *> getObjectFiles() const { return ObjectFiles; }
|
||||
|
@ -141,7 +141,7 @@ private:
|
|||
llvm::Optional<llvm::StringMap<std::vector<SymbolBody *>>> DemangledSyms;
|
||||
|
||||
// For LTO.
|
||||
std::unique_ptr<BitcodeCompiler> Lto;
|
||||
std::unique_ptr<BitcodeCompiler> LTO;
|
||||
};
|
||||
|
||||
template <class ELFT> struct Symtab { static SymbolTable<ELFT> *X; };
|
||||
|
|
Loading…
Reference in New Issue