Commit 9b15c17f by Richard Henderson Committed by Richard Henderson

flow.c (mark_set_1): Use loop_depth+1 as reference weight.

        * flow.c (mark_set_1): Use loop_depth+1 as reference weight.
        (find_auto_inc, mark_used_regs, try_pre_increment_1): Likewise.
        (count_reg_sets_1, count_reg_references): Likewise.
        (flow_loops_level_compute): Start counting actual loop depth at 1.
        (flow_loops_find): Likewise.
        * local-alloc.c (update_equiv_regs): Likewise.
        * regclass.c (regclass): Re-instate Jan 4 0-based loop_depth change.

From-SVN: r31259
parent 55ff3de7
2000-01-06 Richard Henderson <rth@cygnus.com>
* flow.c (mark_set_1): Use loop_depth+1 as reference weight.
(find_auto_inc, mark_used_regs, try_pre_increment_1): Likewise.
(count_reg_sets_1, count_reg_references): Likewise.
(flow_loops_level_compute): Start counting actual loop depth at 1.
(flow_loops_find): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* regclass.c (regclass): Re-instate Jan 4 0-based loop_depth change.
2000-01-06 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr> 2000-01-06 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
* defaults.h (DWARF_FRAME_REGISTERS): if not defined, default to * defaults.h (DWARF_FRAME_REGISTERS): if not defined, default to
......
...@@ -4028,7 +4028,7 @@ mark_set_1 (needed, dead, x, insn, significant, flags) ...@@ -4028,7 +4028,7 @@ mark_set_1 (needed, dead, x, insn, significant, flags)
/* Count (weighted) references, stores, etc. This counts a /* Count (weighted) references, stores, etc. This counts a
register twice if it is modified, but that is correct. */ register twice if it is modified, but that is correct. */
REG_N_SETS (regno)++; REG_N_SETS (regno)++;
REG_N_REFS (regno) += loop_depth; REG_N_REFS (regno) += loop_depth + 1;
/* The insns where a reg is live are normally counted /* The insns where a reg is live are normally counted
elsewhere, but we want the count to include the insn elsewhere, but we want the count to include the insn
...@@ -4281,7 +4281,7 @@ find_auto_inc (needed, x, insn) ...@@ -4281,7 +4281,7 @@ find_auto_inc (needed, x, insn)
/* Count an extra reference to the reg. When a reg is /* Count an extra reference to the reg. When a reg is
incremented, spilling it is worse, so we want to make incremented, spilling it is worse, so we want to make
that less likely. */ that less likely. */
REG_N_REFS (regno) += loop_depth; REG_N_REFS (regno) += loop_depth + 1;
/* Count the increment as a setting of the register, /* Count the increment as a setting of the register,
even though it isn't a SET in rtl. */ even though it isn't a SET in rtl. */
...@@ -4502,7 +4502,7 @@ mark_used_regs (needed, live, x, flags, insn) ...@@ -4502,7 +4502,7 @@ mark_used_regs (needed, live, x, flags, insn)
/* Count (weighted) number of uses of each reg. */ /* Count (weighted) number of uses of each reg. */
REG_N_REFS (regno) += loop_depth; REG_N_REFS (regno) += loop_depth + 1;
} }
} }
...@@ -4745,7 +4745,7 @@ try_pre_increment_1 (insn) ...@@ -4745,7 +4745,7 @@ try_pre_increment_1 (insn)
less likely. */ less likely. */
if (regno >= FIRST_PSEUDO_REGISTER) if (regno >= FIRST_PSEUDO_REGISTER)
{ {
REG_N_REFS (regno) += loop_depth; REG_N_REFS (regno) += loop_depth + 1;
REG_N_SETS (regno)++; REG_N_SETS (regno)++;
} }
return 1; return 1;
...@@ -5372,8 +5372,7 @@ count_reg_sets_1 (x) ...@@ -5372,8 +5372,7 @@ count_reg_sets_1 (x)
/* Count (weighted) references, stores, etc. This counts a /* Count (weighted) references, stores, etc. This counts a
register twice if it is modified, but that is correct. */ register twice if it is modified, but that is correct. */
REG_N_SETS (regno)++; REG_N_SETS (regno)++;
REG_N_REFS (regno) += loop_depth + 1;
REG_N_REFS (regno) += loop_depth;
} }
} }
} }
...@@ -5452,7 +5451,7 @@ count_reg_references (x) ...@@ -5452,7 +5451,7 @@ count_reg_references (x)
case REG: case REG:
if (REGNO (x) >= FIRST_PSEUDO_REGISTER) if (REGNO (x) >= FIRST_PSEUDO_REGISTER)
REG_N_REFS (REGNO (x)) += loop_depth; REG_N_REFS (REGNO (x)) += loop_depth + 1;
return; return;
case SET: case SET:
...@@ -5551,9 +5550,10 @@ count_reg_references (x) ...@@ -5551,9 +5550,10 @@ count_reg_references (x)
More accurate reference counts generally lead to better register allocation. More accurate reference counts generally lead to better register allocation.
F is the first insn to be scanned. F is the first insn to be scanned.
LOOP_STEP denotes how much loop_depth should be incremented per LOOP_STEP denotes how much loop_depth should be incremented per
loop nesting level in order to increase the ref count more for references loop nesting level in order to increase the ref count more for
in a loop. references in a loop.
It might be worthwhile to update REG_LIVE_LENGTH, REG_BASIC_BLOCK and It might be worthwhile to update REG_LIVE_LENGTH, REG_BASIC_BLOCK and
possibly other information which is used by the register allocators. */ possibly other information which is used by the register allocators. */
...@@ -5577,7 +5577,6 @@ recompute_reg_usage (f, loop_step) ...@@ -5577,7 +5577,6 @@ recompute_reg_usage (f, loop_step)
/* Scan each insn in the chain and count how many times each register is /* Scan each insn in the chain and count how many times each register is
set/used. */ set/used. */
loop_depth = 1;
for (index = 0; index < n_basic_blocks; index++) for (index = 0; index < n_basic_blocks; index++)
{ {
basic_block bb = BASIC_BLOCK (index); basic_block bb = BASIC_BLOCK (index);
...@@ -6819,7 +6818,7 @@ static int ...@@ -6819,7 +6818,7 @@ static int
flow_loops_level_compute (loops) flow_loops_level_compute (loops)
struct loops *loops; struct loops *loops;
{ {
return flow_loop_level_compute (loops->tree, 0); return flow_loop_level_compute (loops->tree, 1);
} }
...@@ -6862,7 +6861,7 @@ flow_loops_find (loops) ...@@ -6862,7 +6861,7 @@ flow_loops_find (loops)
num_loops = 0; num_loops = 0;
for (b = 0; b < n_basic_blocks; b++) for (b = 0; b < n_basic_blocks; b++)
{ {
BASIC_BLOCK (b)->loop_depth = 1; BASIC_BLOCK (b)->loop_depth = 0;
for (e = BASIC_BLOCK (b)->pred; e; e = e->pred_next) for (e = BASIC_BLOCK (b)->pred; e; e = e->pred_next)
{ {
basic_block latch = e->src; basic_block latch = e->src;
......
...@@ -679,7 +679,7 @@ update_equiv_regs () ...@@ -679,7 +679,7 @@ update_equiv_regs ()
init_alias_analysis (); init_alias_analysis ();
loop_depth = 1; loop_depth = 0;
/* Scan the insns and find which registers have equivalences. Do this /* Scan the insns and find which registers have equivalences. Do this
in a separate scan of the insns because (due to -fcse-follow-jumps) in a separate scan of the insns because (due to -fcse-follow-jumps)
......
...@@ -1100,13 +1100,13 @@ regclass (f, nregs, dump) ...@@ -1100,13 +1100,13 @@ regclass (f, nregs, dump)
basic_block bb = BASIC_BLOCK (index); basic_block bb = BASIC_BLOCK (index);
/* Show that an insn inside a loop is likely to be executed three /* Show that an insn inside a loop is likely to be executed three
times more than insns outside a loop. This is much more aggressive times more than insns outside a loop. This is much more
than the assumptions made elsewhere and is being tried as an aggressive than the assumptions made elsewhere and is being
experiment. */ tried as an experiment. */
if (optimize_size) if (optimize_size)
loop_cost = 1; loop_cost = 1;
else else
loop_cost = 1 << (2 * MIN (bb->loop_depth - 1, 5)); loop_cost = 1 << (2 * MIN (bb->loop_depth, 5));
for (insn = bb->head; ; insn = NEXT_INSN (insn)) for (insn = bb->head; ; insn = NEXT_INSN (insn))
{ {
insn = scan_one_insn (insn, pass); insn = scan_one_insn (insn, pass);
......
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