forked from OSchip/llvm-project
Revert "[Bolt][NFC] Change capitalization s/BOLT/Bolt/g"
Summary: (cherry picked from FBD8431879)
This commit is contained in:
parent
789162276d
commit
a7d025139f
|
@ -1,21 +1,21 @@
|
|||
Bolt
|
||||
BOLT
|
||||
====
|
||||
|
||||
Bolt is a post-link optimizer developed to speed up large applications.
|
||||
BOLT is a post-link optimizer developed to speed up large applications.
|
||||
It achieves speed-ups by optimizing application's code layout based on an
|
||||
execution profile gathered by sampling profilers such as Linux `perf` tool.
|
||||
Bolt could operate on any binary with symbol table, but for maximum gains
|
||||
BOLT could operate on any binary with symbol table, but for maximum gains
|
||||
it utilizes relocations saved by a linker (--emit-relocs).
|
||||
|
||||
NOTE: Currently Bolt support is limited to non-PIC/non-PIE binaries.
|
||||
NOTE: Currently BOLT support is limited to non-PIC/PIE binaries.
|
||||
|
||||
INSTALLATION
|
||||
============
|
||||
|
||||
Bolt heavily uses LLVM libraries and by design it is built as one of LLVM
|
||||
BOLT heavily uses LLVM libraries and by design it is built as one of LLVM
|
||||
tools. The build process in not much different from regular LLVM.
|
||||
|
||||
Start with cloning LLVM and Bolt repos:
|
||||
Start with cloning LLVM and BOLT repos:
|
||||
|
||||
> git clone https://github.com/llvm-mirror/llvm llvm
|
||||
> cd llvm/tools
|
||||
|
|
|
@ -258,7 +258,7 @@ public:
|
|||
uint64_t MissedMacroFusionExecCount{0};
|
||||
|
||||
/// Track next available address for new allocatable sections. RewriteInstance
|
||||
/// sets this prior to running Bolt passes, so layout passes are aware of the
|
||||
/// sets this prior to running BOLT passes, so layout passes are aware of the
|
||||
/// final addresses functions will have.
|
||||
uint64_t LayoutStartAddress{0};
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ BinaryFunction::getBasicBlockContainingOffset(uint64_t Offset) {
|
|||
return nullptr;
|
||||
|
||||
/*
|
||||
* This is commented out because it makes Bolt too slow.
|
||||
* This is commented out because it makes BOLT too slow.
|
||||
* assert(std::is_sorted(BasicBlockOffsets.begin(),
|
||||
* BasicBlockOffsets.end(),
|
||||
* CompareBasicBlockOffsets())));
|
||||
|
|
|
@ -50,7 +50,7 @@ IgnoreBuildID("ignore-build-id",
|
|||
|
||||
static cl::opt<bool>
|
||||
TimeAggregator("time-aggr",
|
||||
cl::desc("time Bolt aggregator"),
|
||||
cl::desc("time BOLT aggregator"),
|
||||
cl::init(false),
|
||||
cl::ZeroOrMore,
|
||||
cl::cat(AggregatorCategory));
|
||||
|
|
|
@ -89,7 +89,7 @@ class DataAggregator : public DataReader {
|
|||
|
||||
DenseSet<int64_t> PIDs;
|
||||
|
||||
/// References to core Bolt data structures
|
||||
/// References to core BOLT data structures
|
||||
BinaryContext *BC{nullptr};
|
||||
std::map<uint64_t, BinaryFunction> *BFs{nullptr};
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Optional<StringRef> getLTOCommonName(const StringRef Name) {
|
|||
|
||||
namespace {
|
||||
|
||||
/// Return standard name of the function possibly renamed by Bolt.
|
||||
/// Return standard name of the function possibly renamed by BOLT.
|
||||
StringRef normalizeName(StringRef Name) {
|
||||
// Strip "PG." prefix used for globalized locals.
|
||||
return Name.startswith("PG.") ? Name.substr(2) : Name;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- Passes/Inliner.cpp - Inlining infra for Bolt ---------------------===//
|
||||
//===--- Passes/Inliner.cpp - Inlining infra for BOLT ---------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- Passes/Inliner.h - Inlining infra for Bolt -----------------------===//
|
||||
//===--- Passes/Inliner.h - Inlining infra for BOLT -----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace bolt {
|
|||
|
||||
/// This pass identify indirect jumps to jump tables and reduce their entries
|
||||
/// size from 8 to 4 bytes. For PIC jump tables, it will remove the PIC code
|
||||
/// (since Bolt only process static code and it makes no sense to use expensive
|
||||
/// (since BOLT only process static code and it makes no sense to use expensive
|
||||
/// PIC-style jumps in static code).
|
||||
class JTFootprintReduction : public BinaryFunctionPass {
|
||||
uint64_t TotalJTScore{0};
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace bolt {
|
|||
|
||||
/// LongJmp is veneer-insertion pass originally written for AArch64 that
|
||||
/// compensates for its short-range branches, typically done during linking. We
|
||||
/// pull this pass inside Bolt because here we can do a better job at stub
|
||||
/// pull this pass inside BOLT because here we can do a better job at stub
|
||||
/// inserting by manipulating the CFG, something linkers can't do.
|
||||
///
|
||||
/// LongJmp is a two-step process. In the first step, when function sizes are
|
||||
|
|
|
@ -419,7 +419,7 @@ void RegReAssign::runOnFunctions(BinaryContext &BC,
|
|||
outs() << "BOLT-WARNING: You used -reg-reassign and -update-debug-sections."
|
||||
<< " Some registers were changed but associated AT_LOCATION for "
|
||||
<< "impacted variables were NOT updated! This operation is "
|
||||
<< "currently unsupported by Bolt.\n";
|
||||
<< "currently unsupported by BOLT.\n";
|
||||
}
|
||||
outs() << "BOLT-INFO: Reg Reassignment Pass Stats:\n";
|
||||
outs() << "\t " << FuncsChanged.size() << " functions affected.\n";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ProfileReader.cpp - Bolt profile de-serializer ----------*- C++ -*-===//
|
||||
//===-- ProfileReader.cpp - BOLT profile de-serializer ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ProfileReader.h - Bolt profile deserializer -------------*- C++ -*-===//
|
||||
//===-- ProfileReader.h - BOLT profile deserializer -------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ProfileYAMLMapping.h - mappings for Bolt profile --------*- C++ -*-===//
|
||||
//===-- ProfileYAMLMapping.h - mappings for BOLT profile --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -353,7 +353,7 @@ Verbosity("v",
|
|||
|
||||
static cl::opt<bool>
|
||||
AddBoltInfo("add-bolt-info",
|
||||
cl::desc("add Bolt version and command line argument information to "
|
||||
cl::desc("add BOLT version and command line argument information to "
|
||||
"processed binaries"),
|
||||
cl::init(true),
|
||||
cl::cat(BoltCategory));
|
||||
|
@ -482,7 +482,7 @@ constexpr const char *RewriteInstance::SectionsToOverwrite[];
|
|||
|
||||
const std::string RewriteInstance::OrgSecPrefix = ".bolt.org";
|
||||
|
||||
const std::string RewriteInstance::BoltSecPrefix = ".bolt";
|
||||
const std::string RewriteInstance::BOLTSecPrefix = ".bolt";
|
||||
|
||||
const char RewriteInstance::TimerGroupName[] = "rewrite";
|
||||
const char RewriteInstance::TimerGroupDesc[] = "Rewrite passes";
|
||||
|
@ -835,7 +835,7 @@ void RewriteInstance::discoverStorage() {
|
|||
}
|
||||
|
||||
if (SectionName.startswith(OrgSecPrefix) ||
|
||||
SectionName.startswith(BoltSecPrefix)) {
|
||||
SectionName.startswith(BOLTSecPrefix)) {
|
||||
errs() << "BOLT-ERROR: input file was processed by BOLT. "
|
||||
"Cannot re-optimize.\n";
|
||||
exit(1);
|
||||
|
@ -1001,8 +1001,7 @@ void RewriteInstance::run() {
|
|||
checkLargeFunctions()) {
|
||||
++PassNumber;
|
||||
// Emit again because now some functions have been split
|
||||
outs() << "BOLT-INFO: split-functions: starting pass " << PassNumber
|
||||
<< "...\n";
|
||||
outs() << "BOLT: split-functions: starting pass " << PassNumber << "...\n";
|
||||
reset();
|
||||
executeRewritePass({});
|
||||
}
|
||||
|
@ -1013,7 +1012,7 @@ void RewriteInstance::run() {
|
|||
if (opts::UpdateDebugSections && opts::FixDebugInfoLargeFunctions &&
|
||||
checkLargeFunctions()) {
|
||||
++PassNumber;
|
||||
outs() << "BOLT-INFO: starting pass (ignoring large functions) "
|
||||
outs() << "BOLT: starting pass (ignoring large functions) "
|
||||
<< PassNumber << "...\n";
|
||||
reset();
|
||||
executeRewritePass(LargeFunctions);
|
||||
|
@ -1183,7 +1182,7 @@ void RewriteInstance::discoverFileObjects() {
|
|||
std::string AlternativeName;
|
||||
if (Name.empty()) {
|
||||
if (PLTSection && PLTSection->getAddress() == Address) {
|
||||
// Don't register __BOLT_PLT_PSEUDO twice.
|
||||
// Don't register BOLT_PLT_PSEUDO twice.
|
||||
continue;
|
||||
}
|
||||
UniqueName = "ANONYMOUS." + std::to_string(AnonymousId++);
|
||||
|
@ -2270,7 +2269,7 @@ void RewriteInstance::readRelocations(const SectionRef &Section) {
|
|||
(BD->nameStartsWith("ANONYMOUS") &&
|
||||
(BD->getSectionName().startswith(".plt") ||
|
||||
BD->getSectionName().endswith(".plt")))) &&
|
||||
"Bolt symbol names of all non-section relocations must match "
|
||||
"BOLT symbol names of all non-section relocations must match "
|
||||
"up with symbol names referenced in the relocation");
|
||||
|
||||
if (!opts::AllowSectionRelocations && IsSectionRelocation) {
|
||||
|
@ -3073,7 +3072,7 @@ void RewriteInstance::mapTextSections(orc::VModuleKey Key) {
|
|||
const auto Flags = BinarySection::getFlags(/*IsReadOnly=*/true,
|
||||
/*IsText=*/true,
|
||||
/*IsAllocatable=*/true);
|
||||
auto &Section = BC->registerOrUpdateSection(BoltSecPrefix + ".text",
|
||||
auto &Section = BC->registerOrUpdateSection(BOLTSecPrefix + ".text",
|
||||
ELF::SHT_PROGBITS,
|
||||
Flags,
|
||||
nullptr,
|
||||
|
@ -3578,7 +3577,7 @@ void RewriteInstance::addBoltInfoSection() {
|
|||
std::string DescStr;
|
||||
raw_string_ostream DescOS(DescStr);
|
||||
|
||||
DescOS << "Bolt revision: " << BoltRevision << ", " << "command line:";
|
||||
DescOS << "BOLT revision: " << BoltRevision << ", " << "command line:";
|
||||
for (auto I = 0; I < Argc; ++I) {
|
||||
DescOS << " " << Argv[I];
|
||||
}
|
||||
|
@ -4378,7 +4377,7 @@ void RewriteInstance::rewriteFile() {
|
|||
OverwrittenScore += Function.getFunctionScore();
|
||||
// Overwrite function in the output file.
|
||||
if (opts::Verbosity >= 2) {
|
||||
outs() << "BOLT-INFO: rewriting function \"" << Function << "\"\n";
|
||||
outs() << "BOLT: rewriting function \"" << Function << "\"\n";
|
||||
}
|
||||
OS.pwrite(reinterpret_cast<char *>(Function.getImageAddress()),
|
||||
Function.getImageSize(),
|
||||
|
@ -4408,7 +4407,7 @@ void RewriteInstance::rewriteFile() {
|
|||
++CountOverwrittenFunctions;
|
||||
if (opts::MaxFunctions &&
|
||||
CountOverwrittenFunctions == opts::MaxFunctions) {
|
||||
outs() << "BOLT-INFO: maximum number of functions reached\n";
|
||||
outs() << "BOLT: maximum number of functions reached\n";
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
@ -4416,7 +4415,7 @@ void RewriteInstance::rewriteFile() {
|
|||
|
||||
// Write cold part
|
||||
if (opts::Verbosity >= 2) {
|
||||
outs() << "BOLT-INFO: rewriting function \"" << Function
|
||||
outs() << "BOLT: rewriting function \"" << Function
|
||||
<< "\" (cold part)\n";
|
||||
}
|
||||
OS.pwrite(reinterpret_cast<char*>(Function.cold().getImageAddress()),
|
||||
|
@ -4428,7 +4427,7 @@ void RewriteInstance::rewriteFile() {
|
|||
++CountOverwrittenFunctions;
|
||||
if (opts::MaxFunctions &&
|
||||
CountOverwrittenFunctions == opts::MaxFunctions) {
|
||||
outs() << "BOLT-INFO: maximum number of functions reached\n";
|
||||
outs() << "BOLT: maximum number of functions reached\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4465,7 +4464,7 @@ void RewriteInstance::rewriteFile() {
|
|||
if (!Section.isFinalized() || Section.isLocal())
|
||||
continue;
|
||||
if (opts::Verbosity >= 1) {
|
||||
outs() << "BOLT-INFO: writing new section " << Section.getName()
|
||||
outs() << "BOLT: writing new section " << Section.getName()
|
||||
<< "\n data at 0x" << Twine::utohexstr(Section.getAllocAddress())
|
||||
<< "\n of size " << Section.getOutputSize()
|
||||
<< "\n at offset " << Section.getFileOffset() << '\n';
|
||||
|
|
|
@ -323,7 +323,7 @@ private:
|
|||
std::vector<ELFShdrTy> *OutputSections = nullptr,
|
||||
std::map<std::string, uint32_t> *OutputSectionNameMap = nullptr);
|
||||
|
||||
/// Add a notes section containing the Bolt revision and command line options.
|
||||
/// Add a notes section containing the BOLT revision and command line options.
|
||||
void addBoltInfoSection();
|
||||
|
||||
/// Computes output .debug_line line table offsets for each compile unit,
|
||||
|
@ -522,7 +522,7 @@ private:
|
|||
|
||||
static const std::string OrgSecPrefix;
|
||||
|
||||
static const std::string BoltSecPrefix;
|
||||
static const std::string BOLTSecPrefix;
|
||||
|
||||
/// Number of processed to data relocations. Used to implement the
|
||||
/// -max-relocations debugging option.
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
bool hasPCRelOperand(const MCInst &Inst) const override {
|
||||
// ADRP is blacklisted and is an exception. Even though it has a
|
||||
// PC-relative operand, this operand is not a complete symbol reference
|
||||
// and Bolt shouldn't try to process it in isolation.
|
||||
// and BOLT shouldn't try to process it in isolation.
|
||||
if (isADRP(Inst))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ using namespace bolt;
|
|||
|
||||
namespace opts {
|
||||
|
||||
cl::OptionCategory BoltCategory("Bolt generic options");
|
||||
cl::OptionCategory BoltDiffCategory("BoltDiff generic options");
|
||||
cl::OptionCategory BoltOptCategory("Bolt optimization options");
|
||||
cl::OptionCategory BoltRelocCategory("Bolt options in relocation mode");
|
||||
cl::OptionCategory BoltCategory("BOLT generic options");
|
||||
cl::OptionCategory BoltDiffCategory("BOLTDIFF generic options");
|
||||
cl::OptionCategory BoltOptCategory("BOLT optimization options");
|
||||
cl::OptionCategory BoltRelocCategory("BOLT options in relocation mode");
|
||||
cl::OptionCategory BoltOutputCategory("Output options");
|
||||
cl::OptionCategory AggregatorCategory("Data aggregation options");
|
||||
|
||||
|
@ -124,14 +124,14 @@ const char *BoltRevision =
|
|||
}
|
||||
|
||||
static void printBoltRevision(llvm::raw_ostream &OS) {
|
||||
OS << "Bolt revision " << BoltRevision << "\n";
|
||||
OS << "BOLT revision " << BoltRevision << "\n";
|
||||
}
|
||||
|
||||
void perf2boltMode(int argc, char **argv) {
|
||||
cl::HideUnrelatedOptions(makeArrayRef(opts::Perf2BoltCategories));
|
||||
cl::ParseCommandLineOptions(
|
||||
argc, argv,
|
||||
"perf2bolt - Bolt data aggregator\n"
|
||||
"perf2bolt - BOLT data aggregator\n"
|
||||
"\nEXAMPLE: perf2bolt -p=perf.data executable -o data.fdata\n");
|
||||
if (opts::PerfData.empty()) {
|
||||
errs() << ToolName << ": expected -perfdata=<filename> option.\n";
|
||||
|
@ -159,7 +159,7 @@ void boltDiffMode(int argc, char **argv) {
|
|||
cl::HideUnrelatedOptions(makeArrayRef(opts::BoltDiffCategories));
|
||||
cl::ParseCommandLineOptions(
|
||||
argc, argv,
|
||||
"llvm-boltdiff - Bolt binary diff tool\n"
|
||||
"llvm-boltdiff - BOLT binary diff tool\n"
|
||||
"\nEXAMPLE: llvm-boltdiff -data=a.fdata -data2=b.fdata exec1 exec2\n");
|
||||
if (opts::InputDataFilename2.empty()) {
|
||||
errs() << ToolName << ": expected -data2=<filename> option.\n";
|
||||
|
@ -187,7 +187,7 @@ void boltMode(int argc, char **argv) {
|
|||
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv,
|
||||
"Bolt - Binary Optimization and Layout Tool\n");
|
||||
"BOLT - Binary Optimization and Layout Tool\n");
|
||||
|
||||
if (opts::OutputFilename.empty()) {
|
||||
errs() << ToolName << ": expected -o=<output file> option.\n";
|
||||
|
|
Loading…
Reference in New Issue