[LLVMdev] Exact meaning of byval
Richard Osborne
rlsosborne at googlemail.com
Thu Jul 10 05:35:41 PDT 2008
Matthijs Kooijman wrote:
>> I'm not sure what you are asking. Of course caller or callee can
>> always allocate some temporary on the stack and memcpy to it, then
>> use that copy from then on. The point of byval is that the copy is
>> made where the ABI mandates it for by-value call parameters. If
>> you don't need to be ABI compatible then there is no point using
>> byval: it would be better to use an explicit temporary and memcpy.
>>
> I think the point is that there could be an ABI where some argument is
> guaranteed to be not modified. Ie, like having a const * argument to a
> function, but in such a way that the function body can actually modify the
> value pointed to, in which case the frontend must modify the code to work on a
> copy of the value instead of the actual pointed in value. Something like that?
>
> Gr.
>
> Matthijs
>
I referring to the best way to satisfy an ABI which requires that
structures / unions are passed as a read only pointer with the callee
making a copy if it needs to modify the value.
Richard
More information about the llvm-dev
mailing list