[PATCH] D60349: [COFF, ARM64] Fix ABI implementation of struct returns
Sanjin Sijaric via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 17 17:21:57 PDT 2019
ssijaric added inline comments.
================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1058
+
+ // 1. For return types <= 16 bytes, use the C return semantics.
+
----------------
richard.townsend.arm wrote:
> Microsoft have updated the spec since this was written, it now says to check for aggregate-ness, trivial copy, and trivial destruct, instead of POD.
This is only true for aggregates. We can have non-aggregate return types that are less or equal to 16 bytes. In this case, they are returned on the stack.
================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1075
+ uint64_t RetTySize = getContext().getTypeSize(FI.getReturnType());
+ if (RetTySize <= 16)
+ return false;
----------------
The size returned is in bits, not bytes.
As mentioned above, this applies to aggregates with trivial copy assignment operators and destructors. I will provide a function to check for this. At that point, the check can be removed from here, and the check below can be replaced with something like:
bool isIndirectReturn = !canReturnInRegisters();
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60349/new/
https://reviews.llvm.org/D60349
More information about the cfe-commits
mailing list