summaryrefslogtreecommitdiff
path: root/gcc/regclass.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>1999-12-16 10:35:14 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>1999-12-16 10:35:14 +0000
commit2bcb1627e593bd981f7edeea604cfa86b00137ae (patch)
tree86636ce3b4bf44a7d8367b093dcab0e21f08c8a6 /gcc/regclass.c
parent077ac7c87d23d18d19ed2ea57488331d5fc7a8c5 (diff)
downloadgcc-2bcb1627e593bd981f7edeea604cfa86b00137ae.tar.gz
* regclass.c (loop_depth): Remove
(scan_one_insn): Do not handle LOOP_NOTE insns. (regclass): Go through basic blocks and set loop_cost git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30976 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/regclass.c')
-rw-r--r--gcc/regclass.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/gcc/regclass.c b/gcc/regclass.c
index ea131c0a8d3..3c28580496c 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -716,10 +716,6 @@ static struct reg_pref *reg_pref;
static struct reg_pref *reg_pref_buffer;
-/* Record the depth of loops that we are in. */
-
-static int loop_depth;
-
/* Account for the fact that insns within a loop are executed very commonly,
but don't keep doing this as loops go too deep. */
@@ -821,26 +817,6 @@ scan_one_insn (insn, pass)
rtx set, note;
int i, j;
- /* 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. */
-
- if (code == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- loop_depth--;
-
- if (optimize_size)
- loop_cost = 1;
- else
- loop_cost = 1 << (2 * MIN (loop_depth, 5));
-
- return insn;
- }
-
if (GET_RTX_CLASS (code) != 'i')
return insn;
@@ -1085,6 +1061,7 @@ regclass (f, nregs, dump)
for (pass = 0; pass <= flag_expensive_optimizations; pass++)
{
+ int index;
/* Zero out our accumulation of the cost of each class for each reg. */
bzero ((char *) costs, nregs * sizeof (struct costs));
@@ -1093,14 +1070,29 @@ regclass (f, nregs, dump)
bzero (in_inc_dec, nregs);
#endif
- loop_depth = 0, loop_cost = 1;
+ loop_cost = 1;
/* Scan the instructions and record each time it would
save code to put a certain register in a certain class. */
- for (insn = f; insn; insn = NEXT_INSN (insn))
+ for (index = 0; index < n_basic_blocks; index++)
{
- insn = scan_one_insn (insn, pass);
+ 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. */
+ if (optimize_size)
+ loop_cost = 1;
+ else
+ loop_cost = 1 << (2 * MIN (bb->loop_depth - 1, 5));
+ for (insn = bb->head; ; insn = NEXT_INSN (insn))
+ {
+ insn = scan_one_insn (insn, pass);
+ if (insn == bb->end)
+ break;
+ }
}
/* Now for each register look at how desirable each class is