S/390: Allow relative addressing of literal pool entries
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 9 Nov 2018 20:33:19 +0000 (20:33 +0000)
committerIlya Leoshkevich <iii@gcc.gnu.org>
Fri, 9 Nov 2018 20:33:19 +0000 (20:33 +0000)
commit340e0dd66466091ea2bbd160592c017eb67dc47d
treed7d598af8c44850d0dca325c3f08006fc48c3d1d
parent81a227c6054a82118d80d3f4b2fffb44bc43aae2
S/390: Allow relative addressing of literal pool entries

r265490 allowed the compiler to choose in a more flexible way whether to
use load or load-address-relative-long (LARL) instruction.  When it
chose LARL for literal pool references, the latter ones were rewritten
by pass_s390_early_mach to use UNSPEC_LTREF, which assumes base register
usage, which in turn is not compatible with LARL.  The end result was an
ICE because of unrecognizable insn.

UNSPEC_LTREF and friends are necessary in order to communicate the
dependency on the base register to pass_sched2.  When relative
addressing is used, no base register is necessary, so in such cases the
rewrite must be avoided.

gcc/ChangeLog:

2018-11-09  Ilya Leoshkevich  <iii@linux.ibm.com>

PR target/87762
* config/s390/s390.c (s390_safe_relative_long_p): New function.
(annotate_constant_pool_refs): Skip insns which support
relative addressing.
(annotate_constant_pool_refs_1): New helper function.
(find_constant_pool_ref): Skip insns which support relative
addression.
(find_constant_pool_ref_1): New helper function.
(replace_constant_pool_ref): Skip insns which support
relative addressing.
(replace_constant_pool_ref_1): New helper function.
(s390_mainpool_start): Adapt to the new signature.
(s390_mainpool_finish): Likewise.
(s390_chunkify_start): Likewise.
(s390_chunkify_finish): Likewise.
(pass_s390_early_mach::execute): Likewise.
(s390_prologue_plus_offset): Likewise.
(s390_emit_prologue): Likewise.
(s390_emit_epilogue): Likewise.

From-SVN: r265991
gcc/ChangeLog
gcc/config/s390/s390.c