[PATCH] D153342: [BOLT][RISCV] Implement return/unconditional branch creation
Job Noorman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 21 01:21:30 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5e67ae151e7d: [BOLT][RISCV] Implement return/unconditional branch creation (authored by jobnoorman).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153342/new/
https://reviews.llvm.org/D153342
Files:
bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
Index: bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
===================================================================
--- bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
+++ bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp
@@ -134,6 +134,26 @@
return true;
}
+ bool createReturn(MCInst &Inst) const override {
+ // TODO "c.jr ra" when RVC is enabled
+ Inst.setOpcode(RISCV::JALR);
+ Inst.clear();
+ Inst.addOperand(MCOperand::createReg(RISCV::X0));
+ Inst.addOperand(MCOperand::createReg(RISCV::X1));
+ Inst.addOperand(MCOperand::createImm(0));
+ return true;
+ }
+
+ bool createUncondBranch(MCInst &Inst, const MCSymbol *TBB,
+ MCContext *Ctx) const override {
+ Inst.setOpcode(RISCV::JAL);
+ Inst.clear();
+ Inst.addOperand(MCOperand::createReg(RISCV::X0));
+ Inst.addOperand(MCOperand::createExpr(
+ MCSymbolRefExpr::create(TBB, MCSymbolRefExpr::VK_None, *Ctx)));
+ return true;
+ }
+
bool analyzeBranch(InstructionIterator Begin, InstructionIterator End,
const MCSymbol *&TBB, const MCSymbol *&FBB,
MCInst *&CondBranch,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153342.533171.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230621/41453cc5/attachment.bin>
More information about the llvm-commits
mailing list