Commit e218fc41 by Richard Henderson Committed by Richard Henderson

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
parent 163537f7
Wed Oct 27 15:21:46 1999 Richard Henderson <rth@cygnus.com>
* 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 <mark@codesourcery.com> Wed Oct 27 12:33:40 1999 Mark Mitchell <mark@codesourcery.com>
* rtl.h (note_stores): Add additional paramter. * rtl.h (note_stores): Add additional paramter.
......
...@@ -66,6 +66,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -66,6 +66,8 @@ Boston, MA 02111-1307, USA. */
#include "expr.h" #include "expr.h"
#include "real.h" #include "real.h"
#include "except.h" #include "except.h"
#include "basic-block.h"
#include "output.h"
#include "toplev.h" #include "toplev.h"
/* ??? Eventually must record somehow the labels used by jumps /* ??? 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) ...@@ -190,6 +192,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
int first = 1; int first = 1;
int max_uid = 0; int max_uid = 0;
rtx last_insn; rtx last_insn;
int did_cross_jump = 0;
cross_jump_death_matters = (cross_jump == 2); cross_jump_death_matters = (cross_jump == 2);
max_uid = init_label_info (f) + 1; max_uid = init_label_info (f) + 1;
...@@ -2127,6 +2130,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) ...@@ -2127,6 +2130,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
if (newjpos != 0) if (newjpos != 0)
{ {
did_cross_jump = 1;
do_cross_jump (insn, newjpos, newlpos); do_cross_jump (insn, newjpos, newlpos);
/* Make the old conditional jump /* Make the old conditional jump
into an unconditional one. */ into an unconditional one. */
...@@ -2179,6 +2183,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) ...@@ -2179,6 +2183,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
if (newjpos != 0) if (newjpos != 0)
{ {
did_cross_jump = 1;
do_cross_jump (insn, newjpos, newlpos); do_cross_jump (insn, newjpos, newlpos);
changed = 1; changed = 1;
next = insn; next = insn;
...@@ -2210,6 +2215,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) ...@@ -2210,6 +2215,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
if (newjpos != 0) if (newjpos != 0)
{ {
did_cross_jump = 1;
do_cross_jump (insn, newjpos, newlpos); do_cross_jump (insn, newjpos, newlpos);
changed = 1; changed = 1;
next = insn; next = insn;
...@@ -2274,6 +2280,23 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) ...@@ -2274,6 +2280,23 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
/* Show JUMP_CHAIN no longer valid. */ /* Show JUMP_CHAIN no longer valid. */
jump_chain = 0; 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 /* Initialize LABEL_NUSES and JUMP_LABEL fields. Delete any REG_LABEL
......
...@@ -406,8 +406,7 @@ pop_stack (regstack, regno) ...@@ -406,8 +406,7 @@ pop_stack (regstack, regno)
register file. FIRST is the first insn in the function, FILE is the register file. FIRST is the first insn in the function, FILE is the
dump file, if used. dump file, if used.
Construct a CFG and run life analysis. (When optimizing, the data Construct a CFG and run life analysis. Then convert each insn one
was corruped by jump2's cross-jumping.) Then convert each insn one
by one. Run a last jump_optimize pass, if optimizing, to eliminate by one. Run a last jump_optimize pass, if optimizing, to eliminate
code duplication created when the converter inserts pop insns on code duplication created when the converter inserts pop insns on
the edges. */ the edges. */
...@@ -430,16 +429,19 @@ reg_to_stack (first, file) ...@@ -430,16 +429,19 @@ reg_to_stack (first, file)
if (i > LAST_STACK_REG) if (i > LAST_STACK_REG)
return; return;
/* Ok, floating point instructions exist. Rebuild the CFG and run /* Ok, floating point instructions exist. If not optimizing,
life analysis. */ build the CFG and run life analysis. */
find_basic_blocks (first, max_reg_num (), file, 0); if (! optimize)
{
find_basic_blocks (first, max_reg_num (), file, 0);
blocks = sbitmap_alloc (n_basic_blocks); blocks = sbitmap_alloc (n_basic_blocks);
sbitmap_ones (blocks); sbitmap_ones (blocks);
count_or_remove_death_notes (blocks, 1); count_or_remove_death_notes (blocks, 1);
sbitmap_free (blocks); 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. */ /* Set up block info for each basic block. */
bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi)); bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi));
...@@ -488,9 +490,6 @@ reg_to_stack (first, file) ...@@ -488,9 +490,6 @@ reg_to_stack (first, file)
{ {
jump_optimize (first, JUMP_CROSS_JUMP_DEATH_MATTERS, jump_optimize (first, JUMP_CROSS_JUMP_DEATH_MATTERS,
!JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN); !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); VARRAY_FREE (stack_regs_mentioned_data);
......
...@@ -4333,12 +4333,6 @@ rest_of_compilation (decl) ...@@ -4333,12 +4333,6 @@ rest_of_compilation (decl)
ggc_collect (); ggc_collect ();
#endif #endif
/* Shorten branches. */
TIMEVAR (shorten_branch_time,
{
shorten_branches (get_insns ());
});
#ifdef STACK_REGS #ifdef STACK_REGS
if (stack_reg_dump) if (stack_reg_dump)
open_dump_file (".20.stack", decl_printable_name (decl, 2)); open_dump_file (".20.stack", decl_printable_name (decl, 2));
...@@ -4356,6 +4350,12 @@ rest_of_compilation (decl) ...@@ -4356,6 +4350,12 @@ rest_of_compilation (decl)
ggc_collect (); ggc_collect ();
#endif #endif
/* Shorten branches. */
TIMEVAR (shorten_branch_time,
{
shorten_branches (get_insns ());
});
/* Now turn the rtl into assembler code. */ /* Now turn the rtl into assembler code. */
TIMEVAR (final_time, TIMEVAR (final_time,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment