[cfe-dev] "byval" when there is a non-trivial Destructor or Copy Constructor
Jan Voung
jvoung at google.com
Wed Nov 2 14:33:56 PDT 2011
re: passing c++ objects with copy constructors/destructors, there are
multiple ABIs for doing this (e.g., the gcc way, msvc way). Is there a
reason that the DefaultABIInfo's classifyArgumentType doesn't match either
of the existing ABIs? It both makes a temp copy the gcc way, AND marks
pointers as "byval". All of the other ABIs (x86, arm, mips) which would
check and do:
if (isRecordWithNonTrivialDestructorOrCopyConstructor(Ty))
return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
to only have one temp copy. So, should the default not mark "byval"?
LE32 / PNaCl is currently using the default, and we would like avoid the
extra copy from the "byval" attribute. If the default should not be
changed, is it okay to add an LE32ABIInfo (for le32 / PNaCl) which diverges
from the DefaultABIInfo in this way (no "byval" attribute on the pointer
for non-trivial c++ objects)? If this second approach (adding LE32ABIInfo)
is acceptable, please see attached patch w/ tests for le32 changes.
If the default should be changed, I can send another patch.
Thanks!
- Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111102/e925f5f3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_le32_nontriv.patch
Type: text/x-patch
Size: 5714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111102/e925f5f3/attachment.bin>
More information about the cfe-dev
mailing list