Proposed doc update for Explicit Reg Vars 3/3

Segher Boessenkool segher@kernel.crashing.org
Mon Oct 19 21:55:00 GMT 2015


On Mon, Oct 12, 2015 at 04:09:34PM -0700, David Wohlferd wrote:
> I was hoping to modify the text to say that local register variables can 
> "only" be used to call Extended asm.  This would greatly simplify this 
> section.

But it is not true: they can be used anywhere any variable can be used.
Only in asm operands is it guaranteed that they end up in certain regs
though.

> -This option does not guarantee that GCC generates code that has
> -this variable in the register you specify at all times.  You may not
> -code an explicit reference to this register in the assembler
> -instruction template part of an @code{asm} statement and assume it
> -always refers to this variable.
> -However, using the variable as an input or output operand to the @code{asm}
> -guarantees that the specified register is used for that operand.  
> -@xref{Extended Asm}, for more information.

... as this correctly said.

> +Defining a register variable does not reserve the register; it 
> +remains available for other uses in places where flow control determines 
> +the variable's value is not live.  For this reason, the following uses 

This is misleading -- people will try to keep the variable "live" so it
stays in the wanted reg.  Which is not something guaranteed to work either.


Segher



More information about the Gcc mailing list