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
This commit is contained in:
parent
0511851c7b
commit
aeeeda0391
3 changed files with 67 additions and 18 deletions
|
@ -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.
|
||||
|
|
|
@ -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. */
|
||||
|
|
34
gcc/toplev.c
34
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue