Avoid use of "register" as optimization hint
Ondřej Bílka
neleai@seznam.cz
Fri Jun 7 22:17:00 GMT 2013
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.
More information about the Libc-alpha
mailing list