[LLVMdev] functions with 'sret' argument must return void

Reid Kleckner rnk at google.com
Thu Jul 9 10:29:19 PDT 2015


On x86, the sret attribute arranges for the incoming sret pointer to be
returned in eax, so the function can't return anything else.

I think you'll have to get by with a combination of other attributes
instead of declaring the whole function as readnone. =/

On Thu, Jul 9, 2015 at 10:09 AM, Antoine Pitrou <antoine at python.org> wrote:

>
> Hello,
>
> Attempting to add attributes to our compiled functions, I tried to
> declare the first parameter "sret" since that's how our internal calling
> convention works (the first parameter is a pointer to the function's
> result). I got the error:
>
> LLVM IR parsing error
> <string>:6:8: error: functions with 'sret' argument must return void
>
> Our functions return non-void because they return an integer status code
> (either ok or some error). This seems to me like an obvious use case
> for using result-value-written-to-a-pointer-parameter semantics, so
> I don't understand why LLVM chokes on it. Is there a reason?
>
> The reason I'm asking is that there is a function that I would
> like to declare "readonly". But if I declare the function "readonly"
> without that "sret" annotation, then LLVM of course is allowed to
> assume the memory location containing the return value hasn't changed
> at all.
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150709/a0ddc4a9/attachment.html>


More information about the llvm-dev mailing list