Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Auler <rafaelauler@fb.com>2021-12-20 22:07:46 +0300
committerMaksim Panchenko <maks@fb.com>2021-12-20 22:07:46 +0300
commit3652483c8ea7ec20e8d0cb4aef0630688011cc08 (patch)
tree81084835a6acc99562b27752592142977fa40835 /bolt/lib/Core/BinaryEmitter.cpp
parent9a689946f2477173c3e4a4988d6e230a8ede34e2 (diff)
[BOLTCore] [NFC] Fix braces usages according to LLVM
Summary: Fix according to Coding Standards doc, section Don't Use Braces on Simple Single-Statement Bodies of if/else/loop Statements. This set of changes applies to lib Core only. (cherry picked from FBD33240028)
Diffstat (limited to 'bolt/lib/Core/BinaryEmitter.cpp')
-rw-r--r--bolt/lib/Core/BinaryEmitter.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index ba9d8a7b258a..61ebeae7e391 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -107,9 +107,8 @@ size_t padFunction(const BinaryFunction &Function) {
for (auto &FPI : FunctionPadding) {
std::string Name = FPI.first;
size_t Padding = FPI.second;
- if (Function.hasNameRegex(Name)) {
+ if (Function.hasNameRegex(Name))
return Padding;
- }
}
return 0;
@@ -206,9 +205,8 @@ void BinaryEmitter::emitAll(StringRef OrgSecPrefix) {
ELFDwarfLineSection->setFlags(ELF::SHF_ALLOC);
}
- if (RuntimeLibrary *RtLibrary = BC.getRuntimeLibrary()) {
+ if (RuntimeLibrary *RtLibrary = BC.getRuntimeLibrary())
RtLibrary->emitBinary(BC, Streamer);
- }
BC.getTextSection()->setAlignment(Align(opts::AlignText));
@@ -229,9 +227,8 @@ void BinaryEmitter::emitFunctions() {
const bool HasProfile = BC.NumProfiledFuncs > 0;
const bool OriginalAllowAutoPadding = Streamer.getAllowAutoPadding();
for (BinaryFunction *Function : Functions) {
- if (!BC.shouldEmit(*Function)) {
+ if (!BC.shouldEmit(*Function))
continue;
- }
LLVM_DEBUG(dbgs() << "BOLT: generating code for function \"" << *Function
<< "\" : " << Function->getFunctionNumber() << '\n');
@@ -330,11 +327,10 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function, bool EmitColdPart) {
}
MCSymbol *LSDASymbol =
EmitColdPart ? Function.getColdLSDASymbol() : Function.getLSDASymbol();
- if (LSDASymbol) {
+ if (LSDASymbol)
Streamer.emitCFILsda(LSDASymbol, BC.LSDAEncoding);
- } else {
+ else
Streamer.emitCFILsda(0, dwarf::DW_EH_PE_omit);
- }
// Emit CFI instructions relative to the CIE
for (const MCCFIInstruction &CFIInstr : Function.cie()) {
// Only write CIE CFI insns that LLVM will not already emit
@@ -369,9 +365,8 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function, bool EmitColdPart) {
Streamer.emitFill(Padding, MAI->getTextAlignFillValue());
}
- if (opts::MarkFuncs) {
+ if (opts::MarkFuncs)
Streamer.emitIntValue(BC.MIB->getTrapFillValue(), 1);
- }
// Emit CFI end
if (Function.hasCFI())
@@ -418,9 +413,8 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, bool EmitColdPart,
}
Streamer.emitLabel(BB->getLabel());
if (!EmitCodeOnly) {
- if (MCSymbol *EntrySymbol = BF.getSecondaryEntryPointSymbol(*BB)) {
+ if (MCSymbol *EntrySymbol = BF.getSecondaryEntryPointSymbol(*BB))
Streamer.emitLabel(EntrySymbol);
- }
}
// Check if special alignment for macro-fusion is needed.
@@ -630,9 +624,8 @@ void BinaryEmitter::emitConstantIslands(BinaryFunction &BF, bool EmitColdPart,
return;
// Now emit constant islands from other functions that we may have used in
// this function.
- for (BinaryFunction *ExternalFunc : Islands.Dependency) {
+ for (BinaryFunction *ExternalFunc : Islands.Dependency)
emitConstantIslands(*ExternalFunc, EmitColdPart, &BF);
- }
}
SMLoc BinaryEmitter::emitLineInfo(const BinaryFunction &BF, SMLoc NewLoc,
@@ -718,9 +711,8 @@ void BinaryEmitter::emitJumpTables(const BinaryFunction &BF) {
if (!BF.hasJumpTables())
return;
- if (opts::PrintJumpTables) {
+ if (opts::PrintJumpTables)
outs() << "BOLT-INFO: jump tables for function " << BF << ":\n";
- }
for (auto &JTI : BF.jumpTables()) {
JumpTable &JT = *JTI.second;
@@ -793,11 +785,10 @@ void BinaryEmitter::emitJumpTable(const JumpTable &JT, MCSection *HotSection,
if (!LabelCounts.empty()) {
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: jump table count: "
<< LabelCounts[LI->second] << '\n');
- if (LabelCounts[LI->second] > 0) {
+ if (LabelCounts[LI->second] > 0)
Streamer.SwitchSection(HotSection);
- } else {
+ else
Streamer.SwitchSection(ColdSection);
- }
Streamer.emitValueToAlignment(JT.EntrySize);
}
Streamer.emitLabel(LI->second);
@@ -999,9 +990,8 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, bool EmitColdPart) {
//
// For type table we (re-)encode the table using TTypeEncoding matching
// the current assembler mode.
- for (uint8_t const &Byte : BF.getLSDAActionTable()) {
+ for (uint8_t const &Byte : BF.getLSDAActionTable())
Streamer.emitIntValue(Byte, 1);
- }
const BinaryFunction::LSDATypeTableTy &TypeTable =
(TTypeEncoding & dwarf::DW_EH_PE_indirect) ? BF.getLSDATypeAddressTable()
@@ -1034,9 +1024,8 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, bool EmitColdPart) {
}
}
}
- for (uint8_t const &Byte : BF.getLSDATypeIndexTable()) {
+ for (uint8_t const &Byte : BF.getLSDATypeIndexTable())
Streamer.emitIntValue(Byte, 1);
- }
}
void BinaryEmitter::emitDebugLineInfoForOriginalFunctions() {