LRA, rs6000, Darwin: Revise lo_sum use for forced constants [PR104117].
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 23 Feb 2022 13:53:44 +0000 (13:53 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Fri, 4 Mar 2022 15:06:25 +0000 (15:06 +0000)
commitf1b3e3853329b58fb2e50c17487df2ecbc4a5608
treee966287804451632fe9fe8de27277d77b02d5312
parentcb16bc3b5f34733ef9bbf8d2e3acacdecb099a62
LRA, rs6000, Darwin: Revise lo_sum use for forced constants [PR104117].

Follow up discussion to the initial patch for this PR identified that it is
preferable to avoid the LRA change, and arrange for the target to reject the
hi and lo_sum selections when presented with an invalid address.

We split the Darwin high/low selectors into two:
 1. One that handles non-PIC addresses (kernel mode, mdynamic-no-pic).
 2. One that handles PIC addresses and rejects SYMBOL_REFs unless they are
    suitably wrapped in the MACHOPIC_OFFSET unspec.

The second case is handled by providing a new predicate (macho_pic_address)
that checks the requirements.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/104117

gcc/ChangeLog:

* config/rs6000/darwin.md (@machopic_high_<mode>): New.
(@machopic_low_<mode>): New.
* config/rs6000/predicates.md (macho_pic_address): New.
* config/rs6000/rs6000.cc (rs6000_legitimize_address): Do not
apply the TLS processing to Darwin.
* lra-constraints.cc (process_address_1): Revert the changes
in r12-7209.
gcc/config/rs6000/darwin.md
gcc/config/rs6000/predicates.md
gcc/config/rs6000/rs6000.cc
gcc/lra-constraints.cc