Bug ID: 84809
           Summary: RFE: saveall attribute
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot
  Target Milestone: ---

A saveall function attribute, with the meaning that the function saves all
registers and therefore its caller does not need to save them, can be useful.

Two use cases:
 - currently, debugging code dumps generated from assertion failures is
needlessly hard, because gcc clobbers most of the registers during
__assert_fail's execution. If __assert_fail were marked saveall, then the
frames that called __assert_fail would be able to recover their register values
 - reducing the overhead of a cold function called from a hot inline

 inline void hot_function(...) {
   if (some_rare_condition) {
   some more code

if cold_function() is marked saveall, then any registers used by hot_function()
(for example, its arguments) and its caller would be preserved and would not
need to be assumed clobbered.

The implementation would be similar to the interrupt attribute, except for the
return instruction. On x86 special care would be needed for the fpu registers
(would need alloca() since the size of the register stack is only known at
runtime, or perhaps saveall would still clobber fpu registers).

Reply via email to