[LLVMdev] functions with 'sret' argument must return void
Antoine Pitrou
antoine at python.org
Thu Jul 9 10:09:19 PDT 2015
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.
More information about the llvm-dev
mailing list