[llvm] [RISCV] Implement Statepoint and Patchpoint lowering to call instructions (PR #77337)
Sacha Coppey via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 01:49:30 PDT 2024
================
@@ -152,8 +153,40 @@ void RISCVAsmPrinter::LowerPATCHPOINT(MCStreamer &OutStreamer, StackMaps &SM,
PatchPointOpers Opers(&MI);
+ const MachineOperand &CalleeMO = Opers.getCallTarget();
unsigned EncodedBytes = 0;
+ if (CalleeMO.isImm()) {
+ uint64_t CallTarget = CalleeMO.getImm();
+ if (CallTarget) {
+ assert((CallTarget & 0xFFFF'FFFF'FFFF) == CallTarget &&
+ "High 16 bits of call target should be zero.");
+ // Materialize the jump address:
+ SmallVector<MCInst, 8> Seq;
+ RISCVMatInt::generateMCInstSeq(CallTarget, *STI, RISCV::X1, Seq);
+ for (MCInst &Inst : Seq) {
+ MCInst CInst;
+ bool compressed = RISCVRVC::compress(CInst, Inst, *STI);
+ EmitToStreamer(OutStreamer, Inst);
----------------
Zeavee wrote:
Done, thank you!
https://github.com/llvm/llvm-project/pull/77337
More information about the llvm-commits
mailing list