doc: discourage const/volatile on register variables (PR 86673)

PR target/86673
	* doc/extend.texi (Global Register Variables): Discourage use of type
	qualifiers.
	(Local Register Variables): Likewise.

From-SVN: r263065
This commit is contained in:
Alexander Monakov 2018-07-30 15:26:37 +03:00 committed by Alexander Monakov
parent 1dcadcf01d
commit 4cc035143d
2 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2018-07-30 Alexander Monakov <amonakov@ispras.ru>
PR target/86673
* doc/extend.texi (Global Register Variables): Discourage use of type
qualifiers.
(Local Register Variables): Likewise.
2018-07-30 Richard Sandiford <richard.sandiford@arm.com>
PR tree-optimization/86506

View File

@ -9591,6 +9591,11 @@ a global variable the declaration appears outside a function. The
@code{static}. The register name must be a valid register name for the
target platform.
Do not use type qualifiers such as @code{const} and @code{volatile}, as
the outcome may be contrary to expectations. In particular, using the
@code{volatile} qualifier does not fully prevent the compiler from
optimizing accesses to the register.
Registers are a scarce resource on most systems and allowing the
compiler to manage their usage usually results in the best code. However,
under special circumstances it can make sense to reserve some globally.
@ -9698,6 +9703,12 @@ but for a local variable the declaration appears within a function. The
@code{static}. The register name must be a valid register name for the
target platform.
Do not use type qualifiers such as @code{const} and @code{volatile}, as
the outcome may be contrary to expectations. In particular, when the
@code{const} qualifier is used, the compiler may substitute the
variable with its initializer in @code{asm} statements, which may cause
the corresponding operand to appear in a different register.
As with global register variables, it is recommended that you choose
a register that is normally saved and restored by function calls on your
machine, so that calls to library routines will not clobber it.