https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110899

Mathias Stearn <redbeard0531 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redbeard0531 at gmail dot com

--- Comment #17 from Mathias Stearn <redbeard0531 at gmail dot com> ---
> I don't see how that helps.  Imagine a preserve_all function foo that calls
printf.  How do you propose that 'foo' saves all parts of the SSE registers,
even those that aren't invented yet, or those that can't be touched by the
current ISA?  (printf might clobber all of these)

Maybe this should be in a different ticket, but it would be great to have some
attribute that says "I promise, on pain of ODR violations, to compile every TU
which defines or calls this function with the same compiler (at least same
"brand" and major version, maybe even patch version) and with the same target
and ISA-affecting flags". That would let the compiler know that it is free to
assume that any registers that it would consider using will be correctly saved
by the caller. It also lets you define (and change!) whatever mapping from
function sig+attributes to calling convention you want and trust that both
sides will do the right thing, without needing to worry about
backwards/forwards compatibility with other compilers.

This obviously is not usable in public headers of pre-compiled libs, but it
would be really useful for "leaf" projects that control their build system and
can ensure uniformity. It can also be used for internal functions in
precompiled libs as long as they use a moderately sane build strategy.

Reply via email to