flow.c (life_analysis): Preserve registers used by the epilogue.
authorMike Stump <mrs@gcc.gnu.org>
Wed, 21 Aug 1996 23:03:07 +0000 (23:03 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Wed, 21 Aug 1996 23:03:07 +0000 (23:03 +0000)
* flow.c (life_analysis): Preserve registers used by the epilogue.
(mark_used_regs): Likewise.
* reorg.c (fill_simple_delay_slots): Likewise.
(dbr_schedule): Likewise.
Fixes eh49.C for sparc.

From-SVN: r12666

gcc/flow.c
gcc/reorg.c

index d38e56df64ec4229d8574b0da1bacf6331dbc4f0..86d72286331a72db86c864ec2ec94ef623657464 100644 (file)
@@ -1087,12 +1087,17 @@ life_analysis (f, nregs)
 #endif      
       }
 
-  /* Mark all global registers as being live at the end of the function
-     since they may be referenced by our caller.  */
+  /* Mark all global registers and all registers used by the epilogue
+     as being live at the end of the function since they may be
+     referenced by our caller.  */
 
   if (n_basic_blocks > 0)
     for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-      if (global_regs[i])
+      if (global_regs[i]
+#ifdef EPILOGUE_USES
+         || EPILOGUE_USES (i)
+#endif
+         )
        {
          basic_block_live_at_end[n_basic_blocks - 1]
            [i / REGSET_ELT_BITS]
@@ -2665,7 +2670,7 @@ mark_used_regs (needed, live, x, final, insn)
     case RETURN:
       /* If exiting needs the right stack value, consider this insn as
         using the stack pointer.  In any event, consider it as using
-        all global registers.  */
+        all global registers and all registers used by return.  */
 
 #ifdef EXIT_IGNORE_STACK
       if (! EXIT_IGNORE_STACK
@@ -2675,7 +2680,11 @@ mark_used_regs (needed, live, x, final, insn)
          |= (REGSET_ELT_TYPE) 1 << (STACK_POINTER_REGNUM % REGSET_ELT_BITS);
 
       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-       if (global_regs[i])
+       if (global_regs[i]
+#ifdef EPILOGUE_USES
+           || EPILOGUE_USES (i)
+#endif
+           )
          live[i / REGSET_ELT_BITS]
            |= (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
       break;
index 54ad9389aa0f4f8296a4364acdb35707e6aa87e3..beec1681cb437044891aaf4bbee05e15a64c96f9 100644 (file)
@@ -3344,6 +3344,14 @@ fill_simple_delay_slots (first, non_jumps_p)
   else
     SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM);
 
+#ifdef EPILOGUE_USES
+  for (i = 0; i <FIRST_PSEUDO_REGISTER; i++)
+    {
+      if (EPILOGUE_USES (i))
+       SET_HARD_REG_BIT (needed.regs, i);
+    }
+#endif
+
   for (trial = get_last_insn (); ! stop_search_p (trial, 1);
        trial = PREV_INSN (trial))
     {
@@ -4450,7 +4458,11 @@ dbr_schedule (first, file)
                               &end_of_function_needs, 1);
 
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-    if (global_regs[i])
+    if (global_regs[i]
+#ifdef EPILOGUE_USES
+       || EPILOGUE_USES (i)
+#endif
+       )
       SET_HARD_REG_BIT (end_of_function_needs.regs, i);
 
   /* The registers required to be live at the end of the function are