mirror of git://gcc.gnu.org/git/gcc.git
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:
parent
1dcadcf01d
commit
4cc035143d
|
|
@ -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>
|
2018-07-30 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
PR tree-optimization/86506
|
PR tree-optimization/86506
|
||||||
|
|
|
||||||
|
|
@ -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
|
@code{static}. The register name must be a valid register name for the
|
||||||
target platform.
|
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
|
Registers are a scarce resource on most systems and allowing the
|
||||||
compiler to manage their usage usually results in the best code. However,
|
compiler to manage their usage usually results in the best code. However,
|
||||||
under special circumstances it can make sense to reserve some globally.
|
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
|
@code{static}. The register name must be a valid register name for the
|
||||||
target platform.
|
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
|
As with global register variables, it is recommended that you choose
|
||||||
a register that is normally saved and restored by function calls on your
|
a register that is normally saved and restored by function calls on your
|
||||||
machine, so that calls to library routines will not clobber it.
|
machine, so that calls to library routines will not clobber it.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue