Mercurial > hg > CbC > CbC_gcc
comparison gcc/lra-assigns.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Assign reload pseudos. | 1 /* Assign reload pseudos. |
2 Copyright (C) 2010-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2010-2020 Free Software Foundation, Inc. |
3 Contributed by Vladimir Makarov <vmakarov@redhat.com>. | 3 Contributed by Vladimir Makarov <vmakarov@redhat.com>. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it under | 7 GCC is free software; you can redistribute it and/or modify it under |
89 #include "regs.h" | 89 #include "regs.h" |
90 #include "ira.h" | 90 #include "ira.h" |
91 #include "recog.h" | 91 #include "recog.h" |
92 #include "rtl-error.h" | 92 #include "rtl-error.h" |
93 #include "sparseset.h" | 93 #include "sparseset.h" |
94 #include "params.h" | |
95 #include "lra.h" | 94 #include "lra.h" |
96 #include "lra-int.h" | 95 #include "lra-int.h" |
96 #include "function-abi.h" | |
97 | 97 |
98 /* Current iteration number of the pass and current iteration number | 98 /* Current iteration number of the pass and current iteration number |
99 of the pass after the latest spill pass when any former reload | 99 of the pass after the latest spill pass when any former reload |
100 pseudo was spilled. */ | 100 pseudo was spilled. */ |
101 int lra_assignment_iter; | 101 int lra_assignment_iter; |
491 bitmap_iterator bi; | 491 bitmap_iterator bi; |
492 bool *rclass_intersect_p; | 492 bool *rclass_intersect_p; |
493 HARD_REG_SET impossible_start_hard_regs, available_regs; | 493 HARD_REG_SET impossible_start_hard_regs, available_regs; |
494 | 494 |
495 if (hard_reg_set_empty_p (regno_set)) | 495 if (hard_reg_set_empty_p (regno_set)) |
496 COPY_HARD_REG_SET (conflict_set, lra_no_alloc_regs); | 496 conflict_set = lra_no_alloc_regs; |
497 else | 497 else |
498 { | 498 conflict_set = ~regno_set | lra_no_alloc_regs; |
499 COMPL_HARD_REG_SET (conflict_set, regno_set); | |
500 IOR_HARD_REG_SET (conflict_set, lra_no_alloc_regs); | |
501 } | |
502 rclass = regno_allocno_class_array[regno]; | 499 rclass = regno_allocno_class_array[regno]; |
503 rclass_intersect_p = ira_reg_classes_intersect_p[rclass]; | 500 rclass_intersect_p = ira_reg_classes_intersect_p[rclass]; |
504 curr_hard_regno_costs_check++; | 501 curr_hard_regno_costs_check++; |
505 sparseset_clear (conflict_reload_and_inheritance_pseudos); | 502 sparseset_clear (conflict_reload_and_inheritance_pseudos); |
506 sparseset_clear (live_range_hard_reg_pseudos); | 503 sparseset_clear (live_range_hard_reg_pseudos); |
507 IOR_HARD_REG_SET (conflict_set, lra_reg_info[regno].conflict_hard_regs); | 504 conflict_set |= lra_reg_info[regno].conflict_hard_regs; |
508 biggest_mode = lra_reg_info[regno].biggest_mode; | 505 biggest_mode = lra_reg_info[regno].biggest_mode; |
509 for (r = lra_reg_info[regno].live_ranges; r != NULL; r = r->next) | 506 for (r = lra_reg_info[regno].live_ranges; r != NULL; r = r->next) |
510 { | 507 { |
511 EXECUTE_IF_SET_IN_BITMAP (&live_hard_reg_pseudos[r->start], 0, k, bi) | 508 EXECUTE_IF_SET_IN_BITMAP (&live_hard_reg_pseudos[r->start], 0, k, bi) |
512 if (rclass_intersect_p[regno_allocno_class_array[k]]) | 509 if (rclass_intersect_p[regno_allocno_class_array[k]]) |
562 conflict_hr = live_pseudos_reg_renumber[conflict_regno]; | 559 conflict_hr = live_pseudos_reg_renumber[conflict_regno]; |
563 nregs = hard_regno_nregs (conflict_hr, | 560 nregs = hard_regno_nregs (conflict_hr, |
564 lra_reg_info[conflict_regno].biggest_mode); | 561 lra_reg_info[conflict_regno].biggest_mode); |
565 /* Remember about multi-register pseudos. For example, 2 | 562 /* Remember about multi-register pseudos. For example, 2 |
566 hard register pseudos can start on the same hard register | 563 hard register pseudos can start on the same hard register |
567 but can not start on HR and HR+1/HR-1. */ | 564 but cannot start on HR and HR+1/HR-1. */ |
568 for (hr = conflict_hr + 1; | 565 for (hr = conflict_hr + 1; |
569 hr < FIRST_PSEUDO_REGISTER && hr < conflict_hr + nregs; | 566 hr < FIRST_PSEUDO_REGISTER && hr < conflict_hr + nregs; |
570 hr++) | 567 hr++) |
571 SET_HARD_REG_BIT (impossible_start_hard_regs, hr); | 568 SET_HARD_REG_BIT (impossible_start_hard_regs, hr); |
572 for (hr = conflict_hr - 1; | 569 for (hr = conflict_hr - 1; |
612 lra_reg_info[conflict_regno].preferred_hard_regno_profit2); | 609 lra_reg_info[conflict_regno].preferred_hard_regno_profit2); |
613 } | 610 } |
614 } | 611 } |
615 /* Make sure that all registers in a multi-word pseudo belong to the | 612 /* Make sure that all registers in a multi-word pseudo belong to the |
616 required class. */ | 613 required class. */ |
617 IOR_COMPL_HARD_REG_SET (conflict_set, reg_class_contents[rclass]); | 614 conflict_set |= ~reg_class_contents[rclass]; |
618 lra_assert (rclass != NO_REGS); | 615 lra_assert (rclass != NO_REGS); |
619 rclass_size = ira_class_hard_regs_num[rclass]; | 616 rclass_size = ira_class_hard_regs_num[rclass]; |
620 best_hard_regno = -1; | 617 best_hard_regno = -1; |
621 hard_regno = ira_class_hard_regs[rclass][0]; | 618 hard_regno = ira_class_hard_regs[rclass][0]; |
622 biggest_nregs = hard_regno_nregs (hard_regno, biggest_mode); | 619 biggest_nregs = hard_regno_nregs (hard_regno, biggest_mode); |
623 nregs_diff = (biggest_nregs | 620 nregs_diff = (biggest_nregs |
624 - hard_regno_nregs (hard_regno, PSEUDO_REGNO_MODE (regno))); | 621 - hard_regno_nregs (hard_regno, PSEUDO_REGNO_MODE (regno))); |
625 COPY_HARD_REG_SET (available_regs, reg_class_contents[rclass]); | 622 available_regs = reg_class_contents[rclass] & ~lra_no_alloc_regs; |
626 AND_COMPL_HARD_REG_SET (available_regs, lra_no_alloc_regs); | |
627 for (i = 0; i < rclass_size; i++) | 623 for (i = 0; i < rclass_size; i++) |
628 { | 624 { |
629 if (try_only_hard_regno >= 0) | 625 if (try_only_hard_regno >= 0) |
630 hard_regno = try_only_hard_regno; | 626 hard_regno = try_only_hard_regno; |
631 else | 627 else |
632 hard_regno = ira_class_hard_regs[rclass][i]; | 628 hard_regno = ira_class_hard_regs[rclass][i]; |
633 if (! overlaps_hard_reg_set_p (conflict_set, | 629 if (! overlaps_hard_reg_set_p (conflict_set, |
634 PSEUDO_REGNO_MODE (regno), hard_regno) | 630 PSEUDO_REGNO_MODE (regno), hard_regno) |
635 && targetm.hard_regno_mode_ok (hard_regno, | 631 && targetm.hard_regno_mode_ok (hard_regno, |
636 PSEUDO_REGNO_MODE (regno)) | 632 PSEUDO_REGNO_MODE (regno)) |
637 /* We can not use prohibited_class_mode_regs for all classes | 633 /* We cannot use prohibited_class_mode_regs for all classes |
638 because it is not defined for all classes. */ | 634 because it is not defined for all classes. */ |
639 && (ira_allocno_class_translate[rclass] != rclass | 635 && (ira_allocno_class_translate[rclass] != rclass |
640 || ! TEST_HARD_REG_BIT (ira_prohibited_class_mode_regs | 636 || ! TEST_HARD_REG_BIT (ira_prohibited_class_mode_regs |
641 [rclass][PSEUDO_REGNO_MODE (regno)], | 637 [rclass][PSEUDO_REGNO_MODE (regno)], |
642 hard_regno)) | 638 hard_regno)) |
656 hard_regno_costs[hard_regno] = 0; | 652 hard_regno_costs[hard_regno] = 0; |
657 } | 653 } |
658 for (j = 0; | 654 for (j = 0; |
659 j < hard_regno_nregs (hard_regno, PSEUDO_REGNO_MODE (regno)); | 655 j < hard_regno_nregs (hard_regno, PSEUDO_REGNO_MODE (regno)); |
660 j++) | 656 j++) |
661 if (! TEST_HARD_REG_BIT (call_used_reg_set, hard_regno + j) | 657 if (! crtl->abi->clobbers_full_reg_p (hard_regno + j) |
662 && ! df_regs_ever_live_p (hard_regno + j)) | 658 && ! df_regs_ever_live_p (hard_regno + j)) |
663 /* It needs save restore. */ | 659 /* It needs save restore. */ |
664 hard_regno_costs[hard_regno] | 660 hard_regno_costs[hard_regno] |
665 += (2 | 661 += (2 |
666 * REG_FREQ_FROM_BB (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) | 662 * REG_FREQ_FROM_BB (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) |
783 void | 779 void |
784 lra_setup_reg_renumber (int regno, int hard_regno, bool print_p) | 780 lra_setup_reg_renumber (int regno, int hard_regno, bool print_p) |
785 { | 781 { |
786 int i, hr; | 782 int i, hr; |
787 | 783 |
788 /* We can not just reassign hard register. */ | 784 /* We cannot just reassign hard register. */ |
789 lra_assert (hard_regno < 0 || reg_renumber[regno] < 0); | 785 lra_assert (hard_regno < 0 || reg_renumber[regno] < 0); |
790 if ((hr = hard_regno) < 0) | 786 if ((hr = hard_regno) < 0) |
791 hr = reg_renumber[regno]; | 787 hr = reg_renumber[regno]; |
792 reg_renumber[regno] = hard_regno; | 788 reg_renumber[regno] = hard_regno; |
793 lra_assert (hr >= 0); | 789 lra_assert (hr >= 0); |
966 { | 962 { |
967 hard_regno = ira_class_hard_regs[rclass][i]; | 963 hard_regno = ira_class_hard_regs[rclass][i]; |
968 bitmap_clear (&spill_pseudos_bitmap); | 964 bitmap_clear (&spill_pseudos_bitmap); |
969 for (j = hard_regno_nregs (hard_regno, mode) - 1; j >= 0; j--) | 965 for (j = hard_regno_nregs (hard_regno, mode) - 1; j >= 0; j--) |
970 { | 966 { |
967 if (hard_regno + j >= FIRST_PSEUDO_REGISTER) | |
968 break; | |
971 if (try_hard_reg_pseudos_check[hard_regno + j] != curr_pseudo_check) | 969 if (try_hard_reg_pseudos_check[hard_regno + j] != curr_pseudo_check) |
972 continue; | 970 continue; |
973 lra_assert (!bitmap_empty_p (&try_hard_reg_pseudos[hard_regno + j])); | 971 lra_assert (!bitmap_empty_p (&try_hard_reg_pseudos[hard_regno + j])); |
974 bitmap_ior_into (&spill_pseudos_bitmap, | 972 bitmap_ior_into (&spill_pseudos_bitmap, |
975 &try_hard_reg_pseudos[hard_regno + j]); | 973 &try_hard_reg_pseudos[hard_regno + j]); |
1009 } | 1007 } |
1010 } | 1008 } |
1011 } | 1009 } |
1012 n = 0; | 1010 n = 0; |
1013 if (sparseset_cardinality (live_range_reload_inheritance_pseudos) | 1011 if (sparseset_cardinality (live_range_reload_inheritance_pseudos) |
1014 <= (unsigned)LRA_MAX_CONSIDERED_RELOAD_PSEUDOS) | 1012 <= (unsigned)param_lra_max_considered_reload_pseudos) |
1015 EXECUTE_IF_SET_IN_SPARSESET (live_range_reload_inheritance_pseudos, | 1013 EXECUTE_IF_SET_IN_SPARSESET (live_range_reload_inheritance_pseudos, |
1016 reload_regno) | 1014 reload_regno) |
1017 if ((int) reload_regno != regno | 1015 if ((int) reload_regno != regno |
1018 && (ira_reg_classes_intersect_p | 1016 && (ira_reg_classes_intersect_p |
1019 [rclass][regno_allocno_class_array[reload_regno]]) | 1017 [rclass][regno_allocno_class_array[reload_regno]]) |
1133 static int *sorted_pseudos; | 1131 static int *sorted_pseudos; |
1134 | 1132 |
1135 /* The constraints pass is allowed to create equivalences between | 1133 /* The constraints pass is allowed to create equivalences between |
1136 pseudos that make the current allocation "incorrect" (in the sense | 1134 pseudos that make the current allocation "incorrect" (in the sense |
1137 that pseudos are assigned to hard registers from their own conflict | 1135 that pseudos are assigned to hard registers from their own conflict |
1138 sets). The global variable lra_risky_transformations_p says | 1136 sets). The global variable check_and_force_assignment_correctness_p says |
1139 whether this might have happened. | 1137 whether this might have happened. |
1140 | 1138 |
1141 Process pseudos assigned to hard registers (less frequently used | 1139 Process pseudos assigned to hard registers (less frequently used |
1142 first), spill if a conflict is found, and mark the spilled pseudos | 1140 first), spill if a conflict is found, and mark the spilled pseudos |
1143 in SPILLED_PSEUDO_BITMAP. Set up LIVE_HARD_REG_PSEUDOS from | 1141 in SPILLED_PSEUDO_BITMAP. Set up LIVE_HARD_REG_PSEUDOS from |
1144 pseudos, assigned to hard registers. */ | 1142 pseudos, assigned to hard registers. */ |
1145 static void | 1143 static void |
1146 setup_live_pseudos_and_spill_after_risky_transforms (bitmap | 1144 setup_live_pseudos_and_spill_after_risky_transforms (bitmap |
1147 spilled_pseudo_bitmap) | 1145 spilled_pseudo_bitmap) |
1148 { | 1146 { |
1149 int p, i, j, n, regno, hard_regno; | 1147 int p, i, j, n, regno, hard_regno, biggest_nregs, nregs_diff; |
1150 unsigned int k, conflict_regno; | 1148 unsigned int k, conflict_regno; |
1151 poly_int64 offset; | 1149 poly_int64 offset; |
1152 int val; | 1150 int val; |
1153 HARD_REG_SET conflict_set; | 1151 HARD_REG_SET conflict_set; |
1154 machine_mode mode; | 1152 machine_mode mode, biggest_mode; |
1155 lra_live_range_t r; | 1153 lra_live_range_t r; |
1156 bitmap_iterator bi; | 1154 bitmap_iterator bi; |
1157 int max_regno = max_reg_num (); | 1155 int max_regno = max_reg_num (); |
1158 | 1156 |
1159 if (! lra_risky_transformations_p) | 1157 if (! check_and_force_assignment_correctness_p) |
1160 { | 1158 { |
1161 for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) | 1159 for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) |
1162 if (reg_renumber[i] >= 0 && lra_reg_info[i].nrefs > 0) | 1160 if (reg_renumber[i] >= 0 && lra_reg_info[i].nrefs > 0) |
1163 update_lives (i, false); | 1161 update_lives (i, false); |
1164 return; | 1162 return; |
1165 } | 1163 } |
1166 for (n = 0, i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) | 1164 for (n = 0, i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) |
1167 if ((pic_offset_table_rtx == NULL_RTX | 1165 if ((pic_offset_table_rtx == NULL_RTX |
1168 || i != (int) REGNO (pic_offset_table_rtx)) | 1166 || i != (int) REGNO (pic_offset_table_rtx)) |
1169 && reg_renumber[i] >= 0 && lra_reg_info[i].nrefs > 0) | 1167 && (hard_regno = reg_renumber[i]) >= 0 && lra_reg_info[i].nrefs > 0) |
1170 sorted_pseudos[n++] = i; | 1168 { |
1169 biggest_mode = lra_reg_info[i].biggest_mode; | |
1170 biggest_nregs = hard_regno_nregs (hard_regno, biggest_mode); | |
1171 nregs_diff = (biggest_nregs | |
1172 - hard_regno_nregs (hard_regno, PSEUDO_REGNO_MODE (i))); | |
1173 enum reg_class rclass = lra_get_allocno_class (i); | |
1174 | |
1175 if ((WORDS_BIG_ENDIAN | |
1176 && (hard_regno - nregs_diff < 0 | |
1177 || !TEST_HARD_REG_BIT (reg_class_contents[rclass], | |
1178 hard_regno - nregs_diff))) | |
1179 || (!WORDS_BIG_ENDIAN | |
1180 && (hard_regno + nregs_diff >= FIRST_PSEUDO_REGISTER | |
1181 || !TEST_HARD_REG_BIT (reg_class_contents[rclass], | |
1182 hard_regno + nregs_diff)))) | |
1183 { | |
1184 /* Hard registers of paradoxical sub-registers are out of | |
1185 range of pseudo register class. Spill the pseudo. */ | |
1186 reg_renumber[i] = -1; | |
1187 continue; | |
1188 } | |
1189 sorted_pseudos[n++] = i; | |
1190 } | |
1171 qsort (sorted_pseudos, n, sizeof (int), pseudo_compare_func); | 1191 qsort (sorted_pseudos, n, sizeof (int), pseudo_compare_func); |
1172 if (pic_offset_table_rtx != NULL_RTX | 1192 if (pic_offset_table_rtx != NULL_RTX |
1173 && (regno = REGNO (pic_offset_table_rtx)) >= FIRST_PSEUDO_REGISTER | 1193 && (regno = REGNO (pic_offset_table_rtx)) >= FIRST_PSEUDO_REGISTER |
1174 && reg_renumber[regno] >= 0 && lra_reg_info[regno].nrefs > 0) | 1194 && reg_renumber[regno] >= 0 && lra_reg_info[regno].nrefs > 0) |
1175 sorted_pseudos[n++] = regno; | 1195 sorted_pseudos[n++] = regno; |
1193 r2 = r2->start_next) | 1213 r2 = r2->start_next) |
1194 if (live_pseudos_reg_renumber[r2->regno] >= 0) | 1214 if (live_pseudos_reg_renumber[r2->regno] >= 0) |
1195 sparseset_set_bit (live_range_hard_reg_pseudos, r2->regno); | 1215 sparseset_set_bit (live_range_hard_reg_pseudos, r2->regno); |
1196 } | 1216 } |
1197 } | 1217 } |
1198 COPY_HARD_REG_SET (conflict_set, lra_no_alloc_regs); | 1218 conflict_set = lra_no_alloc_regs; |
1199 IOR_HARD_REG_SET (conflict_set, lra_reg_info[regno].conflict_hard_regs); | 1219 conflict_set |= lra_reg_info[regno].conflict_hard_regs; |
1200 val = lra_reg_info[regno].val; | 1220 val = lra_reg_info[regno].val; |
1201 offset = lra_reg_info[regno].offset; | 1221 offset = lra_reg_info[regno].offset; |
1202 EXECUTE_IF_SET_IN_SPARSESET (live_range_hard_reg_pseudos, conflict_regno) | 1222 EXECUTE_IF_SET_IN_SPARSESET (live_range_hard_reg_pseudos, conflict_regno) |
1203 if (!lra_reg_val_equal_p (conflict_regno, val, offset) | 1223 if (!lra_reg_val_equal_p (conflict_regno, val, offset) |
1204 /* If it is multi-register pseudos they should start on | 1224 /* If it is multi-register pseudos they should start on |
1205 the same hard register. */ | 1225 the same hard register. */ |
1206 || hard_regno != reg_renumber[conflict_regno]) | 1226 || hard_regno != reg_renumber[conflict_regno]) |
1207 { | 1227 { |
1208 int conflict_hard_regno = reg_renumber[conflict_regno]; | 1228 int conflict_hard_regno = reg_renumber[conflict_regno]; |
1209 machine_mode biggest_mode = lra_reg_info[conflict_regno].biggest_mode; | 1229 |
1210 int biggest_nregs = hard_regno_nregs (conflict_hard_regno, | 1230 biggest_mode = lra_reg_info[conflict_regno].biggest_mode; |
1211 biggest_mode); | 1231 biggest_nregs = hard_regno_nregs (conflict_hard_regno, |
1212 int nregs_diff | 1232 biggest_mode); |
1233 nregs_diff | |
1213 = (biggest_nregs | 1234 = (biggest_nregs |
1214 - hard_regno_nregs (conflict_hard_regno, | 1235 - hard_regno_nregs (conflict_hard_regno, |
1215 PSEUDO_REGNO_MODE (conflict_regno))); | 1236 PSEUDO_REGNO_MODE (conflict_regno))); |
1216 add_to_hard_reg_set (&conflict_set, | 1237 add_to_hard_reg_set (&conflict_set, |
1217 biggest_mode, | 1238 biggest_mode, |
1432 if (nfails == 0 || iter > 0) | 1453 if (nfails == 0 || iter > 0) |
1433 { | 1454 { |
1434 fails_p = nfails != 0; | 1455 fails_p = nfails != 0; |
1435 break; | 1456 break; |
1436 } | 1457 } |
1437 /* This is a very rare event. We can not assign a hard register | 1458 /* This is a very rare event. We cannot assign a hard register |
1438 to reload pseudo because the hard register was assigned to | 1459 to reload pseudo because the hard register was assigned to |
1439 another reload pseudo on a previous assignment pass. For x86 | 1460 another reload pseudo on a previous assignment pass. For x86 |
1440 example, on the 1st pass we assigned CX (although another | 1461 example, on the 1st pass we assigned CX (although another |
1441 hard register could be used for this) to reload pseudo in an | 1462 hard register could be used for this) to reload pseudo in an |
1442 insn, on the 2nd pass we need CX (and only this) hard | 1463 insn, on the 2nd pass we need CX (and only this) hard |
1613 former_reload_pseudo_spill_p = false; | 1634 former_reload_pseudo_spill_p = false; |
1614 init_regno_assign_info (); | 1635 init_regno_assign_info (); |
1615 bitmap_initialize (&all_spilled_pseudos, ®_obstack); | 1636 bitmap_initialize (&all_spilled_pseudos, ®_obstack); |
1616 create_live_range_start_chains (); | 1637 create_live_range_start_chains (); |
1617 setup_live_pseudos_and_spill_after_risky_transforms (&all_spilled_pseudos); | 1638 setup_live_pseudos_and_spill_after_risky_transforms (&all_spilled_pseudos); |
1618 if (flag_checking && !flag_ipa_ra) | 1639 if (! lra_asm_error_p && flag_checking) |
1640 /* Check correctness of allocation for call-crossed pseudos but | |
1641 only when there are no asm errors as in the case of errors the | |
1642 asm is removed and it can result in incorrect allocation. */ | |
1619 for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) | 1643 for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) |
1620 if (lra_reg_info[i].nrefs != 0 && reg_renumber[i] >= 0 | 1644 if (lra_reg_info[i].nrefs != 0 |
1621 && lra_reg_info[i].call_p | 1645 && reg_renumber[i] >= 0 |
1622 && overlaps_hard_reg_set_p (call_used_reg_set, | 1646 && overlaps_hard_reg_set_p (lra_reg_info[i].conflict_hard_regs, |
1623 PSEUDO_REGNO_MODE (i), reg_renumber[i])) | 1647 PSEUDO_REGNO_MODE (i), reg_renumber[i])) |
1624 gcc_unreachable (); | 1648 gcc_unreachable (); |
1625 /* Setup insns to process on the next constraint pass. */ | 1649 /* Setup insns to process on the next constraint pass. */ |
1626 bitmap_initialize (&changed_pseudo_bitmap, ®_obstack); | 1650 bitmap_initialize (&changed_pseudo_bitmap, ®_obstack); |
1627 init_live_reload_and_inheritance_pseudos (); | 1651 init_live_reload_and_inheritance_pseudos (); |
1664 the test can uncover errors in machine descriptions. */ | 1688 the test can uncover errors in machine descriptions. */ |
1665 if (flag_checking | 1689 if (flag_checking |
1666 && (lra_assignment_iter_after_spill | 1690 && (lra_assignment_iter_after_spill |
1667 > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER)) | 1691 > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER)) |
1668 internal_error | 1692 internal_error |
1669 ("Maximum number of LRA assignment passes is achieved (%d)\n", | 1693 ("maximum number of LRA assignment passes is achieved (%d)", |
1670 LRA_MAX_ASSIGNMENT_ITERATION_NUMBER); | 1694 LRA_MAX_ASSIGNMENT_ITERATION_NUMBER); |
1695 /* Reset the assignment correctness flag: */ | |
1696 check_and_force_assignment_correctness_p = false; | |
1671 return no_spills_p; | 1697 return no_spills_p; |
1672 } | 1698 } |
1673 | 1699 |
1674 /* Find start and finish insns for reload pseudo REGNO. Return true | 1700 /* Find start and finish insns for reload pseudo REGNO. Return true |
1675 if we managed to find the expected insns. Return false, | 1701 if we managed to find the expected insns. Return false, |
1753 if (lra_dump_file != NULL) | 1779 if (lra_dump_file != NULL) |
1754 fprintf (lra_dump_file, | 1780 fprintf (lra_dump_file, |
1755 "\n****** Splitting a hard reg after assignment #%d: ******\n\n", | 1781 "\n****** Splitting a hard reg after assignment #%d: ******\n\n", |
1756 lra_assignment_iter); | 1782 lra_assignment_iter); |
1757 bitmap_initialize (&failed_reload_pseudos, ®_obstack); | 1783 bitmap_initialize (&failed_reload_pseudos, ®_obstack); |
1784 bitmap_initialize (&non_reload_pseudos, ®_obstack); | |
1785 bitmap_ior (&non_reload_pseudos, &lra_inheritance_pseudos, &lra_split_regs); | |
1786 bitmap_ior_into (&non_reload_pseudos, &lra_subreg_reload_pseudos); | |
1787 bitmap_ior_into (&non_reload_pseudos, &lra_optional_reload_pseudos); | |
1758 for (i = lra_constraint_new_regno_start; i < max_regno; i++) | 1788 for (i = lra_constraint_new_regno_start; i < max_regno; i++) |
1759 if (reg_renumber[i] < 0 && lra_reg_info[i].nrefs != 0 | 1789 if (reg_renumber[i] < 0 && lra_reg_info[i].nrefs != 0 |
1760 && (rclass = lra_get_allocno_class (i)) != NO_REGS | 1790 && (rclass = lra_get_allocno_class (i)) != NO_REGS |
1761 && ! bitmap_bit_p (&non_reload_pseudos, i)) | 1791 && ! bitmap_bit_p (&non_reload_pseudos, i)) |
1762 { | 1792 { |
1767 bitmap_clear (&failed_reload_pseudos); | 1797 bitmap_clear (&failed_reload_pseudos); |
1768 return true; | 1798 return true; |
1769 } | 1799 } |
1770 bitmap_set_bit (&failed_reload_pseudos, i); | 1800 bitmap_set_bit (&failed_reload_pseudos, i); |
1771 } | 1801 } |
1802 bitmap_clear (&non_reload_pseudos); | |
1772 bitmap_initialize (&failed_reload_insns, ®_obstack); | 1803 bitmap_initialize (&failed_reload_insns, ®_obstack); |
1773 EXECUTE_IF_SET_IN_BITMAP (&failed_reload_pseudos, 0, u, bi) | 1804 EXECUTE_IF_SET_IN_BITMAP (&failed_reload_pseudos, 0, u, bi) |
1774 { | 1805 { |
1775 regno = u; | 1806 regno = u; |
1776 bitmap_ior_into (&failed_reload_insns, | 1807 bitmap_ior_into (&failed_reload_insns, |
1781 EXECUTE_IF_SET_IN_BITMAP (&failed_reload_insns, 0, u, bi) | 1812 EXECUTE_IF_SET_IN_BITMAP (&failed_reload_insns, 0, u, bi) |
1782 { | 1813 { |
1783 insn = lra_insn_recog_data[u]->insn; | 1814 insn = lra_insn_recog_data[u]->insn; |
1784 if (asm_noperands (PATTERN (insn)) >= 0) | 1815 if (asm_noperands (PATTERN (insn)) >= 0) |
1785 { | 1816 { |
1786 asm_p = true; | 1817 lra_asm_error_p = asm_p = true; |
1787 error_for_asm (insn, | 1818 error_for_asm (insn, |
1788 "%<asm%> operand has impossible constraints"); | 1819 "%<asm%> operand has impossible constraints"); |
1789 /* Avoid further trouble with this insn. | 1820 /* Avoid further trouble with this insn. |
1790 For asm goto, instead of fixing up all the edges | 1821 For asm goto, instead of fixing up all the edges |
1791 just clear the template and clear input operands | 1822 just clear the template and clear input operands |