On Fri, Apr 8, 2011 at 10:51 PM, Alan Modra <amo...@gmail.com> wrote: > This patch enables sibling calls for powerpc in a few more cases, and > fixes bugs exposed by that change. We now > a) Allow sibling calls via function pointer. At the time > rs6000_function_ok_for_sibcall was written, I don't think access to > arg types of function pointer calls was available in the target > hook/macro. > b) Allow sibling calls to functions with vector parameters. Contrary > to the previous comment about vector parameters, a problem occurs > with VRSAVE only when the called function has more vector > parameters than the caller (because VRSAVE bits will already be set > for the caller's arguments). Also, the old code did not make any > attempt to determine whether altivec/vsx registers would actually > be used to pass args. Not all vector types fit in these regs. > c) Allow SYSV4 ABI code to make sibling calls to non-local functions > so long as not both flag_pic and TARGET_SECURE_PLT are set. > The PIC -msecure-plt call stubs use r30. > > sibcall_value_nonlocal_sysv was trying to read the call cookie from > the wrong operand, a latent bug since the pattern wasn't used until > now. I also fixed a minor problem with CALL_LIBCALL in the call > cookie, which could cause various call insns to match an "n" > constraint rather than a "0" constraint and so give the wrong insn > length. Bootstrapped and regression tested powerpc64-linux and > powerpc-linux. > > This patch does affect darwin, not only in removing what are now > redundant insn patterns, but also (a) and (b) above. Would someone > please run a bootstrap and regression test on darwin for me? I don't > have a machine handy to confirm that I didn't break anything there. > > I've attached a vector testcase I used to verify some of these > changes. > > gcc/ > * config/rs6000/rs6000.c (rs6000_function_arg): Remove CALL_LIBCALL > when returning call_cookie. > (rs6000_function_ok_for_sibcall): Allow sibcalls via function > pointers, to functions with no more vector args than the current > function, and some non-local calls for ABI_V4. > * config/rs6000/rs6000.md (sibcall_nonlocal_aix32, > sibcall_nonlocal_aix64): Combine to .. > (sibcall_nonlocal_aix<mode>): ..this. Handle function pointer calls. > (sibcall_value_nonlocal_aix32, sibcall_value_nonlocal_aix64): Combine.. > (sibcall_value_nonlocal_aix<mode>): ..likewise. > (*sibcall_nonlocal_sysv<mode>): Handle function pointer calls. > (sibcall_value_nonlocal_sysv<mode>): Likewise. Correct call cookie > operand. > * config/rs6000/darwin.md (sibcall_nonlocal_darwin64, > sibcall_value_nonlocal_darwin64, sibcall_symbolic_64, > sibcall_value_symbolic_64): Delete. > gcc/testsuite/ > * gcc.target/powerpc/ppc-pow.c: Allow for tail calls.
This is okay. It would be nice if someone tested on Darwin, although I am sure we will hear soon enough if it broke anything. Thanks, David