summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-31 05:30:07 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-31 05:30:07 +0000
commit0d089656cc1d003eb33fc654c52ea4d2f2f226a3 (patch)
tree2181fb681213f31365e065e94fcc9aa6ad3fa167
parentf3d2630082f3339564eaebd19d48506449f5c091 (diff)
downloadgcc-0d089656cc1d003eb33fc654c52ea4d2f2f226a3.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188045 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ira.c67
2 files changed, 33 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bfab9d4e7fc..2f1610b0d05 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
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
file conventions. Use ira_assert instead of gcc_assert.
diff --git a/gcc/ira.c b/gcc/ira.c
index 90b21b0ad4d..b6ce1e98f47 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -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;