ira.c (setup_allocno_and_important_classes): Use ira_class_hard_regs_num to check whether a class has any allocatable registers.

gcc/
	* ira.c (setup_allocno_and_important_classes): Use
	ira_class_hard_regs_num to check whether a class has any
	allocatable registers.
	(ira_init_register_move_cost): Likewise.

From-SVN: r188045
This commit is contained in:
Richard Sandiford 2012-05-31 05:30:07 +00:00 committed by Richard Sandiford
parent ed9e2ed0aa
commit 3e575fe22b
2 changed files with 33 additions and 41 deletions

View File

@ -1,3 +1,10 @@
2012-05-31 Richard Sandiford <rdsandiford@googlemail.com>
* ira.c (setup_allocno_and_important_classes): Use
ira_class_hard_regs_num to check whether a class has any
allocatable registers.
(ira_init_register_move_cost): Likewise.
2012-05-31 Richard Sandiford <rdsandiford@googlemail.com>
* ira.c (init_move_cost): Adjust local variable names to match

View File

@ -970,39 +970,32 @@ setup_allocno_and_important_classes (void)
registers. */
ira_allocno_classes_num = 0;
for (i = 0; (cl = classes[i]) != LIM_REG_CLASSES; i++)
{
COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl]);
AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);
if (hard_reg_set_empty_p (temp_hard_regset))
continue;
if (ira_class_hard_regs_num[cl] > 0)
ira_allocno_classes[ira_allocno_classes_num++] = (enum reg_class) cl;
}
ira_important_classes_num = 0;
/* Add non-allocno classes containing to non-empty set of
allocatable hard regs. */
for (cl = 0; cl < N_REG_CLASSES; cl++)
{
COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl]);
AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);
if (! hard_reg_set_empty_p (temp_hard_regset))
{
set_p = false;
for (j = 0; j < ira_allocno_classes_num; j++)
{
COPY_HARD_REG_SET (temp_hard_regset2,
reg_class_contents[ira_allocno_classes[j]]);
AND_COMPL_HARD_REG_SET (temp_hard_regset2, no_unit_alloc_regs);
if ((enum reg_class) cl == ira_allocno_classes[j])
break;
else if (hard_reg_set_subset_p (temp_hard_regset,
temp_hard_regset2))
set_p = true;
}
if (set_p && j >= ira_allocno_classes_num)
ira_important_classes[ira_important_classes_num++]
= (enum reg_class) cl;
}
}
if (ira_class_hard_regs_num[cl] > 0)
{
COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl]);
AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);
set_p = false;
for (j = 0; j < ira_allocno_classes_num; j++)
{
COPY_HARD_REG_SET (temp_hard_regset2,
reg_class_contents[ira_allocno_classes[j]]);
AND_COMPL_HARD_REG_SET (temp_hard_regset2, no_unit_alloc_regs);
if ((enum reg_class) cl == ira_allocno_classes[j])
break;
else if (hard_reg_set_subset_p (temp_hard_regset,
temp_hard_regset2))
set_p = true;
}
if (set_p && j >= ira_allocno_classes_num)
ira_important_classes[ira_important_classes_num++]
= (enum reg_class) cl;
}
/* Now add allocno classes to the important classes. */
for (j = 0; j < ira_allocno_classes_num; j++)
ira_important_classes[ira_important_classes_num++]
@ -1575,15 +1568,10 @@ ira_init_register_move_cost (enum machine_mode mode)
memcpy (ira_max_register_move_cost[mode], ira_register_move_cost[mode],
sizeof (move_table) * N_REG_CLASSES);
for (cl1 = 0; cl1 < N_REG_CLASSES; cl1++)
{
/* Some subclasses are to small to have enough registers to hold
a value of MODE. Just ignore them. */
if (ira_reg_class_max_nregs[cl1][mode] > ira_class_hard_regs_num[cl1])
continue;
COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl1]);
AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);
if (hard_reg_set_empty_p (temp_hard_regset))
continue;
/* Some subclasses are to small to have enough registers to hold
a value of MODE. Just ignore them. */
if (ira_class_hard_regs_num[cl1] > 0
&& ira_reg_class_max_nregs[cl1][mode] <= ira_class_hard_regs_num[cl1])
for (cl2 = 0; cl2 < N_REG_CLASSES; cl2++)
if (hard_reg_set_subset_p (reg_class_contents[cl1],
reg_class_contents[cl2]))
@ -1598,7 +1586,6 @@ ira_init_register_move_cost (enum machine_mode mode)
ira_max_register_move_cost[mode][cl3][cl2]
= ira_register_move_cost[mode][cl3][cl1];
}
}
ira_may_move_in_cost[mode]
= (move_table *) xmalloc (sizeof (move_table) * N_REG_CLASSES);
memcpy (ira_may_move_in_cost[mode], may_move_in_cost[mode],
@ -1619,9 +1606,7 @@ ira_init_register_move_cost (enum machine_mode mode)
{
for (cl2 = 0; cl2 < N_REG_CLASSES; cl2++)
{
COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl2]);
AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);
if (hard_reg_set_empty_p (temp_hard_regset))
if (ira_class_hard_regs_num[cl2] == 0)
continue;
if (ira_class_subset_p[cl1][cl2])
ira_may_move_in_cost[mode][cl1][cl2] = 0;