summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-06 20:25:41 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-06 20:25:41 +0000
commitb275aaceba2bdd2a64d55a28fd508515925a6b44 (patch)
tree95bb033a85e24116b3efc6a96f5f1fa804c19191 /gcc
parentce5843dafa61e2d05038901f104f32961e6e5172 (diff)
downloadgcc-b275aaceba2bdd2a64d55a28fd508515925a6b44.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31259 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/flow.c23
-rw-r--r--gcc/local-alloc.c2
-rw-r--r--gcc/regclass.c8
4 files changed, 26 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc4b4939922..ac90acd3443 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+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
diff --git a/gcc/flow.c b/gcc/flow.c
index 6d0ce0b1ce6..ae8ec5a1cf2 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -4028,7 +4028,7 @@ mark_set_1 (needed, dead, x, insn, significant, flags)
/* 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
@@ -4281,7 +4281,7 @@ find_auto_inc (needed, x, 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. */
@@ -4502,7 +4502,7 @@ mark_used_regs (needed, live, x, flags, insn)
/* 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)
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;
@@ -5372,8 +5372,7 @@ count_reg_sets_1 (x)
/* 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;
}
}
}
@@ -5452,7 +5451,7 @@ count_reg_references (x)
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:
@@ -5551,9 +5550,10 @@ count_reg_references (x)
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. */
@@ -5577,7 +5577,6 @@ recompute_reg_usage (f, loop_step)
/* 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);
@@ -6819,7 +6818,7 @@ static int
flow_loops_level_compute (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)
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;
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index 171b13aa822..70e1ecc1062 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -679,7 +679,7 @@ update_equiv_regs ()
init_alias_analysis ();
- loop_depth = 1;
+ loop_depth = 0;
/* Scan the insns and find which registers have equivalences. Do this
in a separate scan of the insns because (due to -fcse-follow-jumps)
diff --git a/gcc/regclass.c b/gcc/regclass.c
index 1a45b244dc3..06c2badfd23 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -1100,13 +1100,13 @@ regclass (f, nregs, dump)
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);