CHERIoT-Platform / llvm-project

Fork of LLVM adding CHERIoT, based on the CHERI LLVM fork
4 stars 6 forks source link

Investigate more aggressive MachineOutlining strategies #49

Open resistor opened 5 days ago

resistor commented 5 days ago

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.

resistor commented 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.

resistor commented 4 days ago

https://github.com/llvm/llvm-project/pull/117526

davidchisnall commented 4 days ago

See also CHERIoT-Platform/cheriot-sail#86, which should enable us to use the same outlining strategies as non-CHERI RISC-V.

resistor commented 4 days ago

https://github.com/llvm/llvm-project/pull/115297