diff options
author | Segher Boessenkool <segher@gcc.gnu.org> | 2019-03-24 21:26:53 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2019-03-24 21:26:53 +0100 |
commit | 06c1602ae4d1ff3270aa12ba6f010cd51302fe91 (patch) | |
tree | f9ec455a6faac629af01a9bab47c4cbf8836633f | |
parent | 38a47a0fc6defeaf3f49ab63aff262ae42dffd89 (diff) | |
download | gcc-06c1602ae4d1ff3270aa12ba6f010cd51302fe91.zip gcc-06c1602ae4d1ff3270aa12ba6f010cd51302fe91.tar.gz gcc-06c1602ae4d1ff3270aa12ba6f010cd51302fe91.tar.bz2 |
rs6000: Make CSE'ing __tls_get_addr calls possible
CSE does not consider calls, not even const calls. This patch puts a
REG_EQUAL note on the pseudo we assign the __tls_get_addr result to,
so that those pseudos can be CSE'd and the extra calls deleted as dead
code.
CSE should really handle const calls directly, but it is stage 4.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add REG_EQUAL
notes for the result of the __tls_get_addr calls.
* config/rs6000/rs6000.md (unspec UNSPEC_TLS_GET_ADDR): New.
From-SVN: r269902
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 10 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85ec6be..8ce3d7c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ -2019-03-26 Jeff Law <law@redhat.com> +2019-03-24 Segher Boessenkool <segher@kernel.crashing.org> + + * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add REG_EQUAL + notes for the result of the __tls_get_addr calls. + * config/rs6000/rs6000.md (unspec UNSPEC_TLS_GET_ADDR): New. + +2019-03-24 Jeff Law <law@redhat.com> * config/bfin/bfin.md (movpdi): Fix length for alternative 1. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 734c386..06ce289 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -8785,6 +8785,11 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model) else emit_library_call_value (tga, dest, LCT_CONST, Pmode); global_tlsarg = NULL_RTX; + + /* Make a note so that the result of this call can be CSEd. */ + rtvec vec = gen_rtvec (1, copy_rtx (arg)); + rtx uns = gen_rtx_UNSPEC (Pmode, vec, UNSPEC_TLS_GET_ADDR); + set_unique_reg_note (get_last_insn (), REG_EQUAL, uns); } else if (model == TLS_MODEL_LOCAL_DYNAMIC) { @@ -8803,6 +8808,11 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model) emit_library_call_value (tga, tmp1, LCT_CONST, Pmode); global_tlsarg = NULL_RTX; + /* Make a note so that the result of this call can be CSEd. */ + rtvec vec = gen_rtvec (1, copy_rtx (arg)); + rtx uns = gen_rtx_UNSPEC (Pmode, vec, UNSPEC_TLS_GET_ADDR); + set_unique_reg_note (get_last_insn (), REG_EQUAL, uns); + if (rs6000_tls_size == 16) { if (TARGET_64BIT) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 297b884..b8dd859 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -79,6 +79,7 @@ UNSPEC_MPIC_CORRECT ; macho_correct_pic UNSPEC_TLSGD UNSPEC_TLSLD + UNSPEC_TLS_GET_ADDR UNSPEC_MOVESI_FROM_CR UNSPEC_MOVESI_TO_CR UNSPEC_TLSDTPREL |