This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]