toplev.c (rest_of_compilation): Don't call optimize_mode_switching unless OPTIMIZE_MO...
authorRichard Henderson <rth@cygnus.com>
Wed, 17 May 2000 21:01:07 +0000 (14:01 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 17 May 2000 21:01:07 +0000 (14:01 -0700)
        * toplev.c (rest_of_compilation): Don't call optimize_mode_switching
        unless OPTIMIZE_MODE_SWITCHING.  Conditionally set no_new_pseudos.
        Don't call recompute_reg_usage if no_new_pseudos is true.
        * lcm.c (optimize_mode_switching): Move ifdefs outside function.
        Return true if we did work; update global life information.
        * basic-block.h (optimize_mode_switching): Update decl.

From-SVN: r33965

gcc/ChangeLog
gcc/basic-block.h
gcc/lcm.c
gcc/toplev.c

index a82a24bc4d7eafaef3e4986de1d5d4c278215149..577189f75aa0f70a7bf75ba2e39fa618f593c974 100644 (file)
@@ -1,3 +1,12 @@
+2000-05-17  Richard Henderson  <rth@cygnus.com>
+
+       * toplev.c (rest_of_compilation): Don't call optimize_mode_switching
+       unless OPTIMIZE_MODE_SWITCHING.  Conditionally set no_new_pseudos.
+       Don't call recompute_reg_usage if no_new_pseudos is true.
+       * lcm.c (optimize_mode_switching): Move ifdefs outside function.
+       Return true if we did work; update global life information.
+       * basic-block.h (optimize_mode_switching): Update decl.
+
 2000-05-17  Neil Booth  <neilb@earthling.net>
 
        * cpplex.c (expand_name_space): Don't use ptrdiff_t.
index f9eb268458a585674ecb51c372a20e2985adc503..c7ae0f863839d2dcceed9c62449b44e81fb6bd93 100644 (file)
@@ -450,7 +450,7 @@ extern struct edge_list *pre_edge_rev_lcm PARAMS ((FILE *, int, sbitmap *,
                                                   sbitmap **));
 extern void compute_available          PARAMS ((sbitmap *, sbitmap *,
                                                 sbitmap *, sbitmap *));
-extern void optimize_mode_switching    PARAMS ((FILE *));
+extern int optimize_mode_switching     PARAMS ((FILE *));
 
 /* In emit-rtl.c.  */
 extern rtx emit_block_insn_after       PARAMS ((rtx, rtx, basic_block));
index 2d054d10a94f3bcf0989526d08fb02bd8f84cc94..2f9aaa8af5d50db4e5e93e0124fc6fb4d6d26a51 100644 (file)
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -958,16 +958,14 @@ reg_becomes_live (reg, setter, live)
         nregs--)
       SET_HARD_REG_BIT (* (HARD_REG_SET *) live, regno + nregs);
 }
-#endif
 
-/* Find all insns that need a particular mode
-   setting, and insert the necessary mode switches.  */
+/* Find all insns that need a particular mode setting, and insert the
+   necessary mode switches.  Return true if we did work.  */
 
-void
+int
 optimize_mode_switching (file)
-     FILE *file ATTRIBUTE_UNUSED;
+     FILE *file;
 {
-#ifdef OPTIMIZE_MODE_SWITCHING
   rtx insn;
   int bb, e;
   edge eg;
@@ -994,7 +992,7 @@ optimize_mode_switching (file)
       }
 
   if (! n_entities)
-    return;
+    return 0;
 
 #ifdef MODE_USES_IN_EXIT_BLOCK
   /* For some ABIs a particular mode setting is required at function exit.  */
@@ -1017,7 +1015,7 @@ optimize_mode_switching (file)
       else if (NEXT_INSN (use) == BLOCK_HEAD (bb))
        BLOCK_HEAD (bb) = NEXT_INSN (insn);
     }
-#endif
+#endif /* MODE_USES_IN_EXIT_BLOCK */
 
   /* Create the bitmap vectors.  */
 
@@ -1034,7 +1032,7 @@ optimize_mode_switching (file)
       struct bb_info *info = bb_info[j];
 
       /* Determine what the first use (if any) need for a mode of entity E is.
-        This will be th mode that is anticipatable for this block.
+        This will be the mode that is anticipatable for this block.
         Also compute the initial transparency settings.  */
       for (bb = 0 ; bb < n_basic_blocks; bb++)
        {
@@ -1253,5 +1251,18 @@ optimize_mode_switching (file)
 
   if (need_commit)
     commit_edge_insertions ();
-#endif /* OPTIMIZE_MODE_SWITCHING */
+
+  /* Ideally we'd figure out what blocks were affected and start from
+     there, but this is enormously complicated by commit_edge_insertions,
+     which would screw up any indicies we'd collected, and also need to
+     be involved in the update.  Bail and recompute global life info for
+     everything.  */
+
+  allocate_reg_life_data ();
+  update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
+                   (PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
+                    | PROP_SCAN_DEAD_CODE | PROP_REG_INFO));
+
+  return 1;
 }
+#endif /* OPTIMIZE_MODE_SWITCHING */
index 470a6ab6314c68275b66cfb891e0997b9ec081c5..52f6cb821a1c0eca54fed74e04da26ba1e89d513 100644 (file)
@@ -3234,12 +3234,22 @@ rest_of_compilation (decl)
        ggc_collect ();
     }
 
-  if (optimize && n_basic_blocks)
+#ifdef OPTIMIZE_MODE_SWITCHING
+  if (optimize)
     {
       timevar_push (TV_GCSE);
-      optimize_mode_switching (NULL_PTR);
+
+      if (optimize_mode_switching (NULL_PTR))
+       {
+         /* We did work, and so had to regenerate global life information.
+            Take advantage of this and don't re-recompute register life
+            information below.  */
+         no_new_pseudos = 1;
+       }
+
       timevar_pop (TV_GCSE);
     }
+#endif
 
 #ifdef INSN_SCHEDULING
 
@@ -3280,9 +3290,7 @@ rest_of_compilation (decl)
      RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
      jump optimizer after register allocation and reloading are finished.  */
 
-  /* We recomputed reg usage as part of updating the rest
-     of life info during sched.  */
-  if (! flag_schedule_insns)
+  if (! no_new_pseudos)
     {
       recompute_reg_usage (insns, ! optimize_size);