A New Approach to Callee-Saved Registers in LLVM

Day 1 | 10:35 | 00:25 | K.3.201 | Mikhail Gudim


Note: I'm reworking this at the moment, some things won't work.

The stream isn't available yet! Check back at 10:35.
Get involved in the conversation!Join the chat

Currently LLVM saves and restores callee-saved registers during prologue-epilogue insertion pass. I would like to present a new approach where we expose callee-saved register constraints early in the backend pipeline. This creates more opportunities for the optimizers and gives good performance gains. Interestingly, we achieve per-register shrink-wrapping for free. However, this makes emission of CFI directives much more complicated. I am currently in the process of upstreaming this work. The proof-of-concept branch is publicly available here: https://github.com/llvm/llvm-project/pull/90819 I have only tried this approach on RISCV, but it could be applied to other targets as well.