This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add Stackmap/Statepoint/Patchpoint support with targets
Needs ReviewPublic

Authored by Zeavee on Jul 15 2022, 5:08 AM.



This patch adds stackmap support for RISC-V with call targets.

Depends on D123496

Diff Detail

Event Timeline

Zeavee created this revision.Jul 15 2022, 5:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2022, 5:08 AM
Zeavee requested review of this revision.Jul 15 2022, 5:08 AM
Zeavee updated this revision to Diff 445140.Jul 15 2022, 3:03 PM

Update tests that do not check data directive using

Avoid RISC-V fixups for StkMapRecord Instruction Offset as they them to be 0.

jrtc27 added inline comments.Jul 15 2022, 3:11 PM
262 ↗(On Diff #445140)

This seems extremely dubious


This seems like a lot of duplication of what already exists for expanding PseudoLI


Why initialise to 0? And why have this large scope when it's only for one case?


Why the blank lines?


These look like some rather machine-generated names; if you don't want to name them, make them %0/1/2/...


What's the actual point of this test? It seems like a bit of a mess of random arithmetic, pointer casting and memory operations, with a return of 10 for unknown reasons. Are the instructions themselves interesting? If not, make them simpler.

Zeavee added inline comments.Jul 16 2022, 3:46 AM
262 ↗(On Diff #445140)

I understand, and it is. I tried to look at where exactly the OffsetExpr is reduced to 0 in the fixups, but I did not find it. I will search more.


I will check if emitting a PseudoLI works correctly.


I will put it in a smaller scope.


They seem to have been added by, as I do not have them in previous versions.


To be honest, I used tests from AArch64, because I thought they would better than test I would create myself. I do not think the instructions themselves are interesting, so I will modify it.

Zeavee updated this revision to Diff 446430.Jul 21 2022, 4:28 AM

Remove useless test and refactor generateInstSeq by adding generateMCInstSeq to avoid code duplication between PseudoLI and Stackmap.

Zeavee updated this revision to Diff 446866.Jul 22 2022, 9:09 AM

Update rv64-patchpoint.ll test.

Zeavee updated this revision to Diff 448032.Jul 27 2022, 7:26 AM

Remove dubious check in RISCVELFStreamer.cpp.

Zeavee updated this revision to Diff 524465.May 22 2023, 1:38 PM

Rebased the patch on main. For context, this patch has been used by the LLVM backend of GraalVM's Native Image project in production for around 4 months with no major issues.

evandro removed a subscriber: evandro.May 22 2023, 5:23 PM
Zeavee updated this revision to Diff 557679.Oct 11 2023, 12:55 AM

Hello, now that D123496 has been merged, would it be possible to have a new review on this patch?

Zeavee added a comment.EditedOct 30 2023, 8:00 AM

Gentle ping

Friendly ping

Zeavee edited reviewers, added: asb; removed:, Dec 8, 2:22 AM