Commit 6836e024 by Jan Hubicka Committed by Jan Hubicka

regclass.c (init_reg_sets_1): Reinstall the optimization of move_cost together…

regclass.c (init_reg_sets_1): Reinstall the optimization of move_cost together with Matt Kraai's fix.


	* regclass.c (init_reg_sets_1): Reinstall the optimization of
	move_cost together with Matt Kraai's fix.

From-SVN: r39688
parent d3fb92b8
Wed Feb 14 10:08:26 CET 2001 Jan Hubicka <jh@suse.cz>
* regclass.c (init_reg_sets_1): Reinstall the optimization of
move_cost together with Matt Kraai's fix.
2001-02-14 Jeffrey Oldham <oldham@codesourcery.com> 2001-02-14 Jeffrey Oldham <oldham@codesourcery.com>
* Makefile.in (OBJS): Add params.o. * Makefile.in (OBJS): Add params.o.
......
...@@ -288,6 +288,8 @@ init_reg_sets_1 () ...@@ -288,6 +288,8 @@ init_reg_sets_1 ()
{ {
register unsigned int i, j; register unsigned int i, j;
register unsigned int /* enum machine_mode */ m; register unsigned int /* enum machine_mode */ m;
char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
char allocatable_regs_of_mode [MAX_MACHINE_MODE];
/* This macro allows the fixed or call-used registers /* This macro allows the fixed or call-used registers
and the register classes to depend on target flags. */ and the register classes to depend on target flags. */
...@@ -423,44 +425,75 @@ init_reg_sets_1 () ...@@ -423,44 +425,75 @@ init_reg_sets_1 ()
if (CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (i))) if (CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (i)))
SET_HARD_REG_BIT (losing_caller_save_reg_set, i); SET_HARD_REG_BIT (losing_caller_save_reg_set, i);
} }
memset (contains_reg_of_mode, 0, sizeof (contains_reg_of_mode));
memset (allocatable_regs_of_mode, 0, sizeof (allocatable_regs_of_mode));
for (m = 0; m < MAX_MACHINE_MODE; m++)
for (i = 0; i < N_REG_CLASSES; i++)
for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
if (!fixed_regs [j] && TEST_HARD_REG_BIT (reg_class_contents[i], j)
&& HARD_REGNO_MODE_OK (j, m))
{
contains_reg_of_mode [i][m] = 1;
allocatable_regs_of_mode [m] = 1;
break;
}
/* Initialize the move cost table. Find every subset of each class /* Initialize the move cost table. Find every subset of each class
and take the maximum cost of moving any subset to any other. */ and take the maximum cost of moving any subset to any other. */
for (m = 0; m < MAX_MACHINE_MODE; m++) for (m = 0; m < MAX_MACHINE_MODE; m++)
for (i = 0; i < N_REG_CLASSES; i++) if (allocatable_regs_of_mode [m])
for (j = 0; j < N_REG_CLASSES; j++) {
{ for (i = 0; i < N_REG_CLASSES; i++)
int cost = i == j ? 2 : REGISTER_MOVE_COST (m, i, j); if (contains_reg_of_mode [i][m])
enum reg_class *p1, *p2; for (j = 0; j < N_REG_CLASSES; j++)
{
for (p2 = &reg_class_subclasses[j][0]; *p2 != LIM_REG_CLASSES; p2++) int cost;
if (*p2 != i) enum reg_class *p1, *p2;
cost = MAX (cost, REGISTER_MOVE_COST (m, i, *p2));
if (!contains_reg_of_mode [j][m])
for (p1 = &reg_class_subclasses[i][0]; *p1 != LIM_REG_CLASSES; p1++) {
{ move_cost[m][i][j] = 65536;
if (*p1 != j) may_move_in_cost[m][i][j] = 65536;
cost = MAX (cost, REGISTER_MOVE_COST (m, *p1, j)); may_move_out_cost[m][i][j] = 65536;
}
for (p2 = &reg_class_subclasses[j][0]; else
*p2 != LIM_REG_CLASSES; p2++) {
if (*p1 != *p2) cost = i == j ? 2 : REGISTER_MOVE_COST (m, i, j);
cost = MAX (cost, REGISTER_MOVE_COST (m, *p1, *p2));
} for (p2 = &reg_class_subclasses[j][0];
*p2 != LIM_REG_CLASSES;
move_cost[m][i][j] = cost; p2++)
if (*p2 != i && contains_reg_of_mode [*p2][m])
if (reg_class_subset_p (i, j)) cost = MAX (cost, move_cost [m][i][*p2]);
may_move_in_cost[m][i][j] = 0;
else for (p1 = &reg_class_subclasses[i][0];
may_move_in_cost[m][i][j] = cost; *p1 != LIM_REG_CLASSES;
p1++)
if (reg_class_subset_p (j, i)) if (*p1 != j && contains_reg_of_mode [*p1][m])
may_move_out_cost[m][i][j] = 0; cost = MAX (cost, move_cost [m][*p1][j]);
move_cost[m][i][j] = cost;
if (reg_class_subset_p (i, j))
may_move_in_cost[m][i][j] = 0;
else
may_move_in_cost[m][i][j] = cost;
if (reg_class_subset_p (j, i))
may_move_out_cost[m][i][j] = 0;
else
may_move_out_cost[m][i][j] = cost;
}
}
else else
may_move_out_cost[m][i][j] = cost; for (j = 0; j < N_REG_CLASSES; j++)
} {
move_cost[m][i][j] = 65536;
may_move_in_cost[m][i][j] = 65536;
may_move_out_cost[m][i][j] = 65536;
}
}
#ifdef CLASS_CANNOT_CHANGE_MODE #ifdef CLASS_CANNOT_CHANGE_MODE
{ {
......
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