jump.c (jump_optimize_1): If we did cross-jumping, and the data will matter, rebuild...
authorRichard Henderson <rth@cygnus.com>
Wed, 27 Oct 1999 22:22:34 +0000 (15:22 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 27 Oct 1999 22:22:34 +0000 (15:22 -0700)
        * jump.c (jump_optimize_1): If we did cross-jumping, and
        the data will matter, rebuild the CFG.
        * reg-stack.c (reg_to_stack): Only (re)build the CFG if
        not optimizing.  Don't run shorten_branches.
        * toplev.c (rest_of_compilation): Run shorten_branches after
        reg_to_stack.

From-SVN: r30223

gcc/ChangeLog
gcc/jump.c
gcc/reg-stack.c
gcc/toplev.c

index f3cb9de62a4b596e4f2daa12cf8262daefde60d2..fc5d4664409ae6036b86f7a531f01e14443660d1 100644 (file)
@@ -1,3 +1,12 @@
+Wed Oct 27 15:21:46 1999  Richard Henderson  <rth@cygnus.com>
+
+       * jump.c (jump_optimize_1): If we did cross-jumping, and
+       the data will matter, rebuild the CFG.
+       * reg-stack.c (reg_to_stack): Only (re)build the CFG if
+       not optimizing.  Don't run shorten_branches.
+       * toplev.c (rest_of_compilation): Run shorten_branches after
+       reg_to_stack.
+
 Wed Oct 27 12:33:40 1999  Mark Mitchell  <mark@codesourcery.com>
 
        * rtl.h (note_stores): Add additional paramter.
index 72a13589af0893b0251997076c16256254be05e6..8170930780b5f45cbd05ea8ddd879d54db32fc96 100644 (file)
@@ -66,6 +66,8 @@ Boston, MA 02111-1307, USA.  */
 #include "expr.h"
 #include "real.h"
 #include "except.h"
+#include "basic-block.h"
+#include "output.h"
 #include "toplev.h"
 
 /* ??? Eventually must record somehow the labels used by jumps
@@ -190,6 +192,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
   int first = 1;
   int max_uid = 0;
   rtx last_insn;
+  int did_cross_jump = 0;
 
   cross_jump_death_matters = (cross_jump == 2);
   max_uid = init_label_info (f) + 1;
@@ -2127,6 +2130,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
 
                  if (newjpos != 0)
                    {
+                     did_cross_jump = 1;
                      do_cross_jump (insn, newjpos, newlpos);
                      /* Make the old conditional jump
                         into an unconditional one.  */
@@ -2179,6 +2183,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
 
                  if (newjpos != 0)
                    {
+                     did_cross_jump = 1;
                      do_cross_jump (insn, newjpos, newlpos);
                      changed = 1;
                      next = insn;
@@ -2210,6 +2215,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
 
                  if (newjpos != 0)
                    {
+                     did_cross_jump = 1;
                      do_cross_jump (insn, newjpos, newlpos);
                      changed = 1;
                      next = insn;
@@ -2274,6 +2280,23 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
 
   /* Show JUMP_CHAIN no longer valid.  */
   jump_chain = 0;
+
+#if defined(DELAY_SLOTS) || defined(STACK_REGS)
+  /* ??? Keep the CFG up to date after cross-jumping.  */
+  if (did_cross_jump && !cross_jump_death_matters)
+    {
+      sbitmap blocks;
+
+      find_basic_blocks (f, old_max_reg, NULL, 0);
+
+      blocks = sbitmap_alloc (n_basic_blocks);
+      sbitmap_ones (blocks);
+      count_or_remove_death_notes (blocks, 1);
+      sbitmap_free (blocks);
+
+      life_analysis (f, old_max_reg, NULL, 0);
+    }
+#endif
 }
 \f
 /* Initialize LABEL_NUSES and JUMP_LABEL fields.  Delete any REG_LABEL
index 50e55c1147d74e6a1ead67dae54355430fb02cc6..7ab8184a3a30208c8572ad6619c57c18e2cb5a10 100644 (file)
@@ -406,8 +406,7 @@ pop_stack (regstack, regno)
    register file.  FIRST is the first insn in the function, FILE is the
    dump file, if used.
 
-   Construct a CFG and run life analysis.  (When optimizing, the data
-   was corruped by jump2's cross-jumping.)  Then convert each insn one
+   Construct a CFG and run life analysis.  Then convert each insn one
    by one.  Run a last jump_optimize pass, if optimizing, to eliminate
    code duplication created when the converter inserts pop insns on
    the edges.  */
@@ -430,16 +429,19 @@ reg_to_stack (first, file)
   if (i > LAST_STACK_REG)
     return;
 
-  /* Ok, floating point instructions exist.  Rebuild the CFG and run 
-     life analysis.  */
-  find_basic_blocks (first, max_reg_num (), file, 0);
+  /* Ok, floating point instructions exist.  If not optimizing, 
+     build the CFG and run life analysis.  */
+  if (! optimize)
+    {
+      find_basic_blocks (first, max_reg_num (), file, 0);
 
-  blocks = sbitmap_alloc (n_basic_blocks);
-  sbitmap_ones (blocks);
-  count_or_remove_death_notes (blocks, 1);
-  sbitmap_free (blocks);
+      blocks = sbitmap_alloc (n_basic_blocks);
+      sbitmap_ones (blocks);
+      count_or_remove_death_notes (blocks, 1);
+      sbitmap_free (blocks);
 
-  life_analysis (first, max_reg_num (), file, 0);
+      life_analysis (first, max_reg_num (), file, 0);
+    }
 
   /* Set up block info for each basic block.  */
   bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi));
@@ -488,9 +490,6 @@ reg_to_stack (first, file)
     {
       jump_optimize (first, JUMP_CROSS_JUMP_DEATH_MATTERS,
                     !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
-
-      /* This has the effect of resetting label alignments around loops.  */
-      shorten_branches (get_insns ());
     }
 
   VARRAY_FREE (stack_regs_mentioned_data);
index 35f88d062f7df04a1461d3dc0e1fe5c43d770db8..1933b41b41be16f120169aea4f9e8d8fc65abe79 100644 (file)
@@ -4333,12 +4333,6 @@ rest_of_compilation (decl)
      ggc_collect ();
 #endif
 
-  /* Shorten branches.  */
-  TIMEVAR (shorten_branch_time,
-          {
-            shorten_branches (get_insns ());
-          });
-
 #ifdef STACK_REGS
   if (stack_reg_dump)
     open_dump_file (".20.stack", decl_printable_name (decl, 2));
@@ -4356,6 +4350,12 @@ rest_of_compilation (decl)
      ggc_collect ();
 #endif
 
+  /* Shorten branches.  */
+  TIMEVAR (shorten_branch_time,
+          {
+            shorten_branches (get_insns ());
+          });
+
   /* Now turn the rtl into assembler code.  */
 
   TIMEVAR (final_time,