This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
New C++ ABI and -freg-struct-return?
- To: gcc at gcc dot gnu dot org
- Subject: New C++ ABI and -freg-struct-return?
- From: Ralph Loader <suckfish at ihug dot co dot nz>
- Date: Thu, 22 Jun 2000 20:54:55 +1200 (NZST)
Hi,
On ix86 (at least), by default, classes are always returned on the
stack (-fpcc-struct-return behaviour), even when they would fit in a
register.
With the next version of the compiler changing the C++ ABI, could we
change this, so that classes are returned in registers when possible
(i.e., -freg-struct-return behaviour by default)?
This would make some common C++ coding styles, such as smart pointer
classes (and less common ones, like my GF(2^n) calculator :-) ), have
less overhead.
There is a 'minor' complication - we wouldn't want to break
compatibility between C++ and C - so the rule would have to be
something like:
if a class (or struct) has a method (or is otherwise not a C
datatype), and fits into a register, then it is returned in a
register.
Ralph.