[LLVMdev] Exact meaning of byval

Matthijs Kooijman matthijs at stdin.nl
Thu Jul 10 05:10:20 PDT 2008


> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080710/80adf130/attachment.sig>


More information about the llvm-dev mailing list