+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>
* defaults.h (DWARF_FRAME_REGISTERS): if not defined, default to
/* Count (weighted) references, stores, etc. This counts a
register twice if it is modified, but that is correct. */
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
elsewhere, but we want the count to include the insn
/* Count an extra reference to the reg. When a reg is
incremented, spilling it is worse, so we want to make
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,
even though it isn't a SET in rtl. */
/* Count (weighted) number of uses of each reg. */
- REG_N_REFS (regno) += loop_depth;
+ REG_N_REFS (regno) += loop_depth + 1;
}
}
less likely. */
if (regno >= FIRST_PSEUDO_REGISTER)
{
- REG_N_REFS (regno) += loop_depth;
+ REG_N_REFS (regno) += loop_depth + 1;
REG_N_SETS (regno)++;
}
return 1;
/* Count (weighted) references, stores, etc. This counts a
register twice if it is modified, but that is correct. */
REG_N_SETS (regno)++;
-
- REG_N_REFS (regno) += loop_depth;
+ REG_N_REFS (regno) += loop_depth + 1;
}
}
}
case REG:
if (REGNO (x) >= FIRST_PSEUDO_REGISTER)
- REG_N_REFS (REGNO (x)) += loop_depth;
+ REG_N_REFS (REGNO (x)) += loop_depth + 1;
return;
case SET:
More accurate reference counts generally lead to better register allocation.
F is the first insn to be scanned.
+
LOOP_STEP denotes how much loop_depth should be incremented per
- loop nesting level in order to increase the ref count more for references
- in a loop.
+ loop nesting level in order to increase the ref count more for
+ references in a loop.
It might be worthwhile to update REG_LIVE_LENGTH, REG_BASIC_BLOCK and
possibly other information which is used by the register allocators. */
/* Scan each insn in the chain and count how many times each register is
set/used. */
- loop_depth = 1;
for (index = 0; index < n_basic_blocks; index++)
{
basic_block bb = BASIC_BLOCK (index);
flow_loops_level_compute (loops)
struct loops *loops;
{
- return flow_loop_level_compute (loops->tree, 0);
+ return flow_loop_level_compute (loops->tree, 1);
}
num_loops = 0;
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)
{
basic_block latch = e->src;
basic_block bb = BASIC_BLOCK (index);
/* 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
- than the assumptions made elsewhere and is being tried as an
- experiment. */
+ times more than insns outside a loop. This is much more
+ aggressive than the assumptions made elsewhere and is being
+ tried as an experiment. */
if (optimize_size)
loop_cost = 1;
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))
{
insn = scan_one_insn (insn, pass);