Skip to content

Commit

Permalink
[BOLT][NFC] Readability improvements in X86,Aarch64 MCPlusBuilder
Browse files Browse the repository at this point in the history
Summary: Minor refactorings in target specific MCPlusBuilders to improve readability

(cherry picked from FBD29309701)
  • Loading branch information
aaupov authored and maksfb committed Jun 18, 2021
1 parent dea6c24 commit b964e85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 6 additions & 5 deletions bolt/src/Target/AArch64/AArch64MCPlusBuilder.cpp
Expand Up @@ -569,12 +569,13 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
OpNum != OpEnd; ++OpNum) {
if (!Instr.getOperand(OpNum).isReg())
continue;
Uses[&Instr].push_back(RegAliasTable[Instr.getOperand(OpNum).getReg()]);
unsigned Reg = Instr.getOperand(OpNum).getReg();
MCInst* AliasInst = RegAliasTable[Reg];
Uses[&Instr].push_back(AliasInst);
LLVM_DEBUG({
dbgs() << "Adding reg operand " << Instr.getOperand(OpNum).getReg()
<< " refs ";
if (RegAliasTable[Instr.getOperand(OpNum).getReg()] != nullptr)
RegAliasTable[Instr.getOperand(OpNum).getReg()]->dump();
dbgs() << "Adding reg operand " << Reg << " refs ";
if (AliasInst != nullptr)
AliasInst->dump();
else
dbgs() << "\n";
});
Expand Down
8 changes: 2 additions & 6 deletions bolt/src/Target/X86/X86MCPlusBuilder.cpp
Expand Up @@ -3399,9 +3399,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
NewCall->push_back(CallInst);
MCInst &Compare = NewCall->back();
Compare.clear();
if (CallInst.getOpcode() == X86::CALL64r ||
CallInst.getOpcode() == X86::JMP64r ||
CallInst.getOpcode() == X86::TAILJMPr) {
if (isBranchOnReg(CallInst)) {
Compare.setOpcode(X86::CMP64rr);
} else if (CallInst.getOpcode() == X86::CALL64pcrel32) {
Compare.setOpcode(X86::CMP64ri32);
Expand All @@ -3422,9 +3420,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
NewCall->push_back(CallInst);
MCInst &Compare = NewCall->back();
Compare.clear();
if (CallInst.getOpcode() == X86::CALL64r ||
CallInst.getOpcode() == X86::JMP64r ||
CallInst.getOpcode() == X86::TAILJMPr) {
if (isBranchOnReg(CallInst)) {
Compare.setOpcode(X86::CMP64ri32);
} else {
Compare.setOpcode(X86::CMP64mi32);
Expand Down

0 comments on commit b964e85

Please sign in to comment.