Open resistor opened 5 days ago
Actually, the existing RISCV code does not implement the "Default" strategy, but rather a limited hybrid of RegSave and NoLRSave that uses X5 in place of the link register, failing if it's not available.
See also CHERIoT-Platform/cheriot-sail#86, which should enable us to use the same outlining strategies as non-CHERI RISC-V.
The AArch64 backend implements a number of different strategies for MachineOutliner which are used to reduce overhead / improve code size savings:
These are reasonably well explained in the upstream code here: https://github.com/llvm/llvm-project/blob/590f451b60d434b26c634a07125fb05baf461fa0/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp#L8570
The RISCV equivalent, by contrast, only implements the Default strategy today. Given that MachineOutliner provides significant code size savings for us, we should investigate porting some or all of the more advanced strategies from AArch64 to RISCV. Ideally this should be done in LLVM upstream, then cherry-picked and adapted for CHERIoT as needed.