reload1.c (emit_reload_insns): Accept a new arg for the bb.
authorRichard Henderson <rth@cygnus.com>
Sun, 20 Sep 1998 23:29:09 +0000 (16:29 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 20 Sep 1998 23:29:09 +0000 (16:29 -0700)
        * reload1.c (emit_reload_insns): Accept a new arg for the bb.  Use
        it to update bb boundaries.  Update caller.
        * function.c (reposition_prologue_and_epilogue_notes): Update
        bb boundaries wrt the moved note.

From-SVN: r22507

gcc/ChangeLog
gcc/function.c
gcc/reload1.c

index 2e90a70c60f4edbfd2efc30c56bc1eea5896a19d..01893e99ebf303635a023df132d67e77d888cea5 100644 (file)
@@ -1,3 +1,10 @@
+Sun Sep 20 23:28:11 1998  Richard Henderson  <rth@cygnus.com>
+
+       * reload1.c (emit_reload_insns): Accept a new arg for the bb.  Use
+       it to update bb boundaries.  Update caller.
+       * function.c (reposition_prologue_and_epilogue_notes): Update
+       bb boundaries wrt the moved note.
+
 Sun Sep 20 20:57:02 1998  Robert Lipe  <robertl@dgii.com>
        
        * configure.in (i*86-*-sysv5*): Use fixinc.svr4 to patch byteorder
index c75648dbf3095851750dd46e7bbfbd4bca980b34..99163e61a3cec30a52c5fc99e2608f6273f6d503 100644 (file)
@@ -6239,12 +6239,19 @@ reposition_prologue_and_epilogue_notes (f)
                            && NOTE_LINE_NUMBER (note) == NOTE_INSN_PROLOGUE_END)
                          break;
                    }
+
                  next = NEXT_INSN (note);
                  prev = PREV_INSN (note);
                  if (prev)
                    NEXT_INSN (prev) = next;
                  if (next)
                    PREV_INSN (next) = prev;
+
+                 /* Whether or not we can depend on basic_block_head, 
+                    attempt to keep it up-to-date.  */
+                 if (basic_block_head[0] == note)
+                   basic_block_head[0] = next;
+
                  add_insn_after (note, insn);
                }
            }
@@ -6283,7 +6290,14 @@ reposition_prologue_and_epilogue_notes (f)
                    NEXT_INSN (prev) = next;
                  if (next)
                    PREV_INSN (next) = prev;
-                 add_insn_after (note, PREV_INSN (insn));
+
+                 /* Whether or not we can depend on basic_block_head, 
+                    attempt to keep it up-to-date.  */
+                 if (n_basic_blocks
+                     && basic_block_head[n_basic_blocks-1] == insn)
+                   basic_block_head[n_basic_blocks-1] = note;
+
+                 add_insn_before (note, insn);
                }
            }
        }
index 98cbae0cbc8101df6bc8fddd34903773444c0a6c..d8eb32633bc38532fa2efbdfa572376853ac6bad 100644 (file)
@@ -387,7 +387,7 @@ static int reload_reg_reaches_end_p PROTO((int, int, enum reload_type));
 static int allocate_reload_reg         PROTO((int, rtx, int, int));
 static void choose_reload_regs         PROTO((rtx, rtx));
 static void merge_assigned_reloads     PROTO((rtx));
-static void emit_reload_insns          PROTO((rtx));
+static void emit_reload_insns          PROTO((rtx, int));
 static void delete_output_reload       PROTO((rtx, int, rtx));
 static void inc_for_reload             PROTO((rtx, rtx, int));
 static int constraint_accepts_reg_p    PROTO((char *, rtx));
@@ -4219,7 +4219,7 @@ reload_as_needed (first, live_known)
 
              /* Generate the insns to reload operands into or out of
                 their reload regs.  */
-             emit_reload_insns (insn);
+             emit_reload_insns (insn, this_block);
 
              /* Substitute the chosen reload regs from reload_reg_rtx
                 into the insn's body (or perhaps into the bodies of other
@@ -6329,8 +6329,9 @@ merge_assigned_reloads (insn)
 /* Output insns to reload values in and out of the chosen reload regs.  */
 
 static void
-emit_reload_insns (insn)
+emit_reload_insns (insn, bb)
      rtx insn;
+     int bb;
 {
   register int j;
   rtx input_reload_insns[MAX_RECOG_OPERANDS];
@@ -6345,7 +6346,7 @@ emit_reload_insns (insn)
   rtx other_operand_reload_insns = 0;
   rtx other_output_reload_insns[MAX_RECOG_OPERANDS];
   rtx following_insn = NEXT_INSN (insn);
-  rtx before_insn = insn;
+  rtx before_insn = PREV_INSN (insn);
   int special;
   /* Values to be put in spill_reg_store are put here first.  */
   rtx new_spill_reg_store[FIRST_PSEUDO_REGISTER];
@@ -7251,18 +7252,18 @@ emit_reload_insns (insn)
      reloads for the operand.  The RELOAD_OTHER output reloads are
      output in descending order by reload number.  */
 
-  emit_insns_before (other_input_address_reload_insns, before_insn);
-  emit_insns_before (other_input_reload_insns, before_insn);
+  emit_insns_before (other_input_address_reload_insns, insn);
+  emit_insns_before (other_input_reload_insns, insn);
 
   for (j = 0; j < reload_n_operands; j++)
     {
-      emit_insns_before (inpaddr_address_reload_insns[j], before_insn);
-      emit_insns_before (input_address_reload_insns[j], before_insn);
-      emit_insns_before (input_reload_insns[j], before_insn);
+      emit_insns_before (inpaddr_address_reload_insns[j], insn);
+      emit_insns_before (input_address_reload_insns[j], insn);
+      emit_insns_before (input_reload_insns[j], insn);
     }
 
-  emit_insns_before (other_operand_reload_insns, before_insn);
-  emit_insns_before (operand_reload_insns, before_insn);
+  emit_insns_before (other_operand_reload_insns, insn);
+  emit_insns_before (operand_reload_insns, insn);
 
   for (j = 0; j < reload_n_operands; j++)
     {
@@ -7272,6 +7273,15 @@ emit_reload_insns (insn)
       emit_insns_before (other_output_reload_insns[j], following_insn);
     }
 
+  /* Keep basic block info up to date.  */
+  if (n_basic_blocks)
+    {
+      if (basic_block_head[bb] == insn)
+        basic_block_head[bb] = NEXT_INSN (before_insn);
+      if (basic_block_end[bb] == insn)
+        basic_block_end[bb] = PREV_INSN (following_insn);
+    }
+
   /* Move death notes from INSN
      to output-operand-address and output reload insns.  */
 #ifdef PRESERVE_DEATH_INFO_REGNO_P