extend.texi (Extended Asm): Add blurb about using Explicit Reg Vars to enforce register allocation with...

* doc/extend.texi (Extended Asm): Add blurb about using Explicit
	Reg Vars to enforce register allocation with general constraints.
	(Explicit Reg Vars): Clarify relation to asm statements.
	(Local Reg Vars): Similar.

From-SVN: r88265
This commit is contained in:
Hans-Peter Nilsson 2004-09-29 01:42:09 +00:00 committed by Hans-Peter Nilsson
parent dcda848050
commit 805c33df13
2 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2004-09-29 Hans-Peter Nilsson <hp@bitrange.com>
* doc/extend.texi (Extended Asm): Add blurb about using Explicit
Reg Vars to enforce register allocation with general constraints.
(Explicit Reg Vars): Clarify relation to asm statements.
(Local Reg Vars): Similar.
2004-09-28 Ulrich Weigand <uweigand@de.ibm.com>
* sched-rgn.c (haifa_edge, edge_table, NEXT_IN, NEXT_OUT, FROM_BLOCK,

View File

@ -3562,6 +3562,20 @@ asm ("cmoveq %1,%2,%[result]"
: "r" (test), "r"(new), "[result]"(old));
@end smallexample
Sometimes you need to make an @code{asm} operand be a specific register,
but there's no matching constraint letter for that register @emph{by
itself}. To force the operand into that register, use a local variable
for the operand and specify the register in the variable declaration.
@xref{Explicit Reg Vars}. Then for the @code{asm} operand, use any
register constraint letter that matches the register:
@smallexample
register int *p1 asm ("r0") = @dots{};
register int *p2 asm ("r1") = @dots{};
register int *result asm ("r0");
asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2));
@end smallexample
Some instructions clobber specific hard registers. To describe this,
write a third colon after the input operands, followed by the names of
the clobbered hard registers (given as strings). Here is a realistic
@ -3955,7 +3969,9 @@ very often.
@item
Local register variables in specific registers do not reserve the
registers. The compiler's data flow analysis is capable of determining
registers, except at the point where they are used as input or output
operands in an @code{asm} statement and the @code{asm} statement itself is
not deleted. The compiler's data flow analysis is capable of determining
where the specified registers contain live values, and where they are
available for other uses. Stores into local register variables may be deleted
when they appear to be dead according to dataflow analysis. References
@ -4104,8 +4120,11 @@ the variable's value is not live.
This option does not guarantee that GCC will generate code that has
this variable in the register you specify at all times. You may not
code an explicit reference to this register in an @code{asm} statement
and assume it will always refer to this variable.
code an explicit reference to this register in the @emph{assembler
instruction template} part of an @code{asm} statement and assume it will
always refer to this variable. However, using the variable as an
@code{asm} @emph{operand} guarantees that the specified register is used
for the operand.
Stores into local register variables may be deleted when they appear to be dead
according to dataflow analysis. References to local register variables may