regmove.c (regmove_optimize): Add variable old_max_uid.
authorBernd Schmidt <crux@pool.informatik.rwth-aachen.de>
Thu, 1 Oct 1998 19:00:52 +0000 (13:00 -0600)
committerJeff Law <law@gcc.gnu.org>
Thu, 1 Oct 1998 19:00:52 +0000 (13:00 -0600)
        * regmove.c (regmove_optimize): Add variable old_max_uid.
        At the end of the function, update basic_block_end.

From-SVN: r22724

gcc/ChangeLog
gcc/regmove.c

index f77ad08e99b4f69345b4fb57b54a895b844092b8..4905914731d4f5ee512f9410c137f4257b410a82 100644 (file)
@@ -1,3 +1,8 @@
+Thu Oct  1 19:58:30 1998  Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
+
+       * regmove.c (regmove_optimize): Add variable old_max_uid.
+       At the end of the function, update basic_block_end.
+
 Thu Oct  1 17:58:25 1998  David S. Miller  <davem@pierdol.cobaltmicro.com>
 
        * dwarf2out.c (expand_builtin_dwarf_reg_size): Use
index 7f94be4ff89381a9123129a0ba880a8196947350..41235f137041f6d0c81d6d90f0b0125c6cffb4dc 100644 (file)
@@ -917,6 +917,7 @@ regmove_optimize (f, nregs, regmove_dump_file)
      int nregs;
      FILE *regmove_dump_file;
 {
+  int old_max_uid = get_max_uid ();
   rtx insn;
   struct match match;
   int pass;
@@ -926,8 +927,8 @@ regmove_optimize (f, nregs, regmove_dump_file)
   regno_src_regno = (int *)alloca (sizeof *regno_src_regno * nregs);
   for (i = nregs; --i >= 0; ) regno_src_regno[i] = -1;
 
-  regmove_bb_head = (int *)alloca (sizeof (int) * (get_max_uid () + 1));
-  for (i = get_max_uid (); i >= 0; i--) regmove_bb_head[i] = -1;
+  regmove_bb_head = (int *)alloca (sizeof (int) * (old_max_uid + 1));
+  for (i = old_max_uid; i >= 0; i--) regmove_bb_head[i] = -1;
   for (i = 0; i < n_basic_blocks; i++)
     regmove_bb_head[INSN_UID (basic_block_head[i])] = i;
 
@@ -1384,6 +1385,19 @@ regmove_optimize (f, nregs, regmove_dump_file)
        }
     }
 #endif /* REGISTER_CONSTRAINTS */
+
+  /* In fixup_match_1, some insns may have been inserted after basic block
+     ends.  Fix that here.  */
+  for (i = 0; i < n_basic_blocks; i++)
+    {
+      rtx end = basic_block_end[i];
+      rtx new = end;
+      rtx next = NEXT_INSN (new);
+      while (next != 0 && INSN_UID (next) >= old_max_uid
+            && (i == n_basic_blocks - 1 || basic_block_head[i + 1] != next))
+       new = next, next = NEXT_INSN (new);
+      basic_block_end[i] = new;
+    }
 }
 
 /* Returns the INSN_CODE for INSN if its pattern has matching constraints for