This is the mail archive of the 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 3/3

On 10/19/2015 03:55 PM, Segher Boessenkool wrote:
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

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

-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.
I think some of the confusion here is that paragraph is just hard to parse. To some degree this is inevitable because you have to think like a compiler junkie. Perhaps something like this.

Defining a register variable does not reserve the register. The register remains available to hold unrelated values in places where the variable is not live according to dataflow analysis.


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