This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Don't waste 176 bytes of stack frame on ppc64-linux for ... functions
On Mon, Jun 27, 2005 at 11:35:31AM -0400, Jakub Jelinek wrote:
> My understanding of the ppc{32,64} stack layout is:
> r31=r1+sizeof(alloca area) +parent
> r1 +r1
> +----+--------[+------]+------------+----+----+----+--------+
> |save|outgoing[|alloca]|varargs area|vars|regs+save|incoming|
> |area| args [|area ]|(sysv4 ABI) |area|area+area|args |
> +----+--------[+------]+------------+----+----+----+--------+
> +
While looking at this, I have noticed that although only the V4
ABI needs varargs area, on ppc64-linux we allocate one even
for -m64 needlessly. That's 176 bytes wasted on the stack
for each function with ... in argument list.
Ok to commit?
2005-06-27 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/sysv4.h (RS6000_VARARGS_AREA): Only return non-zero
if DEFAULT_ABI == ABI_V4.
--- gcc/config/rs6000/sysv4.h.jj 2005-06-17 17:09:36.000000000 +0200
+++ gcc/config/rs6000/sysv4.h 2005-06-27 18:00:27.000000000 +0200
@@ -252,7 +252,9 @@ do { \
/* Size of the V.4 varargs area if needed. */
/* Override rs6000.h definition. */
#undef RS6000_VARARGS_AREA
-#define RS6000_VARARGS_AREA (current_function_stdarg ? RS6000_VARARGS_SIZE : 0)
+#define RS6000_VARARGS_AREA \
+ ((DEFAULT_ABI == ABI_V4 && current_function_stdarg) \
+ ? RS6000_VARARGS_SIZE : 0)
/* Override default big endianism definitions in rs6000.h. */
#undef BYTES_BIG_ENDIAN
Jakub