Patch: fix regression in PPC sibcalls

Dale Johannesen dalej@apple.com
Fri Jan 3 20:04:00 GMT 2003


On Friday, December 27, 2002, at 08:49  AM, Franz Sirl wrote:
> On Saturday 21 December 2002 20:21, Dale Johannesen wrote:
>> This patch breaks ppc (also sparc and probably others, I think)
>> sibcalls:
>>
>> 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, that is, when
>> REG_PARM_STACK_SPACE is defined.
>> Bootstrapped and tested on darwin.
>>
>> 2002-12-21  Dale Johannesen  <dalej@apple.com>
>>
>>          * calls.c (expand_call):  Fix sibcalls on 
>> REG_PARM_STACK_SPACE
>> machines.
>
> Does this cover the REG_PARM_STACK_SPACE defined to 0 case as well?

After staring at this a while longer, I think the answer is no (which 
means
the doc for REG_PARM_STACK_SPACE does not match the actual usage).  I've
redone the patch to check for only the nonzero case, which I'm sure is
correct:

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,12 +2716,15 @@
        if (pass == 0)
         {
           argblock = virtual_incoming_args_rtx;
+#if !defined (REG_PARM_STACK_SPACE) || \
+    REG_PARM_STACK_SPACE (current_function_fndecl) == 0
           argblock
  #ifdef STACK_GROWS_DOWNWARD
             = plus_constant (argblock, 
current_function_pretend_args_size);
  #else
             = plus_constant (argblock, 
-current_function_pretend_args_size);
  #endif
+#endif
           stored_args_map = sbitmap_alloc (args_size.constant);
           sbitmap_zero (stored_args_map);
         }

I'm not convinced the code above is correct for all targets, but I am 
not really
equipped to test elsewhere, and the above should not break anything.  
Perhaps I
should just request that J"orn Rennecke's patch above be reverted; it 
clearly
breaks ppc (darwin and AIX).  If this doesn't get approved I'll do 
that, I guess.



More information about the Gcc-patches mailing list