Skip to content

Commit 92bd2e1

Browse files
committed
[BOLT] Format files using LLVM style.
1 parent 7ca8b31 commit 92bd2e1

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,13 +1717,12 @@ class MCPlusBuilder {
17171717
/// Create a sequence of instructions to compare contents of a register
17181718
/// \p RegNo to immediate \Imm and jump to \p Target if they are different.
17191719
virtual InstructionListType createCmpJNE(MCPhysReg RegNo, int64_t Imm,
1720-
const MCSymbol *Target,
1721-
MCContext *Ctx) const {
1720+
const MCSymbol *Target,
1721+
MCContext *Ctx) const {
17221722
llvm_unreachable("not implemented");
17231723
return {};
17241724
}
17251725

1726-
17271726
/// Creates inline memcpy instruction. If \p ReturnEnd is true, then return
17281727
/// (dest + n) instead of dest.
17291728
virtual InstructionListType createInlineMemcpy(bool ReturnEnd) const {

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,14 +1321,14 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
13211321

13221322
int getUncondBranchEncodingSize() const override { return 28; }
13231323

1324-
//This helper function creates the snippet of code
1325-
//that compares a register RegNo with an immedaite Imm,
1326-
//and jumps to Target if they are equal.
1327-
//cmp RegNo, #Imm
1328-
//b.eq Target
1329-
//where cmp is an for subs, which results in the code below:
1330-
//subs xzr, RegNo, #Imm
1331-
//b.eq Target.
1324+
// This helper function creates the snippet of code
1325+
// that compares a register RegNo with an immedaite Imm,
1326+
// and jumps to Target if they are equal.
1327+
// cmp RegNo, #Imm
1328+
// b.eq Target
1329+
// where cmp is an for subs, which results in the code below:
1330+
// subs xzr, RegNo, #Imm
1331+
// b.eq Target.
13321332
InstructionListType createCmpJE(MCPhysReg RegNo, int64_t Imm,
13331333
const MCSymbol *Target,
13341334
MCContext *Ctx) const override {
@@ -1345,17 +1345,17 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
13451345
return Code;
13461346
}
13471347

1348-
//This helper function creates the snippet of code
1349-
//that compares a register RegNo with an immedaite Imm,
1350-
//and jumps to Target if they are not equal.
1351-
//cmp RegNo, #Imm
1352-
//b.ne Target
1353-
//where cmp is an for subs, which results in the code below:
1354-
//subs xzr, RegNo, #Imm
1355-
//b.ne Target.
1348+
// This helper function creates the snippet of code
1349+
// that compares a register RegNo with an immedaite Imm,
1350+
// and jumps to Target if they are not equal.
1351+
// cmp RegNo, #Imm
1352+
// b.ne Target
1353+
// where cmp is an for subs, which results in the code below:
1354+
// subs xzr, RegNo, #Imm
1355+
// b.ne Target.
13561356
InstructionListType createCmpJNE(MCPhysReg RegNo, int64_t Imm,
1357-
const MCSymbol *Target,
1358-
MCContext *Ctx) const override {
1357+
const MCSymbol *Target,
1358+
MCContext *Ctx) const override {
13591359
InstructionListType Code;
13601360
Code.emplace_back(MCInstBuilder(AArch64::SUBSXri)
13611361
.addReg(AArch64::XZR)

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,12 +2437,10 @@ class X86MCPlusBuilder : public MCPlusBuilder {
24372437
}
24382438

24392439
InstructionListType createCmpJNE(MCPhysReg RegNo, int64_t Imm,
2440-
const MCSymbol *Target,
2441-
MCContext *Ctx) const override {
2440+
const MCSymbol *Target,
2441+
MCContext *Ctx) const override {
24422442
InstructionListType Code;
2443-
Code.emplace_back(MCInstBuilder(X86::CMP64ri8)
2444-
.addReg(RegNo)
2445-
.addImm(Imm));
2443+
Code.emplace_back(MCInstBuilder(X86::CMP64ri8).addReg(RegNo).addImm(Imm));
24462444
Code.emplace_back(MCInstBuilder(X86::JCC_1)
24472445
.addExpr(MCSymbolRefExpr::create(
24482446
Target, MCSymbolRefExpr::VK_None, *Ctx))

bolt/unittests/Core/MCPlusBuilder.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ TEST_P(MCPlusBuilderTester, AArch64_CmpJE) {
113113
BinaryFunction *BF = BC->createInjectedBinaryFunction("BF", true);
114114
std::unique_ptr<BinaryBasicBlock> BB = BF->createBasicBlock();
115115

116-
InstructionListType Instrs = BC->MIB->createCmpJE(AArch64::X0, 2, BB->getLabel(), BC->Ctx.get());
116+
InstructionListType Instrs =
117+
BC->MIB->createCmpJE(AArch64::X0, 2, BB->getLabel(), BC->Ctx.get());
117118
BB->addInstructions(Instrs.begin(), Instrs.end());
118119
BB->addSuccessor(BB.get());
119-
120+
120121
auto II = BB->begin();
121122
ASSERT_EQ(II->getOpcode(), AArch64::SUBSXri);
122123
ASSERT_EQ(II->getOperand(0).getReg(), AArch64::XZR);
@@ -126,7 +127,7 @@ TEST_P(MCPlusBuilderTester, AArch64_CmpJE) {
126127
II++;
127128
ASSERT_EQ(II->getOpcode(), AArch64::Bcc);
128129
ASSERT_EQ(II->getOperand(0).getImm(), AArch64CC::EQ);
129-
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II,1);
130+
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II, 1);
130131
ASSERT_EQ(Label, BB->getLabel());
131132
}
132133

@@ -135,11 +136,12 @@ TEST_P(MCPlusBuilderTester, AArch64_CmpJNE) {
135136
GTEST_SKIP();
136137
BinaryFunction *BF = BC->createInjectedBinaryFunction("BF", true);
137138
std::unique_ptr<BinaryBasicBlock> BB = BF->createBasicBlock();
138-
139-
InstructionListType Instrs = BC->MIB->createCmpJNE(AArch64::X0, 2, BB->getLabel(), BC->Ctx.get());
139+
140+
InstructionListType Instrs =
141+
BC->MIB->createCmpJNE(AArch64::X0, 2, BB->getLabel(), BC->Ctx.get());
140142
BB->addInstructions(Instrs.begin(), Instrs.end());
141143
BB->addSuccessor(BB.get());
142-
144+
143145
auto II = BB->begin();
144146
ASSERT_EQ(II->getOpcode(), AArch64::SUBSXri);
145147
ASSERT_EQ(II->getOperand(0).getReg(), AArch64::XZR);
@@ -149,7 +151,7 @@ TEST_P(MCPlusBuilderTester, AArch64_CmpJNE) {
149151
II++;
150152
ASSERT_EQ(II->getOpcode(), AArch64::Bcc);
151153
ASSERT_EQ(II->getOperand(0).getImm(), AArch64CC::NE);
152-
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II,1);
154+
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II, 1);
153155
ASSERT_EQ(Label, BB->getLabel());
154156
}
155157

@@ -195,7 +197,8 @@ TEST_P(MCPlusBuilderTester, X86_CmpJE) {
195197
BinaryFunction *BF = BC->createInjectedBinaryFunction("BF", true);
196198
std::unique_ptr<BinaryBasicBlock> BB = BF->createBasicBlock();
197199

198-
InstructionListType Instrs = BC->MIB->createCmpJE(X86::EAX, 2, BB->getLabel(), BC->Ctx.get());
200+
InstructionListType Instrs =
201+
BC->MIB->createCmpJE(X86::EAX, 2, BB->getLabel(), BC->Ctx.get());
199202
BB->addInstructions(Instrs.begin(), Instrs.end());
200203
BB->addSuccessor(BB.get());
201204

@@ -205,7 +208,7 @@ TEST_P(MCPlusBuilderTester, X86_CmpJE) {
205208
ASSERT_EQ(II->getOperand(1).getImm(), 2);
206209
II++;
207210
ASSERT_EQ(II->getOpcode(), X86::JCC_1);
208-
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II,0);
211+
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II, 0);
209212
ASSERT_EQ(Label, BB->getLabel());
210213
ASSERT_EQ(II->getOperand(1).getImm(), X86::COND_E);
211214
}
@@ -216,7 +219,8 @@ TEST_P(MCPlusBuilderTester, X86_CmpJNE) {
216219
BinaryFunction *BF = BC->createInjectedBinaryFunction("BF", true);
217220
std::unique_ptr<BinaryBasicBlock> BB = BF->createBasicBlock();
218221

219-
InstructionListType Instrs = BC->MIB->createCmpJNE(X86::EAX, 2, BB->getLabel(), BC->Ctx.get());
222+
InstructionListType Instrs =
223+
BC->MIB->createCmpJNE(X86::EAX, 2, BB->getLabel(), BC->Ctx.get());
220224
BB->addInstructions(Instrs.begin(), Instrs.end());
221225
BB->addSuccessor(BB.get());
222226

@@ -226,7 +230,7 @@ TEST_P(MCPlusBuilderTester, X86_CmpJNE) {
226230
ASSERT_EQ(II->getOperand(1).getImm(), 2);
227231
II++;
228232
ASSERT_EQ(II->getOpcode(), X86::JCC_1);
229-
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II,0);
233+
const MCSymbol *Label = BC->MIB->getTargetSymbol(*II, 0);
230234
ASSERT_EQ(Label, BB->getLabel());
231235
ASSERT_EQ(II->getOperand(1).getImm(), X86::COND_NE);
232236
}

0 commit comments

Comments
 (0)