RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
Michael Matz via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 23 07:30:09 PST 2016
Hi,
On Tue, 23 Feb 2016, H.J. Lu wrote:
> > ---
> > An empty type is a type where it and all of its subobjects (recursively)
> > are of class, structure, union, or array type. No memory slot nor
> > register should be used to pass or return an object of empty type that's
> > trivially copyable.
> > ---
> >
> > (With possibly a self-sufficient definition of trivially copyable, that's
> > language agnostic)
> >
>
> Do you have an example in which an empty type defined above isn't
> "trivially copyable"?
The ones we've always talked about: empty C++ types with non-trivial copy
ctors or dtors. Yes, I'm aware of the fact that the Itanium C++ ABI
doesn't invoke the underlying psABI for these types (or better, it
specifies them to be passed by reference). But first, there are other
languages that have such constructs, but don't necessarily have an
written-down ABI (OO fortran anyone? Ada?). Second, there may be other
C++ ABIs that don't contain such language (which would be an ommission,
but well, happens). And third even for our C++ needs (based on the
Itanium ABI) I feel it's simply more clear and self-sufficient to be
explicit about this restriction.
It's not that we have any sort of upper bound on the number of words we're
allowed to use in the psABI, and I also don't think anything is gained by
being as terse as possible. Succinct, sure, but not as arcane as we can
make it while still being correct.
So, question back: can you imaging any cases where the "restriction" to
trivially copyable would _not_ do the thing we want?
Ciao,
Michael.
More information about the cfe-commits
mailing list