OSDN Git Service

* rtl.h (enum reg_note): Add REG_MAYBE_DEAD.
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Aug 2000 00:53:59 +0000 (00:53 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Aug 2000 00:53:59 +0000 (00:53 +0000)
* rtl.c (reg_note_name): Add REG_MAYBE_DEAD.
* flow.c (propagate_one_insn): Allow deletion of prologue/epilogue
insns if they have a REG_MAYBE_DEAD note attached.
* config/rs6000/rs6000.c (rs6000_maybe_dead): New function.
(rs6000_emit_load_toc_table): TOC loads may go dead.

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

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/flow.c
gcc/rtl.c
gcc/rtl.h

index 2f9c4a6..b456697 100644 (file)
@@ -1,3 +1,12 @@
+2000-08-01  Geoff Keating  <geoffk@cygnus.com>
+
+       * rtl.h (enum reg_note): Add REG_MAYBE_DEAD.
+       * rtl.c (reg_note_name): Add REG_MAYBE_DEAD.
+       * flow.c (propagate_one_insn): Allow deletion of prologue/epilogue
+       insns if they have a REG_MAYBE_DEAD note attached.
+       * config/rs6000/rs6000.c (rs6000_maybe_dead): New function.
+       (rs6000_emit_load_toc_table): TOC loads may go dead.
+
 2000-08-01  Jim Wilson  <wilson@cygnus.com>
 
        * config/ia64/ia64.c (ia64_function_arg): Fix last change.  Verify
index 7644606..67ff693 100644 (file)
@@ -4819,6 +4819,16 @@ debug_stack_info (info)
   fprintf (stderr, "\n");
 }
 \f
+/* Add a REG_MAYBE_DEAD note to the insn.  */
+static void
+rs6000_maybe_dead (insn)
+     rtx insn;
+{
+  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
+                                       const0_rtx,
+                                       REG_NOTES (insn));
+}
+
 /* Emit instructions needed to load the TOC register.
    This is only needed when TARGET_TOC, TARGET_MINIMAL_TOC, and there is
    a constant pool; or for SVR4 -fpic.  */
@@ -4839,10 +4849,10 @@ rs6000_emit_load_toc_table (fromprolog)
                      ? gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
                      : gen_reg_rtx (Pmode));
          if (TARGET_32BIT)
-           emit_insn (gen_load_toc_v4_pic_si (temp));
+           rs6000_maybe_dead (emit_insn (gen_load_toc_v4_pic_si (temp)));
          else
-           emit_insn (gen_load_toc_v4_pic_di (temp));
-         emit_move_insn (dest, temp);
+           rs6000_maybe_dead (emit_insn (gen_load_toc_v4_pic_di (temp)));
+         rs6000_maybe_dead (emit_move_insn (dest, temp));
        }
       else if (flag_pic == 2)
         {
@@ -4872,9 +4882,12 @@ rs6000_emit_load_toc_table (fromprolog)
              ASM_GENERATE_INTERNAL_LABEL (buf, "LCL", rs6000_pic_labelno);
              symL = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
 
-             emit_insn (gen_load_toc_v4_PIC_1 (tempLR, symF));
-             emit_move_insn (dest, tempLR);
-             emit_insn (gen_load_toc_v4_PIC_2 (temp0, dest, symL, symF));
+             rs6000_maybe_dead (emit_insn (gen_load_toc_v4_PIC_1 (tempLR, 
+                                                                  symF)));
+             rs6000_maybe_dead (emit_move_insn (dest, tempLR));
+             rs6000_maybe_dead (emit_insn (gen_load_toc_v4_PIC_2 (temp0, dest,
+                                                                  symL,
+                                                                  symF)));
            }
          else
            {
@@ -4887,11 +4900,14 @@ rs6000_emit_load_toc_table (fromprolog)
              ASM_GENERATE_INTERNAL_LABEL (buf, "LCG", reload_toc_labelno++);
              symF = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
 
-             emit_insn (gen_load_toc_v4_PIC_1b (tempLR, symF, tocsym));
-             emit_move_insn (dest, tempLR);
-             emit_move_insn (temp0, gen_rtx_MEM (Pmode, dest));
+             rs6000_maybe_dead (emit_insn (gen_load_toc_v4_PIC_1b (tempLR, 
+                                                                   symF, 
+                                                                   tocsym)));
+             rs6000_maybe_dead (emit_move_insn (dest, tempLR));
+             rs6000_maybe_dead (emit_move_insn (temp0, 
+                                                gen_rtx_MEM (Pmode, dest)));
            }
-         emit_insn (gen_addsi3 (dest, temp0, dest));
+         rs6000_maybe_dead (emit_insn (gen_addsi3 (dest, temp0, dest)));
        }
       else if (flag_pic == 0 && TARGET_MINIMAL_TOC)
         {
@@ -4901,8 +4917,8 @@ rs6000_emit_load_toc_table (fromprolog)
          ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1);
          realsym = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
          
-         emit_insn (gen_elf_high (dest, realsym));
-         emit_insn (gen_elf_low (dest, dest, realsym));
+         rs6000_maybe_dead (emit_insn (gen_elf_high (dest, realsym)));
+         rs6000_maybe_dead (emit_insn (gen_elf_low (dest, dest, realsym)));
        }
       else
         abort();
@@ -4910,9 +4926,9 @@ rs6000_emit_load_toc_table (fromprolog)
   else
     {
       if (TARGET_32BIT)
-        emit_insn (gen_load_toc_aix_si (dest));
+        rs6000_maybe_dead (emit_insn (gen_load_toc_aix_si (dest)));
       else
-        emit_insn (gen_load_toc_aix_di (dest));
+        rs6000_maybe_dead (emit_insn (gen_load_toc_aix_di (dest)));
     }
 }
 
@@ -4939,7 +4955,7 @@ uses_TOC ()
          rtx pat = PATTERN (insn);
          int i;
 
-         if (GET_CODE(pat) == PARALLEL) 
+         if (GET_CODE (pat) == PARALLEL) 
            for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
              if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == UNSPEC 
                 && XINT (XVECEXP (PATTERN (insn), 0, i), 1) == 7)
index 373e236..688e256 100644 (file)
@@ -3428,7 +3428,8 @@ propagate_one_insn (pbi, insn)
       && (((HAVE_epilogue || HAVE_prologue)
           && prologue_epilogue_contains (insn))
          || (HAVE_sibcall_epilogue
-             && sibcall_epilogue_contains (insn))))
+             && sibcall_epilogue_contains (insn)))
+      && find_reg_note (insn, REG_MAYBE_DEAD, NULL_RTX) == 0)
     {
       if (flags & PROP_KILL_DEAD_CODE)
        { 
index 91b38cb..dedb38a 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -258,7 +258,7 @@ const char * const reg_note_name[] =
   "REG_LABEL", "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
   "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
   "REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
-  "REG_EH_RETHROW", "REG_SAVE_NOTE"
+  "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD"
 };
 
 static void fatal_with_file_and_line PARAMS ((FILE *, const char *, ...))
index 24102a9..b96c53f 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -515,7 +515,13 @@ enum reg_note
   REG_EH_RETHROW,
 
   /* Used by haifa-sched to save NOTE_INSN notes across scheduling.  */
-  REG_SAVE_NOTE
+  REG_SAVE_NOTE,
+
+  /* Indicates that this insn (which is part of the prologue) computes
+     a value which might not be used later, and if so it's OK to delete
+     the insn.  Normally, deleting any insn in the prologue is an error. 
+     At present the parameter is unused and set to (const_int 0).  */
+  REG_MAYBE_DEAD
 };
 
 /* The base value for branch probability notes.  */