[clang] [llvm] [clang][llvm][PPC] Implement NoCallerSavedRegs attribute (PR #174320)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 5 20:46:52 PST 2026
================
@@ -6007,10 +6007,13 @@ The user can call functions specified with the 'no_caller_saved_registers'
attribute from an interrupt handler without saving and restoring all
call-clobbered registers.
-Functions specified with the 'no_caller_saved_registers' attribute should only
+On X86, functions specified with the 'no_caller_saved_registers' attribute should only
call other functions with the 'no_caller_saved_registers' attribute, or should be
compiled with the '-mgeneral-regs-only' flag to avoid saving unused non-GPR registers.
+On PowerPC, functions specified with the 'no_caller_saved_registers' attribute may not
+return a value as the return register will be restored and thus cannot hold a value.
----------------
Luminyx1 wrote:
The intent was to allow for use cases where even modification of `r3` is considered intrusive (similar to an interrupt handler, but with a standard return routine such that `__attribute__((interrupt))` is not appropriate). What are the semantics of `preserve_most`/`preserve_all`? Would it be appropriate to implement `preserve_most` as saving general registers but not float registers (as x86 and ARM currently do), then `preserve_all` additionally saves float registers + the return register?
https://github.com/llvm/llvm-project/pull/174320
More information about the cfe-commits
mailing list