rtl.h (rebuild_jump_labels): Declare.
* rtl.h (rebuild_jump_labels): Declare. * jump.c (jump_optimize_1): Renamed from jump_optimize. Make static. Add new argument MARK_LABELS_ONLY. Quit after mark_all_labels if requested. (jump_optimize, rebuild_jump_labels): New wrapper functions for jump_optimize_1. * toplev.c (rest_of_compilation): Use rebuild_jump_labels instead of running the entire jump optimizer. From-SVN: r26327
This commit is contained in:
parent
5d90cd8ff3
commit
c44033714b
@ -14,6 +14,15 @@
|
||||
|
||||
Sat Apr 10 03:50:12 1999 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* rtl.h (rebuild_jump_labels): Declare.
|
||||
* jump.c (jump_optimize_1): Renamed from jump_optimize. Make static.
|
||||
Add new argument MARK_LABELS_ONLY. Quit after mark_all_labels if
|
||||
requested.
|
||||
(jump_optimize, rebuild_jump_labels): New wrapper functions for
|
||||
jump_optimize_1.
|
||||
* toplev.c (rest_of_compilation): Use rebuild_jump_labels instead of
|
||||
running the entire jump optimizer.
|
||||
|
||||
* rtl.h (local_alloc): Returns an integer now.
|
||||
* local-alloc.c (recorded_label_ref): New file scoped variable.
|
||||
(local_alloc): Initialize recorded_label_ref to zero. Return its
|
||||
|
35
gcc/jump.c
35
gcc/jump.c
@ -126,9 +126,33 @@ static void delete_from_jump_chain PROTO((rtx));
|
||||
static int delete_labelref_insn PROTO((rtx, rtx, int));
|
||||
static void mark_modified_reg PROTO((rtx, rtx));
|
||||
static void redirect_tablejump PROTO((rtx, rtx));
|
||||
static void jump_optimize_1 PROTO ((rtx, int, int, int, int));
|
||||
#ifndef HAVE_cc0
|
||||
static rtx find_insert_position PROTO((rtx, rtx));
|
||||
#endif
|
||||
|
||||
/* Main external entry point into the jump optimizer. See comments before
|
||||
jump_optimize_1 for descriptions of the arguments. */
|
||||
void
|
||||
jump_optimize (f, cross_jump, noop_moves, after_regscan)
|
||||
rtx f;
|
||||
int cross_jump;
|
||||
int noop_moves;
|
||||
int after_regscan;
|
||||
{
|
||||
jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, 0);
|
||||
}
|
||||
|
||||
/* Alternate entry into the jump optimizer. This entry point only rebuilds
|
||||
the JUMP_LABEL field in jumping insns and REG_LABEL notes in non-jumping
|
||||
instructions. */
|
||||
void
|
||||
rebuild_jump_labels (f)
|
||||
rtx f;
|
||||
{
|
||||
jump_optimize_1 (f, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
/* Delete no-op jumps and optimize jumps to jumps
|
||||
and jumps around jumps.
|
||||
@ -143,6 +167,9 @@ static rtx find_insert_position PROTO((rtx, rtx));
|
||||
If AFTER_REGSCAN is nonzero, then this jump pass is being run immediately
|
||||
after regscan, and it is safe to use regno_first_uid and regno_last_uid.
|
||||
|
||||
If MARK_LABELS_ONLY is nonzero, then we only rebuild the jump chain
|
||||
and JUMP_LABEL field for jumping insns.
|
||||
|
||||
If `optimize' is zero, don't change any code,
|
||||
just determine whether control drops off the end of the function.
|
||||
This case occurs when we have -W and not -O.
|
||||
@ -150,11 +177,12 @@ static rtx find_insert_position PROTO((rtx, rtx));
|
||||
and refrains from actually deleting when that is 0. */
|
||||
|
||||
void
|
||||
jump_optimize (f, cross_jump, noop_moves, after_regscan)
|
||||
jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
|
||||
rtx f;
|
||||
int cross_jump;
|
||||
int noop_moves;
|
||||
int after_regscan;
|
||||
int mark_labels_only;
|
||||
{
|
||||
register rtx insn, next;
|
||||
int changed;
|
||||
@ -182,6 +210,11 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
|
||||
|
||||
mark_all_labels (f, cross_jump);
|
||||
|
||||
/* Quit now if we just wanted to rebuild the JUMP_LABEL and REG_LABEL
|
||||
notes. */
|
||||
if (mark_labels_only)
|
||||
return;
|
||||
|
||||
/* Keep track of labels used from static data;
|
||||
they cannot ever be deleted. */
|
||||
|
||||
|
@ -1354,6 +1354,7 @@ extern int rtx_renumbered_equal_p PROTO ((rtx, rtx));
|
||||
extern int true_regnum PROTO ((rtx));
|
||||
extern int redirect_jump PROTO ((rtx, rtx));
|
||||
extern void jump_optimize PROTO ((rtx, int, int, int));
|
||||
extern void rebuild_jump_labels PROTO ((rtx));
|
||||
extern void thread_jumps PROTO ((rtx, int, int));
|
||||
extern int redirect_exp PROTO ((rtx *, rtx, rtx, rtx));
|
||||
extern int rtx_equal_for_thread_p PROTO ((rtx, rtx, rtx));
|
||||
|
22
gcc/toplev.c
22
gcc/toplev.c
@ -3526,7 +3526,7 @@ rest_of_compilation (decl)
|
||||
/* Likewise, for DECL_ARGUMENTS. */
|
||||
tree saved_arguments = 0;
|
||||
int failure = 0;
|
||||
int run_jump_after_reload;
|
||||
int rebuild_label_notes_after_reload;
|
||||
|
||||
/* If we are reconsidering an inline function
|
||||
at the end of compilation, skip the stuff for making it inline. */
|
||||
@ -4074,10 +4074,10 @@ rest_of_compilation (decl)
|
||||
{
|
||||
recompute_reg_usage (insns, ! optimize_size);
|
||||
regclass (insns, max_reg_num ());
|
||||
run_jump_after_reload = local_alloc ();
|
||||
rebuild_label_notes_after_reload = local_alloc ();
|
||||
});
|
||||
else
|
||||
run_jump_after_reload = 0;
|
||||
rebuild_label_notes_after_reload = 0;
|
||||
|
||||
/* Dump rtl code after allocating regs within basic blocks. */
|
||||
|
||||
@ -4112,20 +4112,16 @@ rest_of_compilation (decl)
|
||||
if (failure)
|
||||
goto exit_rest_of_compilation;
|
||||
|
||||
/* Register allocation and reloading may have turned an indirect jump into
|
||||
a direct jump. If so, we must rerun the jump optimizer to ensure that
|
||||
the JUMP_LABEL of any jump changed by that transformation is valid.
|
||||
|
||||
We do this before reload_cse_regs since it may allow reload_cse to do
|
||||
a better job. */
|
||||
if (run_jump_after_reload)
|
||||
TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
|
||||
!JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN));
|
||||
|
||||
/* Do a very simple CSE pass over just the hard registers. */
|
||||
if (optimize > 0)
|
||||
reload_cse_regs (insns);
|
||||
|
||||
/* Register allocation and reloading may have turned an indirect jump into
|
||||
a direct jump. If so, we must rebuild the JUMP_LABEL fields of
|
||||
jumping instructions. */
|
||||
if (rebuild_label_notes_after_reload)
|
||||
TIMEVAR (jump_time, rebuild_jump_labels (insns));
|
||||
|
||||
/* If optimizing and we are performing instruction scheduling after
|
||||
reload, then go ahead and split insns now since we are about to
|
||||
recompute flow information anyway.
|
||||
|
Loading…
Reference in New Issue
Block a user