-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[BOLT][RISCV] Fix MCPlusBuilder instrumentation ifaces #136129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-bolt Author: wangjue (WangJee) Changesa) Due to the different capabilities of the functions implemented, rename the createCmpJE function Full diff: https://github.com/llvm/llvm-project/pull/136129.diff 1 Files Affected:
diff --git a/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp b/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
index 0e27d29019e95..ffa6ef1bd9eab 100644
--- a/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
+++ b/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
@@ -555,7 +555,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
.addReg(RegCnt);
}
- InstructionListType createCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
+ InstructionListType createRegCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
const MCSymbol *Target,
MCContext *Ctx) const {
InstructionListType Insts;
@@ -718,7 +718,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
Insts.emplace_back();
loadReg(Insts.back(), RISCV::X10, RISCV::X10, 0);
InstructionListType cmpJmp =
- createCmpJE(RISCV::X10, RISCV::X11, IndCallHandler, Ctx);
+ createRegCmpJE(RISCV::X10, RISCV::X11, IndCallHandler, Ctx);
Insts.insert(Insts.end(), cmpJmp.begin(), cmpJmp.end());
Insts.emplace_back();
createStackPointerIncrement(Insts.back(), 16);
@@ -777,14 +777,14 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
return createGetter(Ctx, "__bolt_instr_num_funcs");
}
- void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg,
- MCPhysReg ZeroReg) const {
+ void convertIndirectCallToLoad(MCInst &Inst,
+ MCPhysReg Reg) override {
bool IsTailCall = isTailCall(Inst);
if (IsTailCall)
removeAnnotation(Inst, MCPlus::MCAnnotation::kTailCall);
Inst.setOpcode(RISCV::ADD);
Inst.insert(Inst.begin(), MCOperand::createReg(Reg));
- Inst.insert(Inst.begin() + 1, MCOperand::createReg(ZeroReg));
+ Inst.insert(Inst.begin() + 1, MCOperand::createReg(RISCV::X0));
return;
}
@@ -845,7 +845,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
InstructionListType Insts;
spillRegs(Insts, {RISCV::X10, RISCV::X11});
Insts.emplace_back(CallInst);
- convertIndirectCallToLoad(Insts.back(), RISCV::X10, RISCV::X0);
+ convertIndirectCallToLoad(Insts.back(), RISCV::X10);
InstructionListType LoadImm = createLoadImmediate(RISCV::X11, CallSiteID);
Insts.insert(Insts.end(), LoadImm.begin(), LoadImm.end());
spillRegs(Insts, {RISCV::X10, RISCV::X11});
|
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions cpp -- bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp View the diff from clang-format here.diff --git a/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp b/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
index ffa6ef1bd..391c1866c 100644
--- a/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
+++ b/bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
@@ -556,8 +556,8 @@ public:
}
InstructionListType createRegCmpJE(MCPhysReg RegNo, MCPhysReg RegTmp,
- const MCSymbol *Target,
- MCContext *Ctx) const {
+ const MCSymbol *Target,
+ MCContext *Ctx) const {
InstructionListType Insts;
Insts.emplace_back(
MCInstBuilder(RISCV::SUB).addReg(RegTmp).addReg(RegNo).addReg(RegNo));
@@ -777,8 +777,7 @@ public:
return createGetter(Ctx, "__bolt_instr_num_funcs");
}
- void convertIndirectCallToLoad(MCInst &Inst,
- MCPhysReg Reg) override {
+ void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg) override {
bool IsTailCall = isTailCall(Inst);
if (IsTailCall)
removeAnnotation(Inst, MCPlus::MCAnnotation::kTailCall);
|
LG, but please fix formatting. |
a) Due to the different capabilities of the functions implemented, rename the createCmpJE function b) Refactor the convertIndirectCallToLoad function to override the interface. Patch by WangJee, originally posted in llvm#136129
The |
a) Due to the different capabilities of the functions implemented, rename the createCmpJE function b) Refactor the convertIndirectCallToLoad function to override the interface. Patch by WangJee, originally posted in #136129
a) Due to the different capabilities of the functions implemented, rename the createCmpJE function b) Refactor the convertIndirectCallToLoad function to override the interface. Patch by WangJee, originally posted in llvm#136129
a) Due to the different capabilities of the functions implemented, rename the createCmpJE function b) Refactor the convertIndirectCallToLoad function to override the interface. Patch by WangJee, originally posted in llvm#136129
a) Due to the different capabilities of the functions implemented, rename the createCmpJE function
b) Refactor the convertIndirectCallToLoad function to override the interface.