On 10/20/14 14:22, Bernd Schmidt wrote:
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.


Bernd


003-sretreg.diff


        gcc/
        * 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.
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.

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.

jeff

Reply via email to