Hi,

On Tue, 19 Jun 2007, Kenneth Zadeck wrote:

> The reason that there is no reg_dead not in the last use (insn 45)
> before the sib_call (insn 46)  is that there is no def for r0 in the
> sibcall (insn 46) and r0 is live at the end of the block.
> 
> This of course changes the question to not why there no note to why is
> there no def.

Below is a possible solution I found, if there weren't that comment... :)

One problem here might be that exit_block_uses includes the return 
register, but that's not exactly true for abnormal exits, where the return 
value is not provided by the function itself. The patch below clears these 
register if it gets to the exit via a sibcall edge, but there may be 
other cases as well.

Looking at the exit_block_uses usage I'm a little confused about this 
expression, which is used quite a bit:

        (SIBLING_CALL_P (insn) && bitmap_bit_p (df->exit_block_uses, dregno)
        && !refers_to_regno_p (dregno, dregno+1, current_function_return_rtx, 
(rtx *)0)))

I don't quite understand the point of this, at least on m68k this is 
pretty much a no-op. exit_block_uses contains: 0 [%d0] 8 [%a0] 14 [%a6] 15 
[%sp], return_rtx contains %d0/%a0, so for %d0/%a0 it's always false and 
%a6/%sp don't appear in call defs, so I don't understand this special 
casing of sibcalls.

Another question I have is about DF_REF_MAY_CLOBBER, any function call
would also clobber the return value and I see defs generated for calls, 
but they are only marked with DF_REF_MAY_CLOBBER and thus the use chain 
isn't broken by calls. Why is that? The header file doesn't go into any 
details what "better information" it needs.

bye, Roman

Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c   (revision 125811)
+++ gcc/df-problems.c   (working copy)
@@ -1574,7 +1574,7 @@
   /* Call-clobbered registers die across exception and call edges.  */
   /* ??? Abnormal call edges ignored for the moment, as this gets
      confused by sibling call edges, which crashes reg-stack.  */
-  if (e->flags & EDGE_EH)
+  if ((e->flags & EDGE_EH) || (e->flags & EDGE_SIBCALL))
     bitmap_ior_and_compl_into (op1, op2, df_invalidated_by_call);
   else
     bitmap_ior_into (op1, op2);

Reply via email to