diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/calls.c | 3 | ||||
-rw-r--r-- | gcc/config/rs6000/aix.h | 1 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 15 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 9 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 2 | ||||
-rw-r--r-- | gcc/target.def | 12 |
6 files changed, 40 insertions, 2 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index ff60620..883d08b 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1002,7 +1002,8 @@ precompute_register_parameters (int num_actuals, struct arg_data *args, /* If the value is a non-legitimate constant, force it into a pseudo now. TLS symbols sometimes need a call to resolve. */ if (CONSTANT_P (args[i].value) - && !targetm.legitimate_constant_p (args[i].mode, args[i].value)) + && (!targetm.legitimate_constant_p (args[i].mode, args[i].value) + || targetm.precompute_tls_p (args[i].mode, args[i].value))) args[i].value = force_reg (args[i].mode, args[i].value); /* If we're going to have to load the value by parts, pull the diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 7fccb313..b116e1a 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -279,3 +279,4 @@ /* Use standard DWARF numbering for DWARF debugging information. */ #define RS6000_USE_DWARF_NUMBERING +#define TARGET_PRECOMPUTE_TLS_P rs6000_aix_precompute_tls_p diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 844fee8..60b8e3e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -9608,7 +9608,8 @@ rs6000_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x) && SYMBOL_REF_TLS_MODEL (XEXP (XEXP (x, 0), 0)) != 0) return true; - /* Do not place an ELF TLS symbol in the constant pool. */ + /* Allow AIX TOC TLS symbols in the constant pool, + but not ELF TLS symbols. */ return TARGET_ELF && tls_referenced_p (x); } @@ -25370,6 +25371,18 @@ rs6000_legitimate_constant_p (machine_mode mode, rtx x) return true; } +/* Implement TARGET_PRECOMPUTE_TLS_P. + + On the AIX, TLS symbols are in the TOC, which is maintained in the + constant pool. AIX TOC TLS symbols need to be pre-computed, but + must be considered legitimate constants. */ + +static bool +rs6000_aix_precompute_tls_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x) +{ + return tls_referenced_p (x); +} + /* Return TRUE iff the sequence ending in LAST sets the static chain. */ 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 diff --git a/gcc/target.def b/gcc/target.def index d7b94bd..0ebfb58 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2715,6 +2715,18 @@ The default definition returns true.", bool, (machine_mode mode, rtx x), hook_bool_mode_rtx_true) +/* True if X is a TLS operand whose value should be pre-computed. */ +DEFHOOK +(precompute_tls_p, + "This hook returns true if @var{x} is a TLS operand on the target\n\ +machine that should be pre-computed when used as the argument in a call.\n\ +You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not \n\ +check this.\n\ +\n\ +The default definition returns false.", + bool, (machine_mode mode, rtx x), + hook_bool_mode_rtx_false) + /* True if the constant X cannot be placed in the constant pool. */ DEFHOOK (cannot_force_const_mem, |