This is the mail archive of the
mailing list for the GCC project.
Re: The nvptx port [3/11+] Struct returns
- From: Jeff Law <law at redhat dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 21 Oct 2014 18:36:48 +0000
- Subject: Re: The nvptx port [3/11+] Struct returns
- Authentication-results: sourceware.org; auth=none
- References: <54451994 dot 9070209 at codesourcery dot com> <54451AB5 dot 7040205 at codesourcery dot com>
On 10/20/14 14:22, Bernd Schmidt wrote:
My first thought when reading this surprise that we actually return a
value here and a desire to just zap that code completely since there's
virtually no chance the optimizer will be able to delete it.
Even when returning a structure by passing an invisible reference, gcc
still likes to set the return register to the address of the struct.
This is undesirable on ptx where things like the return register have to
be declared, and the function really returns void at ptx level. I've
added a target hook to avoid this. I figure other targets might find it
beneficial to omit this unnecessary set as well.
* target.def (omit_struct_return_reg): New data hook.
* doc/tm.texi.in: Add @hook TARGET_OMIT_STRUCT_RETURN_REG.
* doc/tm.texi: Regenerate.
* function.c (expand_function_end): Use it.
But then I remembered how much I hate dealing with this kind of ABI
issue. I suspect nobody actually specifies behavior here other than to
indicate when pass by invisible reference is used and what register
holds that incoming value.
Sooooo, OK for the trunk.