public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/56314] New: Please allow per-function specification of register conventions
@ 2013-02-14  1:56 hpa at zytor dot com
  2013-02-14  2:04 ` [Bug other/56314] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hpa at zytor dot com @ 2013-02-14  1:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56314

             Bug #: 56314
           Summary: Please allow per-function specification of register
                    conventions
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hpa@zytor.com


gcc allows register specifications (saved, clobbered, reserved) to be changed
on a per-file basis.  However, for optimization uses it would be much more
useful if they could be defined on a per-function basis using attributes, just
as calling conventions can be specified with attributes.

In the Linux kernel world we currently have several uses of functions with ad
hoc calling conventions.  We have to wrap them in assembly wrappers, and either
write them in assembly or put them in separate files with the calling
convention specified with compiler options.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/56314] Please allow per-function specification of register conventions
  2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
@ 2013-02-14  2:04 ` pinskia at gcc dot gnu.org
  2013-02-14  2:24 ` hpa at zytor dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-02-14  2:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56314

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |4.8.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-14 02:03:44 UTC ---
Can you show an example of what you mean by this?
Also it might be better to come up with a full semantics of such a change as
right now we don't know the full semantics of these changes.  Also is this only
for x86 (and x86_64) or for other targets too?  There are ways currently
already to spell out the regparm for x86 which might be enough for your usage
but without knowledge of the linux kernel, it is hard to know what you need.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/56314] Please allow per-function specification of register conventions
  2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
  2013-02-14  2:04 ` [Bug other/56314] " pinskia at gcc dot gnu.org
@ 2013-02-14  2:24 ` hpa at zytor dot com
  2013-02-14 10:29 ` [Bug middle-end/56314] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hpa at zytor dot com @ 2013-02-14  2:24 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56314

--- Comment #2 from H. Peter Anvin <hpa at zytor dot com> 2013-02-14 02:23:53 UTC ---
Consider the following syntax:

__attribute__((saved(...),used(...),fixed(...)))

... as the equivalent to -fcall-saved-*, -fcall-used-*, and -ffixed-*
respectively.

In Linux/x86-64 we could then decorate the function __sw_hweight64() as:

unsigned long __attribute__((saved(rdi,rsi,rdx,rcx,r8,r9,r10,r11)))
__sw_hweight64(__u64 v);

One major use for this for us is to be able to reduce the call site impact of
certain small functions by reducing the used set of those functions.

Please let me know if you need more examples.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/56314] Please allow per-function specification of register conventions
  2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
  2013-02-14  2:04 ` [Bug other/56314] " pinskia at gcc dot gnu.org
  2013-02-14  2:24 ` hpa at zytor dot com
@ 2013-02-14 10:29 ` rguenth at gcc dot gnu.org
  2013-02-15  6:52 ` benh at kernel dot crashing.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-14 10:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56314

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization, ra
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-14
                 CC|                            |vmakarov at gcc dot gnu.org
          Component|other                       |middle-end
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-14 10:29:27 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/56314] Please allow per-function specification of register conventions
  2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
                   ` (2 preceding siblings ...)
  2013-02-14 10:29 ` [Bug middle-end/56314] " rguenth at gcc dot gnu.org
@ 2013-02-15  6:52 ` benh at kernel dot crashing.org
  2013-02-15  6:56 ` pinskia at gcc dot gnu.org
  2022-10-03 16:20 ` hpa at zytor dot com
  5 siblings, 0 replies; 7+ messages in thread
From: benh at kernel dot crashing.org @ 2013-02-15  6:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56314

benh at kernel dot crashing.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benh at kernel dot
                   |                            |crashing.org

--- Comment #4 from benh at kernel dot crashing.org 2013-02-15 06:52:31 UTC ---
I would definitely like to see that on powerpc as well.

A typical usage case for Linux is inline functions intended as a fast path
(such as spin lock) for which we want to be able to branch to an unlikely slow
path (contention case, timeout case, error case...) while limiting the impact
on the caller.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/56314] Please allow per-function specification of register conventions
  2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
                   ` (3 preceding siblings ...)
  2013-02-15  6:52 ` benh at kernel dot crashing.org
@ 2013-02-15  6:56 ` pinskia at gcc dot gnu.org
  2022-10-03 16:20 ` hpa at zytor dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-02-15  6:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56314

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-15 06:56:23 UTC ---
I think I would rather see IPA-RA and LTO working with the kernel before adding
these attributes as they are very fragile to get working correctly.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/56314] Please allow per-function specification of register conventions
  2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
                   ` (4 preceding siblings ...)
  2013-02-15  6:56 ` pinskia at gcc dot gnu.org
@ 2022-10-03 16:20 ` hpa at zytor dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hpa at zytor dot com @ 2022-10-03 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from H. Peter Anvin <hpa at zytor dot com> ---
Unfortunately that's not really possible given the way the way the level does
runtime patching (which isn't going to change, sorry.) At the very least we
would need a *lot* more compiler support to give LTO all the information that
it needs; say a *very* minimum LTO would need to support ORC metadata.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-03 16:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-14  1:56 [Bug other/56314] New: Please allow per-function specification of register conventions hpa at zytor dot com
2013-02-14  2:04 ` [Bug other/56314] " pinskia at gcc dot gnu.org
2013-02-14  2:24 ` hpa at zytor dot com
2013-02-14 10:29 ` [Bug middle-end/56314] " rguenth at gcc dot gnu.org
2013-02-15  6:52 ` benh at kernel dot crashing.org
2013-02-15  6:56 ` pinskia at gcc dot gnu.org
2022-10-03 16:20 ` hpa at zytor dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).