sh.c (sh_expand_prologue): Mark GOTaddr2picreg as MAYBE_DEAD.
authorAlexandre Oliva <aoliva@redhat.com>
Mon, 18 Sep 2000 16:45:48 +0000 (16:45 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Mon, 18 Sep 2000 16:45:48 +0000 (16:45 +0000)
* config/sh/sh.c (sh_expand_prologue): Mark GOTaddr2picreg as
MAYBE_DEAD.
(sh_expand_epilogue): Take the PIC register into account when
computing the frame size.

From-SVN: r36496

gcc/ChangeLog
gcc/config/sh/sh.c

index 368cab3..ae81594 100644 (file)
@@ -1,5 +1,10 @@
 2000-09-18  Alexandre Oliva  <aoliva@redhat.com>
 
+       * config/sh/sh.c (sh_expand_prologue): Mark GOTaddr2picreg as
+       MAYBE_DEAD.
+       (sh_expand_epilogue): Take the PIC register into account when
+       computing the frame size.
+
        * config/sh/sh.c (nonpic_symbol_mentioned_p): Check LABEL_REFs.
        * config/sh/sh.md (sym_label2reg, symPLT_label2reg): Protect
        LABEL_REFs with a PIC-safe unspec.
index 903f1c5..1807916 100644 (file)
@@ -3950,7 +3950,17 @@ sh_expand_prologue ()
 
   if (flag_pic && (current_function_uses_pic_offset_table
                   || regs_ever_live[PIC_OFFSET_TABLE_REGNUM]))
-    emit_insn (gen_GOTaddr2picreg ());
+    {
+      rtx insn = get_last_insn ();
+      rtx insn_end = emit_insn (gen_GOTaddr2picreg ());
+      while (insn != insn_end)
+       {
+         insn = NEXT_INSN (insn);
+         REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
+                                               const0_rtx,
+                                               REG_NOTES (insn));
+       }
+    }
 
   if (target_flags != save_flags)
     emit_insn (gen_toggle_sz ());
@@ -3976,6 +3986,14 @@ sh_expand_epilogue ()
 
   live_regs_mask = calc_live_regs (&d, &live_regs_mask2);
 
+  if (flag_pic && current_function_uses_pic_offset_table)
+    {
+      if ((live_regs_mask & (1 << PIC_OFFSET_TABLE_REGNUM)) != 0)
+       abort ();
+      live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
+      d += UNITS_PER_WORD;
+    }
+
   frame_size = rounded_frame_size (d);
 
   if (frame_pointer_needed)
@@ -4003,8 +4021,6 @@ sh_expand_epilogue ()
 
   if (target_flags != save_flags)
     emit_insn (gen_toggle_sz ());
-  if (flag_pic && current_function_uses_pic_offset_table)
-    live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
   if (live_regs_mask & (1 << PR_REG))
     pop (PR_REG);
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)