Question on sret

Dear All,

What is the purpose of the sret function parameter attribute? Does it affect the calling convention used during code generation, is it a hint to optimizations, or is it used for something else?

I'm currently working on automatic pool allocation; this transform clones a function and adds extra parameters to the beginning of the function's parameter list. This means that I have to remove the sret attribute from the original first parameter. Is removing sret safe?

-- John T.

Dear All,

What is the purpose of the sret function parameter attribute? Does it
affect the calling convention used during code generation, is it a hint
to optimizations, or is it used for something else?

Both of the above; see LangRef.

I'm currently working on automatic pool allocation; this transform
clones a function and adds extra parameters to the beginning of the
function's parameter list. This means that I have to remove the sret
attribute from the original first parameter. Is removing sret safe?

Removing sret changes the calling convention, but otherwise it's safe.

-Eli

Eli Friedman wrote:

  

Dear All,

What is the purpose of the sret function parameter attribute? Does it
affect the calling convention used during code generation, is it a hint
to optimizations, or is it used for something else?
    
Both of the above; see LangRef.
  
I did read the LangRef; it told me what sret was but not why it exists or how the compiler utilizes it (or I somehow missed that part of the text).

I'm currently working on automatic pool allocation; this transform
clones a function and adds extra parameters to the beginning of the
function's parameter list. This means that I have to remove the sret
attribute from the original first parameter. Is removing sret safe?
    
Removing sret changes the calling convention, but otherwise it's safe.
  
Okay, thanks.

-- John T.