Revert "[Bolt][NFC] Change capitalization s/BOLT/Bolt/g"

Summary:

(cherry picked from FBD8431879)
This commit is contained in:
Maksim Panchenko 2018-06-14 14:27:20 -07:00
parent 789162276d
commit a7d025139f
18 changed files with 44 additions and 45 deletions

View File

@ -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 It achieves speed-ups by optimizing application's code layout based on an
execution profile gathered by sampling profilers such as Linux `perf` tool. 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). 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 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. 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 > git clone https://github.com/llvm-mirror/llvm llvm
> cd llvm/tools > cd llvm/tools

View File

@ -258,7 +258,7 @@ public:
uint64_t MissedMacroFusionExecCount{0}; uint64_t MissedMacroFusionExecCount{0};
/// Track next available address for new allocatable sections. RewriteInstance /// 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. /// final addresses functions will have.
uint64_t LayoutStartAddress{0}; uint64_t LayoutStartAddress{0};

View File

@ -300,7 +300,7 @@ BinaryFunction::getBasicBlockContainingOffset(uint64_t Offset) {
return nullptr; 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(), * assert(std::is_sorted(BasicBlockOffsets.begin(),
* BasicBlockOffsets.end(), * BasicBlockOffsets.end(),
* CompareBasicBlockOffsets()))); * CompareBasicBlockOffsets())));

View File

@ -50,7 +50,7 @@ IgnoreBuildID("ignore-build-id",
static cl::opt<bool> static cl::opt<bool>
TimeAggregator("time-aggr", TimeAggregator("time-aggr",
cl::desc("time Bolt aggregator"), cl::desc("time BOLT aggregator"),
cl::init(false), cl::init(false),
cl::ZeroOrMore, cl::ZeroOrMore,
cl::cat(AggregatorCategory)); cl::cat(AggregatorCategory));

View File

@ -89,7 +89,7 @@ class DataAggregator : public DataReader {
DenseSet<int64_t> PIDs; DenseSet<int64_t> PIDs;
/// References to core Bolt data structures /// References to core BOLT data structures
BinaryContext *BC{nullptr}; BinaryContext *BC{nullptr};
std::map<uint64_t, BinaryFunction> *BFs{nullptr}; std::map<uint64_t, BinaryFunction> *BFs{nullptr};

View File

@ -33,7 +33,7 @@ Optional<StringRef> getLTOCommonName(const StringRef Name) {
namespace { 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) { StringRef normalizeName(StringRef Name) {
// Strip "PG." prefix used for globalized locals. // Strip "PG." prefix used for globalized locals.
return Name.startswith("PG.") ? Name.substr(2) : Name; return Name.startswith("PG.") ? Name.substr(2) : Name;

View File

@ -1,4 +1,4 @@
//===--- Passes/Inliner.cpp - Inlining infra for Bolt ---------------------===// //===--- Passes/Inliner.cpp - Inlining infra for BOLT ---------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //

View File

@ -1,4 +1,4 @@
//===--- Passes/Inliner.h - Inlining infra for Bolt -----------------------===// //===--- Passes/Inliner.h - Inlining infra for BOLT -----------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //

View File

@ -23,7 +23,7 @@ namespace bolt {
/// This pass identify indirect jumps to jump tables and reduce their entries /// 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 /// 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). /// PIC-style jumps in static code).
class JTFootprintReduction : public BinaryFunctionPass { class JTFootprintReduction : public BinaryFunctionPass {
uint64_t TotalJTScore{0}; uint64_t TotalJTScore{0};

View File

@ -18,7 +18,7 @@ namespace bolt {
/// LongJmp is veneer-insertion pass originally written for AArch64 that /// LongJmp is veneer-insertion pass originally written for AArch64 that
/// compensates for its short-range branches, typically done during linking. We /// 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. /// inserting by manipulating the CFG, something linkers can't do.
/// ///
/// LongJmp is a two-step process. In the first step, when function sizes are /// LongJmp is a two-step process. In the first step, when function sizes are

View File

@ -419,7 +419,7 @@ void RegReAssign::runOnFunctions(BinaryContext &BC,
outs() << "BOLT-WARNING: You used -reg-reassign and -update-debug-sections." outs() << "BOLT-WARNING: You used -reg-reassign and -update-debug-sections."
<< " Some registers were changed but associated AT_LOCATION for " << " Some registers were changed but associated AT_LOCATION for "
<< "impacted variables were NOT updated! This operation is " << "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() << "BOLT-INFO: Reg Reassignment Pass Stats:\n";
outs() << "\t " << FuncsChanged.size() << " functions affected.\n"; outs() << "\t " << FuncsChanged.size() << " functions affected.\n";

View File

@ -1,4 +1,4 @@
//===-- ProfileReader.cpp - Bolt profile de-serializer ----------*- C++ -*-===// //===-- ProfileReader.cpp - BOLT profile de-serializer ----------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //

View File

@ -1,4 +1,4 @@
//===-- ProfileReader.h - Bolt profile deserializer -------------*- C++ -*-===// //===-- ProfileReader.h - BOLT profile deserializer -------------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //

View File

@ -1,4 +1,4 @@
//===-- ProfileYAMLMapping.h - mappings for Bolt profile --------*- C++ -*-===// //===-- ProfileYAMLMapping.h - mappings for BOLT profile --------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //

View File

@ -353,7 +353,7 @@ Verbosity("v",
static cl::opt<bool> static cl::opt<bool>
AddBoltInfo("add-bolt-info", 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"), "processed binaries"),
cl::init(true), cl::init(true),
cl::cat(BoltCategory)); cl::cat(BoltCategory));
@ -482,7 +482,7 @@ constexpr const char *RewriteInstance::SectionsToOverwrite[];
const std::string RewriteInstance::OrgSecPrefix = ".bolt.org"; 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::TimerGroupName[] = "rewrite";
const char RewriteInstance::TimerGroupDesc[] = "Rewrite passes"; const char RewriteInstance::TimerGroupDesc[] = "Rewrite passes";
@ -835,7 +835,7 @@ void RewriteInstance::discoverStorage() {
} }
if (SectionName.startswith(OrgSecPrefix) || if (SectionName.startswith(OrgSecPrefix) ||
SectionName.startswith(BoltSecPrefix)) { SectionName.startswith(BOLTSecPrefix)) {
errs() << "BOLT-ERROR: input file was processed by BOLT. " errs() << "BOLT-ERROR: input file was processed by BOLT. "
"Cannot re-optimize.\n"; "Cannot re-optimize.\n";
exit(1); exit(1);
@ -1001,8 +1001,7 @@ void RewriteInstance::run() {
checkLargeFunctions()) { checkLargeFunctions()) {
++PassNumber; ++PassNumber;
// Emit again because now some functions have been split // Emit again because now some functions have been split
outs() << "BOLT-INFO: split-functions: starting pass " << PassNumber outs() << "BOLT: split-functions: starting pass " << PassNumber << "...\n";
<< "...\n";
reset(); reset();
executeRewritePass({}); executeRewritePass({});
} }
@ -1013,7 +1012,7 @@ void RewriteInstance::run() {
if (opts::UpdateDebugSections && opts::FixDebugInfoLargeFunctions && if (opts::UpdateDebugSections && opts::FixDebugInfoLargeFunctions &&
checkLargeFunctions()) { checkLargeFunctions()) {
++PassNumber; ++PassNumber;
outs() << "BOLT-INFO: starting pass (ignoring large functions) " outs() << "BOLT: starting pass (ignoring large functions) "
<< PassNumber << "...\n"; << PassNumber << "...\n";
reset(); reset();
executeRewritePass(LargeFunctions); executeRewritePass(LargeFunctions);
@ -1183,7 +1182,7 @@ void RewriteInstance::discoverFileObjects() {
std::string AlternativeName; std::string AlternativeName;
if (Name.empty()) { if (Name.empty()) {
if (PLTSection && PLTSection->getAddress() == Address) { if (PLTSection && PLTSection->getAddress() == Address) {
// Don't register __BOLT_PLT_PSEUDO twice. // Don't register BOLT_PLT_PSEUDO twice.
continue; continue;
} }
UniqueName = "ANONYMOUS." + std::to_string(AnonymousId++); UniqueName = "ANONYMOUS." + std::to_string(AnonymousId++);
@ -2270,7 +2269,7 @@ void RewriteInstance::readRelocations(const SectionRef &Section) {
(BD->nameStartsWith("ANONYMOUS") && (BD->nameStartsWith("ANONYMOUS") &&
(BD->getSectionName().startswith(".plt") || (BD->getSectionName().startswith(".plt") ||
BD->getSectionName().endswith(".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"); "up with symbol names referenced in the relocation");
if (!opts::AllowSectionRelocations && IsSectionRelocation) { if (!opts::AllowSectionRelocations && IsSectionRelocation) {
@ -3073,7 +3072,7 @@ void RewriteInstance::mapTextSections(orc::VModuleKey Key) {
const auto Flags = BinarySection::getFlags(/*IsReadOnly=*/true, const auto Flags = BinarySection::getFlags(/*IsReadOnly=*/true,
/*IsText=*/true, /*IsText=*/true,
/*IsAllocatable=*/true); /*IsAllocatable=*/true);
auto &Section = BC->registerOrUpdateSection(BoltSecPrefix + ".text", auto &Section = BC->registerOrUpdateSection(BOLTSecPrefix + ".text",
ELF::SHT_PROGBITS, ELF::SHT_PROGBITS,
Flags, Flags,
nullptr, nullptr,
@ -3578,7 +3577,7 @@ void RewriteInstance::addBoltInfoSection() {
std::string DescStr; std::string DescStr;
raw_string_ostream DescOS(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) { for (auto I = 0; I < Argc; ++I) {
DescOS << " " << Argv[I]; DescOS << " " << Argv[I];
} }
@ -4378,7 +4377,7 @@ void RewriteInstance::rewriteFile() {
OverwrittenScore += Function.getFunctionScore(); OverwrittenScore += Function.getFunctionScore();
// Overwrite function in the output file. // Overwrite function in the output file.
if (opts::Verbosity >= 2) { if (opts::Verbosity >= 2) {
outs() << "BOLT-INFO: rewriting function \"" << Function << "\"\n"; outs() << "BOLT: rewriting function \"" << Function << "\"\n";
} }
OS.pwrite(reinterpret_cast<char *>(Function.getImageAddress()), OS.pwrite(reinterpret_cast<char *>(Function.getImageAddress()),
Function.getImageSize(), Function.getImageSize(),
@ -4408,7 +4407,7 @@ void RewriteInstance::rewriteFile() {
++CountOverwrittenFunctions; ++CountOverwrittenFunctions;
if (opts::MaxFunctions && if (opts::MaxFunctions &&
CountOverwrittenFunctions == opts::MaxFunctions) { CountOverwrittenFunctions == opts::MaxFunctions) {
outs() << "BOLT-INFO: maximum number of functions reached\n"; outs() << "BOLT: maximum number of functions reached\n";
break; break;
} }
continue; continue;
@ -4416,7 +4415,7 @@ void RewriteInstance::rewriteFile() {
// Write cold part // Write cold part
if (opts::Verbosity >= 2) { if (opts::Verbosity >= 2) {
outs() << "BOLT-INFO: rewriting function \"" << Function outs() << "BOLT: rewriting function \"" << Function
<< "\" (cold part)\n"; << "\" (cold part)\n";
} }
OS.pwrite(reinterpret_cast<char*>(Function.cold().getImageAddress()), OS.pwrite(reinterpret_cast<char*>(Function.cold().getImageAddress()),
@ -4428,7 +4427,7 @@ void RewriteInstance::rewriteFile() {
++CountOverwrittenFunctions; ++CountOverwrittenFunctions;
if (opts::MaxFunctions && if (opts::MaxFunctions &&
CountOverwrittenFunctions == opts::MaxFunctions) { CountOverwrittenFunctions == opts::MaxFunctions) {
outs() << "BOLT-INFO: maximum number of functions reached\n"; outs() << "BOLT: maximum number of functions reached\n";
break; break;
} }
} }
@ -4465,7 +4464,7 @@ void RewriteInstance::rewriteFile() {
if (!Section.isFinalized() || Section.isLocal()) if (!Section.isFinalized() || Section.isLocal())
continue; continue;
if (opts::Verbosity >= 1) { 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 data at 0x" << Twine::utohexstr(Section.getAllocAddress())
<< "\n of size " << Section.getOutputSize() << "\n of size " << Section.getOutputSize()
<< "\n at offset " << Section.getFileOffset() << '\n'; << "\n at offset " << Section.getFileOffset() << '\n';

View File

@ -323,7 +323,7 @@ private:
std::vector<ELFShdrTy> *OutputSections = nullptr, std::vector<ELFShdrTy> *OutputSections = nullptr,
std::map<std::string, uint32_t> *OutputSectionNameMap = 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(); void addBoltInfoSection();
/// Computes output .debug_line line table offsets for each compile unit, /// 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 OrgSecPrefix;
static const std::string BoltSecPrefix; static const std::string BOLTSecPrefix;
/// Number of processed to data relocations. Used to implement the /// Number of processed to data relocations. Used to implement the
/// -max-relocations debugging option. /// -max-relocations debugging option.

View File

@ -214,7 +214,7 @@ public:
bool hasPCRelOperand(const MCInst &Inst) const override { bool hasPCRelOperand(const MCInst &Inst) const override {
// ADRP is blacklisted and is an exception. Even though it has a // ADRP is blacklisted and is an exception. Even though it has a
// PC-relative operand, this operand is not a complete symbol reference // 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)) if (isADRP(Inst))
return false; return false;

View File

@ -33,10 +33,10 @@ using namespace bolt;
namespace opts { namespace opts {
cl::OptionCategory BoltCategory("Bolt generic options"); cl::OptionCategory BoltCategory("BOLT generic options");
cl::OptionCategory BoltDiffCategory("BoltDiff generic options"); cl::OptionCategory BoltDiffCategory("BOLTDIFF generic options");
cl::OptionCategory BoltOptCategory("Bolt optimization options"); cl::OptionCategory BoltOptCategory("BOLT optimization options");
cl::OptionCategory BoltRelocCategory("Bolt options in relocation mode"); cl::OptionCategory BoltRelocCategory("BOLT options in relocation mode");
cl::OptionCategory BoltOutputCategory("Output options"); cl::OptionCategory BoltOutputCategory("Output options");
cl::OptionCategory AggregatorCategory("Data aggregation options"); cl::OptionCategory AggregatorCategory("Data aggregation options");
@ -124,14 +124,14 @@ const char *BoltRevision =
} }
static void printBoltRevision(llvm::raw_ostream &OS) { static void printBoltRevision(llvm::raw_ostream &OS) {
OS << "Bolt revision " << BoltRevision << "\n"; OS << "BOLT revision " << BoltRevision << "\n";
} }
void perf2boltMode(int argc, char **argv) { void perf2boltMode(int argc, char **argv) {
cl::HideUnrelatedOptions(makeArrayRef(opts::Perf2BoltCategories)); cl::HideUnrelatedOptions(makeArrayRef(opts::Perf2BoltCategories));
cl::ParseCommandLineOptions( cl::ParseCommandLineOptions(
argc, argv, argc, argv,
"perf2bolt - Bolt data aggregator\n" "perf2bolt - BOLT data aggregator\n"
"\nEXAMPLE: perf2bolt -p=perf.data executable -o data.fdata\n"); "\nEXAMPLE: perf2bolt -p=perf.data executable -o data.fdata\n");
if (opts::PerfData.empty()) { if (opts::PerfData.empty()) {
errs() << ToolName << ": expected -perfdata=<filename> option.\n"; errs() << ToolName << ": expected -perfdata=<filename> option.\n";
@ -159,7 +159,7 @@ void boltDiffMode(int argc, char **argv) {
cl::HideUnrelatedOptions(makeArrayRef(opts::BoltDiffCategories)); cl::HideUnrelatedOptions(makeArrayRef(opts::BoltDiffCategories));
cl::ParseCommandLineOptions( cl::ParseCommandLineOptions(
argc, argv, 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"); "\nEXAMPLE: llvm-boltdiff -data=a.fdata -data2=b.fdata exec1 exec2\n");
if (opts::InputDataFilename2.empty()) { if (opts::InputDataFilename2.empty()) {
errs() << ToolName << ": expected -data2=<filename> option.\n"; errs() << ToolName << ": expected -data2=<filename> option.\n";
@ -187,7 +187,7 @@ void boltMode(int argc, char **argv) {
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion); cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
cl::ParseCommandLineOptions(argc, argv, cl::ParseCommandLineOptions(argc, argv,
"Bolt - Binary Optimization and Layout Tool\n"); "BOLT - Binary Optimization and Layout Tool\n");
if (opts::OutputFilename.empty()) { if (opts::OutputFilename.empty()) {
errs() << ToolName << ": expected -o=<output file> option.\n"; errs() << ToolName << ": expected -o=<output file> option.\n";