Defines RISCV registers for getExceptionPointerRegister() and getExceptionSelectorRegister()
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks for the patch! Do you have a reference for these being the appropriate values?
I based these values on what the GCC tool chain appears to do, but now after searching around I can't find any documentation saying what the correct values should be. I had assumed that this would be written in the ABI documentation (https://github.com/riscv/riscv-elf-psabi-doc (?)) but I can't see any mention there.
I had an old patch that also implemented this and the registers match this patch. It's been over an year so I'm no longer sure where I dug up the information (maybe binutils), but the fact that it matches is good evidence that this is correct, although it would be nice leaving a source here in the review for future reference.
It looks like docs/ExceptionHandling.rst documents that for most targets, the registers are the same as the calling convention GPRs.
Ed, can you please update with a test? You should be able to copy test/Transforms/CallSiteSplitting/lpad.ll to something like test/CodeGen/RISCV/exception-pointer-register.ll then add riscv32 and riscv64 RUN lines and a comment that this test asserted prior to getExceptionPointerRegister and getExceptionSelectorRegister being implemented.
I think you might as well add RV32 and RV64 CHECK prefixes and put the test through update_llc_test_checks.py to ensure the generated code is sane, but with that change this is good to land. Thanks!