diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2012-05-31 05:30:07 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2012-05-31 05:30:07 +0000 |
commit | 3e575fe22b54b3c5738485f02c6d60c8c30b327e (patch) | |
tree | 2181fb681213f31365e065e94fcc9aa6ad3fa167 | |
parent | ed9e2ed0aa5f80cef689aa291da9952167aba5dc (diff) | |
download | gcc-3e575fe22b54b3c5738485f02c6d60c8c30b327e.zip gcc-3e575fe22b54b3c5738485f02c6d60c8c30b327e.tar.gz gcc-3e575fe22b54b3c5738485f02c6d60c8c30b327e.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ira.c | 67 |
2 files changed, 33 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bfab9d4..2f1610b 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. @@ -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; |