This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Proposed doc update for Explicit Reg Vars 2/3
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: David Wohlferd <dw at LimeGreenSocks dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Sandra Loosemore <sandra at codesourcery dot com>
- Date: Mon, 19 Oct 2015 16:42:41 -0500
- Subject: Re: Proposed doc update for Explicit Reg Vars 2/3
- Authentication-results: sourceware.org; auth=none
- References: <561C3D44 dot 5040506 at LimeGreenSocks dot com>
On Mon, Oct 12, 2015 at 04:07:48PM -0700, David Wohlferd wrote:
> Index: extend.texi
> ===================================================================
> --- extend.texi (revision 228690)
> +++ extend.texi (working copy)
> @@ -8506,7 +8506,8 @@
> @cindex global register variables
> @cindex registers, global variables in
>
> -You can define a global register variable in GNU C like this:
> +You can define a global register variable and associate it with a specified register
Line too long. I know quite a bit of doc does that, but that's no excuse :-)
> +Registers can be a limited resource on some systems and allowing the
They are a limited resource on almost all systems. "Scarce resource"?
> +After defining a global register variable, for the duration of
> +the current compilation:
It's probably better to say "for the current compilation unit"? There now
is LTO and whatnot.
> +All global register variable declarations must precede all function
> +definitions. If such a declaration appears after function definitions,
> +the declaration would be too late to prevent the register from being used
> +for other purposes in the preceding functions.
This isn't true anymore, not even with -fno-toplevel-reorder or -O0.
> +When selecting a register, choose one that is normally saved and
> +restored by function calls on your machine. This ensures that code
> +which is unaware of this reservation (such as library routines) will
> +restore it before returning.
The compiler also warns, possibly for the unlikely case that the user has
not read the documentation.
Thanks,
Segher