This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Patch: fix regression in PPC sibcalls (redone)


OK, let's try this again. I've done this so the behavior is changed only in
the case I know is broken: REG_PARM_STACK_SPACE>0, MAYBE_REG_PARM_STACK_SPACE undefined.
Daniel Jacobowitz is correct that the patch below precedes ppc sibcalls in the FSF sources;
still, it doesn't do the right thing for ppc (sparc, etc.) so a reference is useful:

Wed Apr 24 21:58:09 2002 J"orn Rennecke <joern.rennecke@superh.com>
* calls.c (expand_call): Take current_function_pretend_args_size
into account when setting argblock for sibcalls.

It is not right to do the adjustment in that patch when the caller has already allocated
the stack space for partially-in-regs params. Bootstrapped and tested on darwin.

2003-01-03 Dale Johannesen <dalej@apple.com>

* calls.c (expand_call): Fix sibcalls on REG_PARM_STACK_SPACE machines.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.247
diff -u -d -b -w -r1.247 calls.c
--- calls.c 18 Dec 2002 05:57:43 -0000 1.247
+++ calls.c 3 Jan 2003 19:54:11 -0000

@@ -2699,6 +2716,11 @@
if (pass == 0)
{
argblock = virtual_incoming_args_rtx;
+#ifdef REG_PARM_STACK_SPACE
+#ifndef MAYBE_REG_PARM_STACK_SPACE
+ if (REG_PARM_STACK_SPACE (current_function_fndecl) == 0)
+#endif
+#endif
argblock
#ifdef STACK_GROWS_DOWNWARD
= plus_constant (argblock, current_function_pretend_args_size);



struct S { int a; int b;};
int foo(int, int, int, int, int, int, struct S, int, int);
int foo(int r3, int r4, int r5, int r6, int r7, int r8, struct S s,
int mem1, int mem2) {
if ( mem1!=12 || mem2!=13 )
abort();
return 0;
}
int bar(int r3, int r4, int r5, int r6, int r7, int r8, int r9, struct S s,
int mem1, int mem2, int mem3) {
return foo(3,4,5,6,7,8,s,12,13);
}
int main() {
struct S s = {10, 11};
return bar(3,4,5,6,7,8,9,s,12,13,14);
}


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