[RS6000] PC-relative TLS support
authorAlan Modra <amodra@gmail.com>
Tue, 12 Nov 2019 01:11:46 +0000 (11:41 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Tue, 12 Nov 2019 01:11:46 +0000 (11:41 +1030)
commit2965eaa89d843a1c260291376020d71127c05741
tree3b8930ad957500ac4c6b16dd73b76b30f93a3643
parented2181fc2a3ff3a0f65110c906093d5ce0d8e048
[RS6000] PC-relative TLS support

Supporting TLS for -mpcrel turns out to be relatively simple.  The
existing TLSGD and TLSLD unspecs happily can have their GOT pointer
reg element replaced with zero, refelecting the fact that optimisation
of calls to __tls_get_addr when pc-rel won't use the GOT pointer.
Some other insns also can be reused, and just a few added.

* config/rs6000/predicates.md (unspec_tls): Allow const0_rtx for got
element of unspec vec.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Support
PC-relative TLS.
* config/rs6000/rs6000.md (UNSPEC_TLSTLS_PCREL): New unspec.
(tls_gd_pcrel, tls_ld_pcrel): New insns.
(tls_dtprel, tls_tprel): Set attr prefixed when tls_size is not 16.
(tls_got_tprel_pcrel, tls_tls_pcrel): New insns.

From-SVN: r278076
gcc/ChangeLog
gcc/config/rs6000/predicates.md
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md