Commit 49c3bb12 by Richard Henderson Committed by Richard Henderson

basic-block.h (PROP_*): Move constants from ...

        * basic-block.h (PROP_*): Move constants from ...
        * flow.c: ... here.
        (compute_bb_for_insn): Free the array before reallocating.
        (update_life_info): New arg PROP_FLAGS; pass on to propagate_block.
        (allocate_reg_life_data): Reset all reg variables collected by
        propagate_block.
        (get_block_head_tail): Don't convert from bb to block.
        (get_bb_head_tail): New.  Update all callers of get_block_head_tail.
        (find_insn_reg_weight): Take block not bb.
        (schedule_block): Don't set block num for moved insns.
        (schedule_region): Don't update_life_info or find_insn_reg_weight.
        (schedule_insns): Do it here instead.
        * combine.c (combine_instructions): Invoke compute_bb_for_insn
        before update_life_info.
        * recog.c (split_all_insns, peephole2_optimize): Update for
        new arg to update_life_info.
        * rtlanal.c (remove_note): Cope with NULL note.
        * toplev.c (rest_of_compilation): Don't invoke recompute_reg_usage
        if we did sched1.

From-SVN: r30103
parent 5b918807
Wed Oct 20 06:26:58 1999 Richard Henderson <rth@cygnus.com>
* basic-block.h (PROP_*): Move constants from ...
* flow.c: ... here.
(compute_bb_for_insn): Free the array before reallocating.
(update_life_info): New arg PROP_FLAGS; pass on to propagate_block.
(allocate_reg_life_data): Reset all reg variables collected by
propagate_block.
(get_block_head_tail): Don't convert from bb to block.
(get_bb_head_tail): New. Update all callers of get_block_head_tail.
(find_insn_reg_weight): Take block not bb.
(schedule_block): Don't set block num for moved insns.
(schedule_region): Don't update_life_info or find_insn_reg_weight.
(schedule_insns): Do it here instead.
* combine.c (combine_instructions): Invoke compute_bb_for_insn
before update_life_info.
* recog.c (split_all_insns, peephole2_optimize): Update for
new arg to update_life_info.
* rtlanal.c (remove_note): Cope with NULL note.
* toplev.c (rest_of_compilation): Don't invoke recompute_reg_usage
if we did sched1.
Wed Oct 20 10:46:41 1999 Richard Earnshaw (rearnsha@arm.com) Wed Oct 20 10:46:41 1999 Richard Earnshaw (rearnsha@arm.com)
* jump.c (jump_optimize_1): More accurately detect casesi insns. * jump.c (jump_optimize_1): More accurately detect casesi insns.
......
...@@ -300,6 +300,7 @@ extern void compute_dominators PROTO ((sbitmap *, sbitmap *, ...@@ -300,6 +300,7 @@ extern void compute_dominators PROTO ((sbitmap *, sbitmap *,
extern void compute_flow_dominators PROTO ((sbitmap *, sbitmap *)); extern void compute_flow_dominators PROTO ((sbitmap *, sbitmap *));
extern void compute_immediate_dominators PROTO ((int *, sbitmap *)); extern void compute_immediate_dominators PROTO ((int *, sbitmap *));
enum update_life_extent enum update_life_extent
{ {
UPDATE_LIFE_LOCAL = 0, UPDATE_LIFE_LOCAL = 0,
...@@ -307,7 +308,18 @@ enum update_life_extent ...@@ -307,7 +308,18 @@ enum update_life_extent
UPDATE_LIFE_GLOBAL_RM_NOTES = 2, UPDATE_LIFE_GLOBAL_RM_NOTES = 2,
}; };
extern void update_life_info PROTO ((sbitmap, enum update_life_extent)); /* Flags for life_analysis and update_life_info. */
#define PROP_DEATH_NOTES 1 /* Create DEAD and UNUSED notes. */
#define PROP_LOG_LINKS 2 /* Create LOG_LINKS. */
#define PROP_REG_INFO 4 /* Update regs_ever_live et al. */
#define PROP_KILL_DEAD_CODE 8 /* Remove dead code. */
#define PROP_SCAN_DEAD_CODE 16 /* Scan for dead code. */
#define PROP_AUTOINC 32 /* Create autoinc mem references. */
#define PROP_FINAL 63 /* All of the above. */
extern void update_life_info PROTO ((sbitmap, enum update_life_extent,
int));
extern int count_or_remove_death_notes PROTO ((sbitmap, int)); extern int count_or_remove_death_notes PROTO ((sbitmap, int));
/* In lcm.c */ /* In lcm.c */
......
...@@ -696,7 +696,11 @@ combine_instructions (f, nregs) ...@@ -696,7 +696,11 @@ combine_instructions (f, nregs)
} }
if (need_refresh) if (need_refresh)
update_life_info (refresh_blocks, UPDATE_LIFE_GLOBAL_RM_NOTES); {
compute_bb_for_insn (get_max_uid ());
update_life_info (refresh_blocks, UPDATE_LIFE_GLOBAL_RM_NOTES,
PROP_DEATH_NOTES);
}
sbitmap_free (refresh_blocks); sbitmap_free (refresh_blocks);
total_attempts += combine_attempts; total_attempts += combine_attempts;
......
...@@ -371,15 +371,6 @@ static void remove_fake_successors PROTO ((basic_block)); ...@@ -371,15 +371,6 @@ static void remove_fake_successors PROTO ((basic_block));
it being unused. */ it being unused. */
void verify_flow_info PROTO ((void)); void verify_flow_info PROTO ((void));
/* Flags for propagate_block. */
#define PROP_DEATH_NOTES 1 /* Create DEAD and UNUSED notes. */
#define PROP_LOG_LINKS 2 /* Create LOG_LINKS. */
#define PROP_REG_INFO 4 /* Update regs_ever_live et al. */
#define PROP_KILL_DEAD_CODE 8 /* Remove dead code. */
#define PROP_SCAN_DEAD_CODE 16 /* Scan for dead code. */
#define PROP_AUTOINC 32 /* Create autoinc mem references. */
#define PROP_FINAL 63 /* All of the above. */
/* Find basic blocks of the current function. /* Find basic blocks of the current function.
F is the first insn of the function and NREGS the number of register F is the first insn of the function and NREGS the number of register
...@@ -838,6 +829,8 @@ compute_bb_for_insn (max) ...@@ -838,6 +829,8 @@ compute_bb_for_insn (max)
{ {
int i; int i;
if (basic_block_for_insn)
VARRAY_FREE (basic_block_for_insn);
VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn"); VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
for (i = 0; i < n_basic_blocks; ++i) for (i = 0; i < n_basic_blocks; ++i)
...@@ -2567,16 +2560,21 @@ verify_local_live_at_start (new_live_at_start, bb) ...@@ -2567,16 +2560,21 @@ verify_local_live_at_start (new_live_at_start, bb)
If we find registers removed from live_at_start, that means we have If we find registers removed from live_at_start, that means we have
a broken peephole that is killing a register it shouldn't. a broken peephole that is killing a register it shouldn't.
BLOCK_FOR_INSN is assumed to be correct.
??? This is not true in one situation -- when a pre-reload splitter ??? This is not true in one situation -- when a pre-reload splitter
generates subregs of a multi-word pseudo, current life analysis will generates subregs of a multi-word pseudo, current life analysis will
lose the kill. So we _can_ have a pseudo go live. How irritating. */ lose the kill. So we _can_ have a pseudo go live. How irritating.
BLOCK_FOR_INSN is assumed to be correct.
??? PROP_FLAGS should not contain PROP_LOG_LINKS. Need to set up
reg_next_use for that. Including PROP_REG_INFO does not refresh
regs_ever_live unless the caller resets it to zero. */
void void
update_life_info (blocks, extent) update_life_info (blocks, extent, prop_flags)
sbitmap blocks; sbitmap blocks;
enum update_life_extent extent; enum update_life_extent extent;
int prop_flags;
{ {
regset tmp; regset tmp;
int i; int i;
...@@ -2586,7 +2584,8 @@ update_life_info (blocks, extent) ...@@ -2586,7 +2584,8 @@ update_life_info (blocks, extent)
/* For a global update, we go through the relaxation process again. */ /* For a global update, we go through the relaxation process again. */
if (extent != UPDATE_LIFE_LOCAL) if (extent != UPDATE_LIFE_LOCAL)
{ {
calculate_global_regs_live (blocks, blocks, 0); calculate_global_regs_live (blocks, blocks,
prop_flags & PROP_SCAN_DEAD_CODE);
/* If asked, remove notes from the blocks we'll update. */ /* If asked, remove notes from the blocks we'll update. */
if (extent == UPDATE_LIFE_GLOBAL_RM_NOTES) if (extent == UPDATE_LIFE_GLOBAL_RM_NOTES)
...@@ -2599,7 +2598,7 @@ update_life_info (blocks, extent) ...@@ -2599,7 +2598,7 @@ update_life_info (blocks, extent)
COPY_REG_SET (tmp, bb->global_live_at_end); COPY_REG_SET (tmp, bb->global_live_at_end);
propagate_block (tmp, bb->head, bb->end, (regset) NULL, i, propagate_block (tmp, bb->head, bb->end, (regset) NULL, i,
PROP_DEATH_NOTES); prop_flags);
if (extent == UPDATE_LIFE_LOCAL) if (extent == UPDATE_LIFE_LOCAL)
verify_local_live_at_start (tmp, bb); verify_local_live_at_start (tmp, bb);
...@@ -3194,12 +3193,17 @@ allocate_reg_life_data () ...@@ -3194,12 +3193,17 @@ allocate_reg_life_data ()
vector oriented regsets would set regset_{size,bytes} here also. */ vector oriented regsets would set regset_{size,bytes} here also. */
allocate_reg_info (max_regno, FALSE, FALSE); allocate_reg_info (max_regno, FALSE, FALSE);
/* Because both reg_scan and flow_analysis want to set up the REG_N_SETS /* Reset all the data we'll collect in propagate_block and its
information, explicitly reset it here. The allocation should have subroutines. */
already happened on the previous reg_scan pass. Make sure in case
some more registers were allocated. */
for (i = 0; i < max_regno; i++) for (i = 0; i < max_regno; i++)
REG_N_SETS (i) = 0; {
REG_N_SETS (i) = 0;
REG_N_REFS (i) = 0;
REG_N_DEATHS (i) = 0;
REG_N_CALLS_CROSSED (i) = 0;
REG_LIVE_LENGTH (i) = 0;
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
}
} }
/* Compute the registers live at the beginning of a basic block /* Compute the registers live at the beginning of a basic block
......
...@@ -2661,7 +2661,7 @@ split_all_insns (upd_life) ...@@ -2661,7 +2661,7 @@ split_all_insns (upd_life)
{ {
compute_bb_for_insn (get_max_uid ()); compute_bb_for_insn (get_max_uid ());
count_or_remove_death_notes (blocks, 1); count_or_remove_death_notes (blocks, 1);
update_life_info (blocks, UPDATE_LIFE_LOCAL); update_life_info (blocks, UPDATE_LIFE_LOCAL, PROP_DEATH_NOTES);
} }
sbitmap_free (blocks); sbitmap_free (blocks);
...@@ -2762,6 +2762,6 @@ peephole2_optimize (dump_file) ...@@ -2762,6 +2762,6 @@ peephole2_optimize (dump_file)
compute_bb_for_insn (get_max_uid ()); compute_bb_for_insn (get_max_uid ());
count_or_remove_death_notes (blocks, 1); count_or_remove_death_notes (blocks, 1);
update_life_info (blocks, UPDATE_LIFE_LOCAL); update_life_info (blocks, UPDATE_LIFE_LOCAL, PROP_DEATH_NOTES);
} }
#endif #endif
...@@ -1513,11 +1513,14 @@ find_regno_fusage (insn, code, regno) ...@@ -1513,11 +1513,14 @@ find_regno_fusage (insn, code, regno)
void void
remove_note (insn, note) remove_note (insn, note)
register rtx note;
register rtx insn; register rtx insn;
register rtx note;
{ {
register rtx link; register rtx link;
if (note == NULL_RTX)
return;
if (REG_NOTES (insn) == note) if (REG_NOTES (insn) == note)
{ {
REG_NOTES (insn) = XEXP (note, 1); REG_NOTES (insn) = XEXP (note, 1);
......
...@@ -4112,7 +4112,10 @@ rest_of_compilation (decl) ...@@ -4112,7 +4112,10 @@ rest_of_compilation (decl)
if (!obey_regdecls) if (!obey_regdecls)
TIMEVAR (local_alloc_time, TIMEVAR (local_alloc_time,
{ {
recompute_reg_usage (insns, ! optimize_size); /* We recomputed reg usage as part of updating the rest
of life info during sched. */
if (! flag_schedule_insns)
recompute_reg_usage (insns, ! optimize_size);
regclass (insns, max_reg_num ()); regclass (insns, max_reg_num ());
rebuild_label_notes_after_reload = local_alloc (); rebuild_label_notes_after_reload = local_alloc ();
}); });
......
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