diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-04-10 04:17:51 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-04-10 04:17:51 +0000 |
commit | 8b946ced9738265f13ca0cfc8dbafb23aaea947f (patch) | |
tree | 4637eb0e6a1825b933e72073aa6abf834c06e231 | |
parent | 7f63dd0caa119a69c05def59c95e0e71bfe18a51 (diff) | |
download | gcc-8b946ced9738265f13ca0cfc8dbafb23aaea947f.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26327 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/jump.c | 35 | ||||
-rw-r--r-- | gcc/rtl.h | 1 | ||||
-rw-r--r-- | gcc/toplev.c | 22 |
4 files changed, 53 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6acde6141fa..fd8f5d7a3e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/jump.c b/gcc/jump.c index 4ffeeff3f21..9a031937dd2 100644 --- a/gcc/jump.c +++ b/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. */ diff --git a/gcc/rtl.h b/gcc/rtl.h index eee7473cd33..9fb8c4ac30a 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -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)); diff --git a/gcc/toplev.c b/gcc/toplev.c index 3847c5dcd7b..28292843508 100644 --- a/gcc/toplev.c +++ b/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. |