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.

Details

Reviewers
reames
asb
Summary

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 update_llc_test_checks.py.

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

jrtc27 added inline comments.Jul 15 2022, 3:11 PM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
262 ↗(On Diff #445140)

This seems extremely dubious

llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
166

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

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1306

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

llvm/test/CodeGen/RISCV/rv64-patchpoint.ll
42

Why the blank lines?

53

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

101–112

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
llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
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.

llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
166

I will check if emitting a PseudoLI works correctly.

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1306

I will put it in a smaller scope.

llvm/test/CodeGen/RISCV/rv64-patchpoint.ll
42

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

101–112

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: llvm.org.Fri, Dec 8, 2:22 AM