From: Richard Henderson Date: Wed, 27 Oct 1999 22:22:34 +0000 (-0700) Subject: jump.c (jump_optimize_1): If we did cross-jumping, and the data will matter, rebuild... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e218fc41a887ae8f97649ad0ac79400654458f33;p=gcc.git jump.c (jump_optimize_1): If we did cross-jumping, and the data will matter, rebuild the CFG. * jump.c (jump_optimize_1): If we did cross-jumping, and the data will matter, rebuild the CFG. * reg-stack.c (reg_to_stack): Only (re)build the CFG if not optimizing. Don't run shorten_branches. * toplev.c (rest_of_compilation): Run shorten_branches after reg_to_stack. From-SVN: r30223 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3cb9de62a4..fc5d4664409 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +Wed Oct 27 15:21:46 1999 Richard Henderson + + * jump.c (jump_optimize_1): If we did cross-jumping, and + the data will matter, rebuild the CFG. + * reg-stack.c (reg_to_stack): Only (re)build the CFG if + not optimizing. Don't run shorten_branches. + * toplev.c (rest_of_compilation): Run shorten_branches after + reg_to_stack. + Wed Oct 27 12:33:40 1999 Mark Mitchell * rtl.h (note_stores): Add additional paramter. diff --git a/gcc/jump.c b/gcc/jump.c index 72a13589af0..8170930780b 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -66,6 +66,8 @@ Boston, MA 02111-1307, USA. */ #include "expr.h" #include "real.h" #include "except.h" +#include "basic-block.h" +#include "output.h" #include "toplev.h" /* ??? Eventually must record somehow the labels used by jumps @@ -190,6 +192,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) int first = 1; int max_uid = 0; rtx last_insn; + int did_cross_jump = 0; cross_jump_death_matters = (cross_jump == 2); max_uid = init_label_info (f) + 1; @@ -2127,6 +2130,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) if (newjpos != 0) { + did_cross_jump = 1; do_cross_jump (insn, newjpos, newlpos); /* Make the old conditional jump into an unconditional one. */ @@ -2179,6 +2183,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) if (newjpos != 0) { + did_cross_jump = 1; do_cross_jump (insn, newjpos, newlpos); changed = 1; next = insn; @@ -2210,6 +2215,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) if (newjpos != 0) { + did_cross_jump = 1; do_cross_jump (insn, newjpos, newlpos); changed = 1; next = insn; @@ -2274,6 +2280,23 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) /* Show JUMP_CHAIN no longer valid. */ jump_chain = 0; + +#if defined(DELAY_SLOTS) || defined(STACK_REGS) + /* ??? Keep the CFG up to date after cross-jumping. */ + if (did_cross_jump && !cross_jump_death_matters) + { + sbitmap blocks; + + find_basic_blocks (f, old_max_reg, NULL, 0); + + blocks = sbitmap_alloc (n_basic_blocks); + sbitmap_ones (blocks); + count_or_remove_death_notes (blocks, 1); + sbitmap_free (blocks); + + life_analysis (f, old_max_reg, NULL, 0); + } +#endif } /* Initialize LABEL_NUSES and JUMP_LABEL fields. Delete any REG_LABEL diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 50e55c1147d..7ab8184a3a3 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -406,8 +406,7 @@ pop_stack (regstack, regno) register file. FIRST is the first insn in the function, FILE is the dump file, if used. - Construct a CFG and run life analysis. (When optimizing, the data - was corruped by jump2's cross-jumping.) Then convert each insn one + Construct a CFG and run life analysis. Then convert each insn one by one. Run a last jump_optimize pass, if optimizing, to eliminate code duplication created when the converter inserts pop insns on the edges. */ @@ -430,16 +429,19 @@ reg_to_stack (first, file) if (i > LAST_STACK_REG) return; - /* Ok, floating point instructions exist. Rebuild the CFG and run - life analysis. */ - find_basic_blocks (first, max_reg_num (), file, 0); + /* Ok, floating point instructions exist. If not optimizing, + build the CFG and run life analysis. */ + if (! optimize) + { + find_basic_blocks (first, max_reg_num (), file, 0); - blocks = sbitmap_alloc (n_basic_blocks); - sbitmap_ones (blocks); - count_or_remove_death_notes (blocks, 1); - sbitmap_free (blocks); + blocks = sbitmap_alloc (n_basic_blocks); + sbitmap_ones (blocks); + count_or_remove_death_notes (blocks, 1); + sbitmap_free (blocks); - life_analysis (first, max_reg_num (), file, 0); + life_analysis (first, max_reg_num (), file, 0); + } /* Set up block info for each basic block. */ bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi)); @@ -488,9 +490,6 @@ reg_to_stack (first, file) { jump_optimize (first, JUMP_CROSS_JUMP_DEATH_MATTERS, !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN); - - /* This has the effect of resetting label alignments around loops. */ - shorten_branches (get_insns ()); } VARRAY_FREE (stack_regs_mentioned_data); diff --git a/gcc/toplev.c b/gcc/toplev.c index 35f88d062f7..1933b41b41b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4333,12 +4333,6 @@ rest_of_compilation (decl) ggc_collect (); #endif - /* Shorten branches. */ - TIMEVAR (shorten_branch_time, - { - shorten_branches (get_insns ()); - }); - #ifdef STACK_REGS if (stack_reg_dump) open_dump_file (".20.stack", decl_printable_name (decl, 2)); @@ -4356,6 +4350,12 @@ rest_of_compilation (decl) ggc_collect (); #endif + /* Shorten branches. */ + TIMEVAR (shorten_branch_time, + { + shorten_branches (get_insns ()); + }); + /* Now turn the rtl into assembler code. */ TIMEVAR (final_time,