Multiple return values...

Iain Buclaw ibuclaw at ubuntu.com
Fri Mar 16 10:13:02 PDT 2012


On 16 March 2012 16:53, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 3/16/12 11:50 AM, Iain Buclaw wrote:
>>
>> If you were to forget all about MRV for a brief moment, the change
>> request being proposed here is to return *all* structures (including
>> delegates, complex types and vectors) in registers if at all possible
>> even if the underlying ABI default is to return it in memory.
>
>
> That sounds great. Must have missed this point, this is a weird discussion
> in which one sentence is about machine code and the next about syntax.
>
> Andrei
>
>

Indeed it is.  Though in all honesty, I'm not sure how we can address
this. X86 and X86_64 architectures already return small structures
(less or equal to than 8 bytes iirc) in registers as an optimisation
trick if the function is private/static, and optimisations are of
course turned on.

Implementing this for other architectures would require explicitly
patching each backend architecture, which is simply not feasible to
do, especially when such patches may likely get rejected (A
'reg_return' attribute for ARM has been submitted before back in 2007,
but has never been accepted despite after several revisions).


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list