aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-11-03 23:18:57 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-11-03 23:18:57 +0000
commitaeeeda0391708755e09263bec674298280794f60 (patch)
tree7691daea056bed68a7b131047a7e13c2876fb901
parent0511851c7bebdaee1226960fe405c9089a120a23 (diff)
downloadgcc-aeeeda0391708755e09263bec674298280794f60.zip
gcc-aeeeda0391708755e09263bec674298280794f60.tar.gz
gcc-aeeeda0391708755e09263bec674298280794f60.tar.bz2
rtl.h (renumber_insns): New function.
* rtl.h (renumber_insns): New function. (remove_unnecessary_notes): Likewise. * emit-rtl.c (renumber_insns): Define. (remove_unncessary_notes): Likewise. * toplev.c (rest_of_compilation): Remove dead code. Use renumber_insns and remove_unncessary_notes. From-SVN: r30385
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/emit-rtl.c44
-rw-r--r--gcc/toplev.c34
3 files changed, 67 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b090806..efeee30 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
Wed Nov 3 14:51:59 1999 Mark P. Mitchell <mark@codesourcery.com>
+ * rtl.h (renumber_insns): New function.
+ (remove_unnecessary_notes): Likewise.
+ * emit-rtl.c (renumber_insns): Define.
+ (remove_unncessary_notes): Likewise.
+ * toplev.c (rest_of_compilation): Remove dead code.
+ Use renumber_insns and remove_unncessary_notes.
+
* gcse.c (struct null_pointer_info): New type.
(get_bitmap_width): New function.
(current_block): Remove.
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index cb49d7f..fed65a6 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1897,6 +1897,23 @@ get_max_uid ()
{
return cur_insn_uid;
}
+
+void
+renumber_insns ()
+{
+ rtx insn;
+ int old_max_uid = cur_insn_uid;
+
+ /* If there aren't that many instructions, then it's not really
+ worth renumbering them. */
+ if (get_max_uid () < 25000)
+ return;
+
+ cur_insn_uid = 1;
+
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ INSN_UID (insn) = cur_insn_uid++;
+}
/* Return the next insn. If it is a SEQUENCE, return the first insn
of the sequence. */
@@ -2568,6 +2585,33 @@ reorder_insns_with_line_notes (from, to, after)
NOTE_LINE_NUMBER (after_line),
to);
}
+
+/* Remove unncessary notes from the instruction stream. */
+
+void
+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
+ first instruction being a note. */
+ for (insn = NEXT_INSN (get_insns ()); insn; insn = next)
+ {
+ /* Remember what's next. */
+ next = NEXT_INSN (insn);
+
+ /* We're only interested in notes. */
+ if (GET_CODE (insn) != NOTE)
+ continue;
+
+ if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
+ remove_insn (insn);
+ }
+}
+
/* Emit an insn of given code and pattern
at a specified place within the doubly-linked list. */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 4152f23..232e515 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -3562,15 +3562,14 @@ rest_of_compilation (decl)
register rtx insns;
int start_time = get_run_time ();
int tem;
- /* Nonzero if we have saved the original DECL_INITIAL of the function,
- to be restored after we finish compiling the function
- (for use when compiling inline calls to this function). */
- tree saved_block_tree = 0;
- /* Likewise, for DECL_ARGUMENTS. */
- tree saved_arguments = 0;
int failure = 0;
int rebuild_label_notes_after_reload;
+ /* First, remove any notes we don't need. That will make iterating
+ over the instruction sequence faster, and allow the garbage
+ collector to reclaim the memory used by the notes. */
+ remove_unncessary_notes ();
+
/* If we are reconsidering an inline function
at the end of compilation, skip the stuff for making it inline. */
@@ -3792,6 +3791,13 @@ rest_of_compilation (decl)
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
@@ -3834,6 +3840,10 @@ rest_of_compilation (decl)
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);
@@ -4455,18 +4465,6 @@ rest_of_compilation (decl)
sdbout_types (NULL_TREE);
#endif
- /* Put back the tree of subblocks and list of arguments
- from before we copied them.
- Code generation and the output of debugging info may have modified
- the copy, but the original is unchanged. */
-
- if (saved_block_tree != 0)
- {
- DECL_INITIAL (decl) = saved_block_tree;
- DECL_ARGUMENTS (decl) = saved_arguments;
- DECL_ABSTRACT_ORIGIN (decl) = NULL_TREE;
- }
-
reload_completed = 0;
flow2_completed = 0;
no_new_pseudos = 0;