[PATCH] D49464: [COFF, ARM64] Mark only POD-type returns as SRET

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 16:05:48 PDT 2018


rnk added a comment.

In https://reviews.llvm.org/D49464#1168918, @efriedma wrote:

> > My first thought is to use inreg to indicate that the struct is POD and X8 should be used, and that it does not need to be preserved.
>
> If we were going to do this, we'd probably want to reverse the meaning of inreg; I would rather not break compatibility with existing bitcode, particularly on non-Windows targets.


I see, I hadn't realized X8 was the normal sret register. Yes, `sret` + `inreg` would mean "in the other sret register". However, now I think we should toss this idea and use `returned` instead, since SysV AArch64 doesn't return the incoming sret pointer in X0, so we'd need to make this new sret+inreg thing imply that.

>> Another alternative would be to change the LLVM IR function return type to a pointer type and add the LLVM IR returned attribute to the argument with the address of the return value.
> 
> We do something similar to this for constructors on some targets; see CGCXXABI::HasThisReturn.  Probably not hard to extend if we wanted to.

Yep.


https://reviews.llvm.org/D49464





More information about the llvm-commits mailing list