flags.h (flag_renumber_insns): Declare.
authorMark Mitchell <mark@codesourcery.com>
Thu, 4 Nov 1999 07:23:58 +0000 (07:23 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 4 Nov 1999 07:23:58 +0000 (07:23 +0000)
* flags.h (flag_renumber_insns): Declare.
* emit-rtl.c (renumber_insns): Check flag_renumber_insns.  Print
renumbering table.
* rtl.h (renumber_insns): Change prototype.
* toplev.c (flag_renumber_insns): Define.
(rest_of_compilation): Pass rtl_dump_file to flag_renumber_insns.

From-SVN: r30388

gcc/ChangeLog
gcc/emit-rtl.c
gcc/flags.h
gcc/rtl.h
gcc/toplev.c

index 573144367aede85eaa5eeb4f83a5f88e894faa64..49f90002b864f745936cc0ef77b59c840e234ba3 100644 (file)
@@ -1,3 +1,12 @@
+Wed Nov  3 23:05:14 1999  Mark Mitchell  <mark@codesourcery.com>
+
+       * flags.h (flag_renumber_insns): Declare.
+       * emit-rtl.c (renumber_insns): Check flag_renumber_insns.  Print
+       renumbering table.
+       * rtl.h (renumber_insns): Change prototype.
+       * toplev.c (flag_renumber_insns): Define.
+       (rest_of_compilation): Pass rtl_dump_file to flag_renumber_insns.
+       
 Wed Nov  3 15:11:27 1999  David S. Miller  <davem@redhat.com>
 
        * config/sparc/sparc.md: Remove insn type fpsqrt, add fpsqrts
index fed65a608c1b3a05157e3c494bf25af5f5faaf30..16fe0bc2c8b5b62868b3463e9e88f501ab391d2b 100644 (file)
@@ -1898,21 +1898,33 @@ get_max_uid ()
   return cur_insn_uid;
 }
 
+/* Renumber instructions so that no instruction UIDs are wasted.  */
+
 void
-renumber_insns ()
+renumber_insns (stream)
+     FILE *stream;
 {
   rtx insn;
   int old_max_uid = cur_insn_uid;
 
+  /* If we're not supposed to renumber instructions, don't.  */
+  if (!flag_renumber_insns)
+    return;
+
   /* If there aren't that many instructions, then it's not really
      worth renumbering them.  */
-  if (get_max_uid () < 25000)
+  if (flag_renumber_insns == 1 && get_max_uid () < 25000)
     return;
 
   cur_insn_uid = 1;
 
   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
-    INSN_UID (insn) = cur_insn_uid++;
+    {
+      if (stream)
+       fprintf (stream, "Renumbering insn %d to %d\n", 
+                INSN_UID (insn), cur_insn_uid);
+      INSN_UID (insn) = cur_insn_uid++;
+    }
 }
 \f
 /* Return the next insn.  If it is a SEQUENCE, return the first insn
@@ -2593,7 +2605,6 @@ remove_unncessary_notes ()
 {
   rtx insn;
   rtx next;
-  varray_type block_stack;
 
   /* Remove NOTE_INSN_DELETED notes.  We must not remove the first
      instruction in the function because the compiler depends on the
index 9b88302d7638cf840e346db79a6f0515555c2f6e..1cca4816808b77e61382677b4f82a4e16fd9af2a 100644 (file)
@@ -495,6 +495,11 @@ extern int flag_bounded_pointers;
    For Fortran: defaults to off.
    For CHILL: defaults to off.  */
 extern int flag_bounds_check;
+
+/* If one, renumber instruction UIDs to reduce the number of
+   unused UIDs if there are a lot of instructions.  If greater than
+   one, unconditionally renumber instruction UIDs.  */
+extern int flag_renumber_insns;
 \f
 /* Other basic status info about current function.  */
 
index 4b7ca9683b46f15182ea39016d23d891338fd502..baa4d83bdde268bb8e2f0f7c7fec951a347a8500 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1460,7 +1460,7 @@ extern rtx emit                                   PROTO ((rtx));
    warnings about unreachable code.  */
 int force_line_numbers PROTO((void));
 void restore_line_number_status PROTO((int old_value));
-extern void renumber_insns                      PROTO ((void));
+extern void renumber_insns                      PROTO ((FILE *));
 extern void remove_unncessary_notes             PROTO ((void));
 
 /* In insn-emit.c */
index 232e515b533a1206d745719c8dc80cb19e3ba1a9..5e7dbc0a272f33a938a04294a18085d86afd6030 100644 (file)
@@ -771,6 +771,11 @@ int flag_bounded_pointers = 0;
    For CHILL: defaults to off.  */
 int flag_bounds_check = 0;
 
+/* If one, renumber instruction UIDs to reduce the number of
+   unused UIDs if there are a lot of instructions.  If greater than
+   one, unconditionally renumber instruction UIDs.  */
+int flag_renumber_insns = 1;
+
 /* Values of the -falign-* flags: how much to align labels in code. 
    0 means `use default', 1 means `don't align'.  
    For each variable, there is an _log variant which is the power
@@ -3776,6 +3781,17 @@ rest_of_compilation (decl)
   TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
                                     JUMP_AFTER_REGSCAN));
 
+  /* Jump optimization, and the removal of NULL pointer checks, may
+     have reduced the number of instructions substantially.  CSE, and
+     future passes, allocate arrays whose dimensions involve the maximum
+     instruction UID, so if we can reduce the maximum UID we'll save big on
+     memory.  */
+  renumber_insns (rtl_dump_file);
+
+  /* Dump rtl code after jump, if we are doing that.  */
+  if (jump_opt_dump)
+    close_dump_file (print_rtl, insns);
+
   /* Now is when we stop if -fsyntax-only and -Wreturn-type.  */
   if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
     goto exit_rest_of_compilation;
@@ -3784,20 +3800,9 @@ rest_of_compilation (decl)
   if (flag_delete_null_pointer_checks)
     TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
 
-  /* Dump rtl code after jump, if we are doing that.  */
-  if (jump_opt_dump)
-    close_dump_file (print_rtl, insns);
-
   if (ggc_p)
     ggc_collect ();
 
-  /* Jump optimization, and the removal of NULL pointer checks, may
-     have reduced the number of instructions substantially.  CSE, and
-     future passes, allocate arrays whose dimensions involve the maximum
-     instruction UID, so if we can reduce the maximum UID we'll save big on
-     memory.  */
-  renumber_insns ();
-
   /* Perform common subexpression elimination.
      Nonzero value from `cse_main' means that jumps were simplified
      and some code may now be unreachable, so do
@@ -3832,18 +3837,17 @@ rest_of_compilation (decl)
       if (flag_delete_null_pointer_checks)
        TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
 
-      /* Dump rtl code after cse, if we are doing that.  */
+      /* The second pass of jump optimization is likely to have
+         removed a bunch more instructions.  */
+      renumber_insns (rtl_dump_file);
 
+      /* Dump rtl code after cse, if we are doing that.  */
       if (cse_dump)
        {
          close_dump_file (print_rtl, insns);
          if (graph_dump_format != no_graph)
            print_rtl_graph_with_bb (dump_base_name, ".02.cse", insns);
        }
-
-      /* The second pass of jump optimization is likely to have
-         removed a bunch more instructions.  */
-      renumber_insns ();
     }
 
   purge_addressof (insns);
@@ -3970,7 +3974,6 @@ rest_of_compilation (decl)
        }
 
       /* Dump rtl code after cse, if we are doing that.  */
-
       if (cse2_dump)
        {
          close_dump_file (print_rtl, insns);