This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposed doc update for Explicit Reg Vars 2/3


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]