[PATCH] D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode

Xi Ruoyao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 02:36:33 PDT 2023


xry111 added a comment.

In D151298#4367620 <https://reviews.llvm.org/D151298#4367620>, @wangleiat wrote:

>>>> If we want to ignore empty structures, it is not enough to only modify psABI, because the current implementations of gcc and clang do not ignore empty structures in all cases. For example:
>>>>
>>>>   struct { struct{}; int i; }; // in this case, the empty struct is not ignored.
>>>>   struct { struct{}; float f; }; // ignored.
>>>
>>> This is the same behavior as RISC-V.  While attempting to pass a struct through FPRs, the empty field is ignored.  But if passing through FPR does not work and it's passed through GPRs, the empty fields are not ignored:
>
> Yes, but our psABI still differs from RISC-V in the description of parameter passing, and it would be better to have consistent behavior regardless of whether there are floating points or not.

But it's easier to just modify the text of the ABI doc, in order to avoid an ABI incompatibility between different GCC of Clang versions (as GCC and Clang are only C++ compilers supporting LoongArch now).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151298/new/

https://reviews.llvm.org/D151298



More information about the cfe-commits mailing list