The code can only address the whole RV32 address space or the lower 2 GiB
of the RV64 address space in small code model, so 32 bits entry is enough.
Cache hit ratio and code size have some improvements.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM. It doesn't make much practical difference, but I wonder if gating the getJumpTableEncoding case on RV64 (as well as your other preconditions) might make sense - as the default EK_BlockAddress lowering is equivalent in that case.
Comment Actions
AArch64 does even better and has a PC-relative jump table lowering whose element size depends on how big your switch is, not the code model in use. Ideally this would be made target-independent, or at least copied to RISC-V. That'd let you have small entries even for medany RV64.
Comment Actions
Thanks for your advice!
It seems that AArch64 has a pass called AArch64CompressJumpTables to do this, I may add it to RISCV later (or make it a target-independent pass).