Commit 805c33df by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

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

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
parent dcda8480
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> 2004-09-28 Ulrich Weigand <uweigand@de.ibm.com>
* sched-rgn.c (haifa_edge, edge_table, NEXT_IN, NEXT_OUT, FROM_BLOCK, * sched-rgn.c (haifa_edge, edge_table, NEXT_IN, NEXT_OUT, FROM_BLOCK,
......
...@@ -3562,6 +3562,20 @@ asm ("cmoveq %1,%2,%[result]" ...@@ -3562,6 +3562,20 @@ asm ("cmoveq %1,%2,%[result]"
: "r" (test), "r"(new), "[result]"(old)); : "r" (test), "r"(new), "[result]"(old));
@end smallexample @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, Some instructions clobber specific hard registers. To describe this,
write a third colon after the input operands, followed by the names of write a third colon after the input operands, followed by the names of
the clobbered hard registers (given as strings). Here is a realistic the clobbered hard registers (given as strings). Here is a realistic
...@@ -3955,7 +3969,9 @@ very often. ...@@ -3955,7 +3969,9 @@ very often.
@item @item
Local register variables in specific registers do not reserve the 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 where the specified registers contain live values, and where they are
available for other uses. Stores into local register variables may be deleted available for other uses. Stores into local register variables may be deleted
when they appear to be dead according to dataflow analysis. References when they appear to be dead according to dataflow analysis. References
...@@ -4104,8 +4120,11 @@ the variable's value is not live. ...@@ -4104,8 +4120,11 @@ the variable's value is not live.
This option does not guarantee that GCC will generate code that has 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 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 code an explicit reference to this register in the @emph{assembler
and assume it will always refer to this variable. 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 Stores into local register variables may be deleted when they appear to be dead
according to dataflow analysis. References to local register variables may according to dataflow analysis. References to local register variables may
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment