This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Avoid use of "register" as optimization hint
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Sat, 8 Jun 2013 02:15:20 +0200
- Subject: Re: Avoid use of "register" as optimization hint
- References: <Pine dot LNX dot 4 dot 64 dot 1306051516480 dot 14749 at digraph dot polyomino dot org dot uk> <20130607215803 dot 20E5C2C088 at topped-with-meat dot com>
On Fri, Jun 07, 2013 at 02:58:03PM -0700, Roland McGrath wrote:
> > * Code from GMP, which also has lots of uses of "register". I don't
> > know if GMP upstream has since cleaned them up; we don't actually
> > try to stay in sync with GMP upstream (updating GMP code from there
> > would require FSF permission to use the current GMP versions of the
> > relevant code under LGPLv2.1+).
>
> I think the permission granted way back when applies just as well to newer
> GMP versions. If you have a particular reason to think it wouldn't, then
> you should ask the appropriate FSF contact. But I'm confident enough to
> just do whatever we want with FSF-owned code from recent GMP versions.
>
> > * Cases where use of "register" on a variable seems to serve as
> > documentation that this variable is being used as an asm input or
> > output that needs to be in a register for the asm, although not
> > assigned to a particular register, rather than being used as an
> > obsolete optimization hint.
>
> I don't really think this should be an exception. The asm constraint is
> what matters, and the "register" keyword as implicit documentation does not
> really seem like it adds anything. (In fact, it seems more likely to be
> left behind as bit rot when the code changes later than to really be
> helpful to anyone reading the code.)
>
As I can not be sure if register is documentation or just historic relic
it does not add much in this regard.
For documentation changing that to /* register */ or such is better as
there is no confusion.