<div dir="ltr">On x86, the sret attribute arranges for the incoming sret pointer to be returned in eax, so the function can't return anything else.<div><br></div><div>I think you'll have to get by with a combination of other attributes instead of declaring the whole function as readnone. =/</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 9, 2015 at 10:09 AM, Antoine Pitrou <span dir="ltr"><<a href="mailto:antoine@python.org" target="_blank">antoine@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello,<br>
<br>
Attempting to add attributes to our compiled functions, I tried to<br>
declare the first parameter "sret" since that's how our internal calling<br>
convention works (the first parameter is a pointer to the function's<br>
result). I got the error:<br>
<br>
LLVM IR parsing error<br>
<string>:6:8: error: functions with 'sret' argument must return void<br>
<br>
Our functions return non-void because they return an integer status code<br>
(either ok or some error). This seems to me like an obvious use case<br>
for using result-value-written-to-a-pointer-parameter semantics, so<br>
I don't understand why LLVM chokes on it. Is there a reason?<br>
<br>
The reason I'm asking is that there is a function that I would<br>
like to declare "readonly". But if I declare the function "readonly"<br>
without that "sret" annotation, then LLVM of course is allowed to<br>
assume the memory location containing the return value hasn't changed<br>
at all.<br>
<br>
Regards<br>
<br>
Antoine.<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>