diff options
author | David Edelsohn <dje.gcc@gmail.com> | 2021-04-11 19:41:26 -0400 |
---|---|---|
committer | David Edelsohn <dje.gcc@gmail.com> | 2021-04-27 12:33:41 -0400 |
commit | a21b399708175f6fc0ac723a0cebc127da421c60 (patch) | |
tree | 5379a7edcb5572f3d04c93f95d4969e153405187 /gcc/doc | |
parent | 1c0c371d0ea297af2e3180c64cd18f2bfce919b1 (diff) | |
download | gcc-a21b399708175f6fc0ac723a0cebc127da421c60.zip gcc-a21b399708175f6fc0ac723a0cebc127da421c60.tar.gz gcc-a21b399708175f6fc0ac723a0cebc127da421c60.tar.bz2 |
aix: TLS precompute register parameters (PR 94177)
AIX uses a compiler-managed TOC for global data, including TLS symbols.
The GCC TOC implementation manages the TOC entries through the constant pool.
TLS symbols sometimes require a function call to obtain the TLS base
pointer. The arguments to the TLS call can conflict with arguments to
a normal function call if the TLS symbol is an argument in the normal call.
GCC specifically checks for this situation and precomputes the TLS
arguments, but the mechanism to check for this requirement utilizes
legitimate_constant_p(). The necessary result of legitimate_constant_p()
for correct TOC behavior and for correct TLS argument behavior is in
conflict.
This patch adds a new target hook precompute_tls_p() to decide if an
argument should be precomputed regardless of the result from
legitmate_constant_p().
gcc/ChangeLog:
PR target/94177
* calls.c (precompute_register_parameters): Additionally test
targetm.precompute_tls_p to pre-compute argument.
* config/rs6000/aix.h (TARGET_PRECOMPUTE_TLS_P): Define.
* config/rs6000/rs6000.c (rs6000_aix_precompute_tls_p): New.
* target.def (precompute_tls_p): New.
* doc/tm.texi.in (TARGET_PRECOMPUTE_TLS_P): Add hook documentation.
* doc/tm.texi: Regenerated.
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/tm.texi | 9 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 823f85b..b370bc7 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5880,6 +5880,15 @@ This hook returns true if @var{x} is a legitimate constant for a The default definition returns true. @end deftypefn +@deftypefn {Target Hook} bool TARGET_PRECOMPUTE_TLS_P (machine_mode @var{mode}, rtx @var{x}) +This hook returns true if @var{x} is a TLS operand on the target +machine that should be pre-computed when used as the argument in a call. +You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not +check this. + +The default definition returns false. +@end deftypefn + @deftypefn {Target Hook} rtx TARGET_DELEGITIMIZE_ADDRESS (rtx @var{x}) This hook is used to undo the possibly obfuscating effects of the @code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} target diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 2321a5f..2974dae 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4147,6 +4147,8 @@ address; but often a machine-dependent strategy can generate better code. @hook TARGET_LEGITIMATE_CONSTANT_P +@hook TARGET_PRECOMPUTE_TLS_P + @hook TARGET_DELEGITIMIZE_ADDRESS @hook TARGET_CONST_NOT_OK_FOR_DEBUG_P |