On Mon, Dec 03, 2018 at 01:26:48AM +0000, Iain Sandoe wrote:
> Hi,
>
> Recent changes to the lowerings for call handling in rs6000 have broken
> bootstrap for powerpc-darwin.
>
> I’m proposing two patches;
> 1. the minimal fix to bootstrap - which I believe also fixes some possible
> typos in the patterns for sysv.
Sorry for the breakage..
> 2. a second patch that brings Darwin into line with Alan’s recent change, and
> makes it hopefully clearer what can be done if/when we retire the mlongcall
> optimisation that is used for older Darwin versions.
>
> ===
>
> The first patch makes Darwin share the sysv lowering, up until late in the
> process when we still use the macho_call_template. This means we need to
> preserve the CALL_LONG flag for Darwin.
>
> In order to match this for Darwin64, the sysv patterns needed the clobber
> mode to follow that of the pattern. It seems that this might be a typo -
> since it’s not obvious how it would work for powerpc64 sysv as things stand
> (AIX and ELFv2 already follow the mode).
Hmm, yes, and I think there may be some more modes to fix.
call_local64, call_value_local64, call_nonlocal_sysv splitter,
call_value_nonlocal_sysv splitter, call_value_nonlocal_sysv_secure.
> ;; Call and call_value insns
> +;; For the purposes of expanding calls, Darwin is very similar to SYSV.
> (define_expand "call"
> [(parallel [(call (mem:SI (match_operand 0 "address_operand"))
> (match_operand 1 ""))
> @@ -10288,7 +10289,7 @@
> DONE;
> }
>
> - if (DEFAULT_ABI == ABI_V4)
> + if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
Better yet, replace this line with "else" and tidy a little. There's
some dead code and the "DONE" can move out of the conditional blocks.
> {
> rs6000_call_sysv (NULL_RTX, operands[0], operands[1], operands[2]);
> DONE;
> @@ -10321,7 +10322,7 @@
> DONE;
> }
>
> - if (DEFAULT_ABI == ABI_V4)
> + if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
Similarly here,
> @@ -10765,7 +10766,7 @@
> DONE;
> }
>
> - if (DEFAULT_ABI == ABI_V4)
> + if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
and here,
> {
> rs6000_sibcall_sysv (NULL_RTX, operands[0], operands[1], operands[2]);
> DONE;
> @@ -10796,7 +10797,7 @@
> DONE;
> }
>
> - if (DEFAULT_ABI == ABI_V4)
> + if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
and here.
> {
> rs6000_sibcall_sysv (operands[0], operands[1], operands[2],
> operands[3]);
> DONE;
> --
> 2.17.1
>
--
Alan Modra
Australia Development Lab, IBM