New C++ ABI and -freg-struct-return?

Ralph Loader suckfish@ihug.co.nz
Thu Jun 22 01:57:00 GMT 2000


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.


More information about the Gcc mailing list