OSDN Git Service

* config/sh/sh.c (sh_expand_prologue): Insns that set up the PIC
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Mar 2001 12:34:13 +0000 (12:34 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Mar 2001 12:34:13 +0000 (12:34 +0000)
register may be dead.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40550 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 755267d..7d3d804 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-16  Alexandre Oliva  <aoliva@redhat.com>
+
+       * config/sh/sh.c (sh_expand_prologue): Insns that set up the PIC
+       register may be dead.
+
 2001-03-16  Brad Lucier  <lucier@math.purdue.edu>
 
        * Makefile.in (hash.o): Depend on CONFIG_H.
index 4385a0f..f991fe7 100644 (file)
@@ -3987,7 +3987,23 @@ sh_expand_prologue ()
   push_regs (live_regs_mask, live_regs_mask2);
 
   if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
-    emit_insn (gen_GOTaddr2picreg ());
+    {
+      rtx insn = get_last_insn ();
+      rtx last = emit_insn (gen_GOTaddr2picreg ());
+
+      /* Mark these insns as possibly dead.  Sometimes, flow2 may
+        delete all uses of the PIC register.  In this case, let it
+        delete the initialization too.  */
+      do
+       {
+         insn = NEXT_INSN (insn);
+
+         REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
+                                               const0_rtx,
+                                               REG_NOTES (insn));
+       }
+      while (insn != last);
+    }
 
   if (target_flags != save_flags)
     {