comparison gcc/ira-lives.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 /* IRA processing allocno lives to build allocno live ranges. 1 /* IRA processing allocno lives to build allocno live ranges.
2 Copyright (C) 2006-2018 Free Software Foundation, Inc. 2 Copyright (C) 2006-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
31 #include "insn-config.h" 31 #include "insn-config.h"
32 #include "regs.h" 32 #include "regs.h"
33 #include "ira.h" 33 #include "ira.h"
34 #include "ira-int.h" 34 #include "ira-int.h"
35 #include "sparseset.h" 35 #include "sparseset.h"
36 #include "function-abi.h"
36 37
37 /* The code in this file is similar to one in global but the code 38 /* The code in this file is similar to one in global but the code
38 works on the allocno basis and creates live ranges instead of 39 works on the allocno basis and creates live ranges instead of
39 pseudo-register conflicts. */ 40 pseudo-register conflicts. */
40 41
78 /* The number of the last processed call. */ 79 /* The number of the last processed call. */
79 static int last_call_num; 80 static int last_call_num;
80 /* The number of last call at which given allocno was saved. */ 81 /* The number of last call at which given allocno was saved. */
81 static int *allocno_saved_at_call; 82 static int *allocno_saved_at_call;
82 83
83 /* The value of get_preferred_alternatives for the current instruction, 84 /* The value returned by ira_setup_alts for the current instruction;
84 supplemental to recog_data. */ 85 i.e. the set of alternatives that we should consider to be likely
86 candidates during reloading. */
85 static alternative_mask preferred_alternatives; 87 static alternative_mask preferred_alternatives;
86 88
87 /* If non-NULL, the source operand of a register to register copy for which 89 /* If non-NULL, the source operand of a register to register copy for which
88 we should not add a conflict with the copy's destination operand. */ 90 we should not add a conflict with the copy's destination operand. */
89 static rtx ignore_reg_for_conflicts; 91 static rtx ignore_reg_for_conflicts;
161 This finishes the current live range for it. */ 163 This finishes the current live range for it. */
162 static void 164 static void
163 make_object_dead (ira_object_t obj) 165 make_object_dead (ira_object_t obj)
164 { 166 {
165 live_range_t lr; 167 live_range_t lr;
168 int regno;
166 int ignore_regno = -1; 169 int ignore_regno = -1;
170 int ignore_total_regno = -1;
167 int end_regno = -1; 171 int end_regno = -1;
168 172
169 sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj)); 173 sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
170 174
171 /* Check whether any part of IGNORE_REG_FOR_CONFLICTS already conflicts 175 /* Check whether any part of IGNORE_REG_FOR_CONFLICTS already conflicts
172 with OBJ. */ 176 with OBJ. */
173 if (ignore_reg_for_conflicts != NULL_RTX 177 if (ignore_reg_for_conflicts != NULL_RTX
174 && REGNO (ignore_reg_for_conflicts) < FIRST_PSEUDO_REGISTER) 178 && REGNO (ignore_reg_for_conflicts) < FIRST_PSEUDO_REGISTER)
175 { 179 {
176 end_regno = END_REGNO (ignore_reg_for_conflicts); 180 end_regno = END_REGNO (ignore_reg_for_conflicts);
177 int src_regno = ignore_regno = REGNO (ignore_reg_for_conflicts); 181 ignore_regno = ignore_total_regno = REGNO (ignore_reg_for_conflicts);
178 182
179 while (src_regno < end_regno) 183 for (regno = ignore_regno; regno < end_regno; regno++)
180 { 184 {
181 if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), src_regno)) 185 if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno))
182 { 186 ignore_regno = end_regno;
183 ignore_regno = end_regno = -1; 187 if (TEST_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno))
184 break; 188 ignore_total_regno = end_regno;
185 }
186 src_regno++;
187 } 189 }
188 } 190 }
189 191
190 IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), hard_regs_live); 192 OBJECT_CONFLICT_HARD_REGS (obj) |= hard_regs_live;
191 IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), hard_regs_live); 193 OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= hard_regs_live;
192 194
193 /* If IGNORE_REG_FOR_CONFLICTS did not already conflict with OBJ, make 195 /* If IGNORE_REG_FOR_CONFLICTS did not already conflict with OBJ, make
194 sure it still doesn't. */ 196 sure it still doesn't. */
195 for (; ignore_regno < end_regno; ignore_regno++) 197 for (regno = ignore_regno; regno < end_regno; regno++)
196 CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), ignore_regno); 198 CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
199 for (regno = ignore_total_regno; regno < end_regno; regno++)
200 CLEAR_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
197 201
198 lr = OBJECT_LIVE_RANGES (obj); 202 lr = OBJECT_LIVE_RANGES (obj);
199 ira_assert (lr != NULL); 203 ira_assert (lr != NULL);
200 lr->finish = curr_point; 204 lr->finish = curr_point;
201 update_allocno_pressure_excess_length (obj); 205 update_allocno_pressure_excess_length (obj);
627 return advance_p; 631 return advance_p;
628 } 632 }
629 633
630 /* Check and make if necessary conflicts for definition DEF of class 634 /* Check and make if necessary conflicts for definition DEF of class
631 DEF_CL of the current insn with input operands. Process only 635 DEF_CL of the current insn with input operands. Process only
632 constraints of alternative ALT. */ 636 constraints of alternative ALT.
633 static void 637
634 check_and_make_def_conflict (int alt, int def, enum reg_class def_cl) 638 One of three things is true when this function is called:
639
640 (1) DEF is an earlyclobber for alternative ALT. Input operands then
641 conflict with DEF in ALT unless they explicitly match DEF via 0-9
642 constraints.
643
644 (2) DEF matches (via 0-9 constraints) an operand that is an
645 earlyclobber for alternative ALT. Other input operands then
646 conflict with DEF in ALT.
647
648 (3) [FOR_TIE_P] Some input operand X matches DEF for alternative ALT.
649 Input operands with a different value from X then conflict with
650 DEF in ALT.
651
652 However, there's still a judgement call to make when deciding
653 whether a conflict in ALT is important enough to be reflected
654 in the pan-alternative allocno conflict set. */
655 static void
656 check_and_make_def_conflict (int alt, int def, enum reg_class def_cl,
657 bool for_tie_p)
635 { 658 {
636 int use, use_match; 659 int use, use_match;
637 ira_allocno_t a; 660 ira_allocno_t a;
638 enum reg_class use_cl, acl; 661 enum reg_class use_cl, acl;
639 bool advance_p; 662 bool advance_p;
663 int alt1; 686 int alt1;
664 687
665 if (use == def || recog_data.operand_type[use] == OP_OUT) 688 if (use == def || recog_data.operand_type[use] == OP_OUT)
666 continue; 689 continue;
667 690
691 /* An earlyclobber on DEF doesn't apply to an input operand X if X
692 explicitly matches DEF, but it applies to other input operands
693 even if they happen to be the same value as X.
694
695 In contrast, if an input operand X is tied to a non-earlyclobber
696 DEF, there's no conflict with other input operands that have the
697 same value as X. */
698 if (op_alt[use].matches == def
699 || (for_tie_p
700 && rtx_equal_p (recog_data.operand[use],
701 recog_data.operand[op_alt[def].matched])))
702 continue;
703
668 if (op_alt[use].anything_ok) 704 if (op_alt[use].anything_ok)
669 use_cl = ALL_REGS; 705 use_cl = ALL_REGS;
670 else 706 else
671 use_cl = op_alt[use].cl; 707 use_cl = op_alt[use].cl;
708 if (use_cl == NO_REGS)
709 continue;
710
711 /* If DEF is simply a tied operand, ignore cases in which this
712 alternative requires USE to have a likely-spilled class.
713 Adding a conflict would just constrain USE further if DEF
714 happens to be allocated first. */
715 if (for_tie_p && targetm.class_likely_spilled_p (use_cl))
716 continue;
672 717
673 /* If there's any alternative that allows USE to match DEF, do not 718 /* If there's any alternative that allows USE to match DEF, do not
674 record a conflict. If that causes us to create an invalid 719 record a conflict. If that causes us to create an invalid
675 instruction due to the earlyclobber, reload must fix it up. */ 720 instruction due to the earlyclobber, reload must fix it up.
721
722 Likewise, if we're treating a tied DEF like a partial earlyclobber,
723 do not record a conflict if there's another alternative in which
724 DEF is neither tied nor earlyclobber. */
676 for (alt1 = 0; alt1 < recog_data.n_alternatives; alt1++) 725 for (alt1 = 0; alt1 < recog_data.n_alternatives; alt1++)
677 { 726 {
678 if (!TEST_BIT (preferred_alternatives, alt1)) 727 if (!TEST_BIT (preferred_alternatives, alt1))
679 continue; 728 continue;
680 const operand_alternative *op_alt1 729 const operand_alternative *op_alt1
685 && op_alt1[use + 1].matches == def) 734 && op_alt1[use + 1].matches == def)
686 || (use >= 1 735 || (use >= 1
687 && recog_data.constraints[use - 1][0] == '%' 736 && recog_data.constraints[use - 1][0] == '%'
688 && op_alt1[use - 1].matches == def)) 737 && op_alt1[use - 1].matches == def))
689 break; 738 break;
739 if (for_tie_p
740 && !op_alt1[def].earlyclobber
741 && op_alt1[def].matched < 0
742 && alternative_class (op_alt1, def) != NO_REGS
743 && alternative_class (op_alt1, use) != NO_REGS)
744 break;
690 } 745 }
691 746
692 if (alt1 < recog_data.n_alternatives) 747 if (alt1 < recog_data.n_alternatives)
693 continue; 748 continue;
694 749
695 advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl, 750 advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
696 use, use_cl, advance_p); 751 use, use_cl, advance_p);
697 752
698 if ((use_match = op_alt[use].matches) >= 0) 753 if ((use_match = op_alt[use].matches) >= 0)
699 { 754 {
700 if (use_match == def) 755 gcc_checking_assert (use_match != def);
701 continue;
702 756
703 if (op_alt[use_match].anything_ok) 757 if (op_alt[use_match].anything_ok)
704 use_cl = ALL_REGS; 758 use_cl = ALL_REGS;
705 else 759 else
706 use_cl = op_alt[use_match].cl; 760 use_cl = op_alt[use_match].cl;
711 } 765 }
712 766
713 /* Make conflicts of early clobber pseudo registers of the current 767 /* Make conflicts of early clobber pseudo registers of the current
714 insn with its inputs. Avoid introducing unnecessary conflicts by 768 insn with its inputs. Avoid introducing unnecessary conflicts by
715 checking classes of the constraints and pseudos because otherwise 769 checking classes of the constraints and pseudos because otherwise
716 significant code degradation is possible for some targets. */ 770 significant code degradation is possible for some targets.
771
772 For these purposes, tying an input to an output makes that output act
773 like an earlyclobber for inputs with a different value, since the output
774 register then has a predetermined purpose on input to the instruction. */
717 static void 775 static void
718 make_early_clobber_and_input_conflicts (void) 776 make_early_clobber_and_input_conflicts (void)
719 { 777 {
720 int alt; 778 int alt;
721 int def, def_match; 779 int def, def_match;
726 const operand_alternative *op_alt = recog_op_alt; 784 const operand_alternative *op_alt = recog_op_alt;
727 for (alt = 0; alt < n_alternatives; alt++, op_alt += n_operands) 785 for (alt = 0; alt < n_alternatives; alt++, op_alt += n_operands)
728 if (TEST_BIT (preferred_alternatives, alt)) 786 if (TEST_BIT (preferred_alternatives, alt))
729 for (def = 0; def < n_operands; def++) 787 for (def = 0; def < n_operands; def++)
730 { 788 {
731 def_cl = NO_REGS; 789 if (op_alt[def].anything_ok)
732 if (op_alt[def].earlyclobber) 790 def_cl = ALL_REGS;
791 else
792 def_cl = op_alt[def].cl;
793 if (def_cl != NO_REGS)
733 { 794 {
734 if (op_alt[def].anything_ok) 795 if (op_alt[def].earlyclobber)
735 def_cl = ALL_REGS; 796 check_and_make_def_conflict (alt, def, def_cl, false);
736 else 797 else if (op_alt[def].matched >= 0
737 def_cl = op_alt[def].cl; 798 && !targetm.class_likely_spilled_p (def_cl))
738 check_and_make_def_conflict (alt, def, def_cl); 799 check_and_make_def_conflict (alt, def, def_cl, true);
739 } 800 }
801
740 if ((def_match = op_alt[def].matches) >= 0 802 if ((def_match = op_alt[def].matches) >= 0
741 && (op_alt[def_match].earlyclobber 803 && (op_alt[def_match].earlyclobber
742 || op_alt[def].earlyclobber)) 804 || op_alt[def].earlyclobber))
743 { 805 {
744 if (op_alt[def_match].anything_ok) 806 if (op_alt[def_match].anything_ok)
745 def_cl = ALL_REGS; 807 def_cl = ALL_REGS;
746 else 808 else
747 def_cl = op_alt[def_match].cl; 809 def_cl = op_alt[def_match].cl;
748 check_and_make_def_conflict (alt, def, def_cl); 810 check_and_make_def_conflict (alt, def, def_cl, false);
749 } 811 }
750 } 812 }
751 } 813 }
752 814
753 /* Mark early clobber hard registers of the current INSN as live (if 815 /* Mark early clobber hard registers of the current INSN as live (if
985 if (a != operand_a) 1047 if (a != operand_a)
986 { 1048 {
987 /* We could increase costs of A instead of making it 1049 /* We could increase costs of A instead of making it
988 conflicting with the hard register. But it works worse 1050 conflicting with the hard register. But it works worse
989 because it will be spilled in reload in anyway. */ 1051 because it will be spilled in reload in anyway. */
990 IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), 1052 OBJECT_CONFLICT_HARD_REGS (obj) |= reg_class_contents[cl];
991 reg_class_contents[cl]); 1053 OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= reg_class_contents[cl];
992 IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj),
993 reg_class_contents[cl]);
994 } 1054 }
995 } 1055 }
996 } 1056 }
997 } 1057 }
998 1058
1081 1141
1082 int dst_regno = REGNO (SET_DEST (set)); 1142 int dst_regno = REGNO (SET_DEST (set));
1083 int src_regno = REGNO (SET_SRC (set)); 1143 int src_regno = REGNO (SET_SRC (set));
1084 machine_mode mode = GET_MODE (SET_DEST (set)); 1144 machine_mode mode = GET_MODE (SET_DEST (set));
1085 1145
1146 /* By definition, a register does not conflict with itself, therefore we
1147 do not have to handle it specially. Returning NULL_RTX now, helps
1148 simplify the callers of this function. */
1149 if (dst_regno == src_regno)
1150 return NULL_RTX;
1151
1086 /* Computing conflicts for register pairs is difficult to get right, so 1152 /* Computing conflicts for register pairs is difficult to get right, so
1087 for now, disallow it. */ 1153 for now, disallow it. */
1088 if ((dst_regno < FIRST_PSEUDO_REGISTER 1154 if ((HARD_REGISTER_NUM_P (dst_regno)
1089 && hard_regno_nregs (dst_regno, mode) != 1) 1155 && hard_regno_nregs (dst_regno, mode) != 1)
1090 || (src_regno < FIRST_PSEUDO_REGISTER 1156 || (HARD_REGISTER_NUM_P (src_regno)
1091 && hard_regno_nregs (src_regno, mode) != 1)) 1157 && hard_regno_nregs (src_regno, mode) != 1))
1092 return NULL_RTX; 1158 return NULL_RTX;
1093 1159
1094 return SET_SRC (set); 1160 return SET_SRC (set);
1095 } 1161 }
1162
1163 #ifdef EH_RETURN_DATA_REGNO
1164
1165 /* Add EH return hard registers as conflict hard registers to allocnos
1166 living at end of BB. For most allocnos it is already done in
1167 process_bb_node_lives when we processing input edges but it does
1168 not work when and EH edge is edge out of the current region. This
1169 function covers such out of region edges. */
1170 static void
1171 process_out_of_region_eh_regs (basic_block bb)
1172 {
1173 edge e;
1174 edge_iterator ei;
1175 unsigned int i;
1176 bitmap_iterator bi;
1177 bool eh_p = false;
1178
1179 FOR_EACH_EDGE (e, ei, bb->succs)
1180 if ((e->flags & EDGE_EH)
1181 && IRA_BB_NODE (e->dest)->parent != IRA_BB_NODE (bb)->parent)
1182 eh_p = true;
1183
1184 if (! eh_p)
1185 return;
1186
1187 EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, i, bi)
1188 {
1189 ira_allocno_t a = ira_curr_regno_allocno_map[i];
1190 for (int n = ALLOCNO_NUM_OBJECTS (a) - 1; n >= 0; n--)
1191 {
1192 ira_object_t obj = ALLOCNO_OBJECT (a, n);
1193 for (int k = 0; ; k++)
1194 {
1195 unsigned int regno = EH_RETURN_DATA_REGNO (k);
1196 if (regno == INVALID_REGNUM)
1197 break;
1198 SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
1199 SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
1200 }
1201 }
1202 }
1203 }
1204
1205 #endif
1096 1206
1097 /* Process insns of the basic block given by its LOOP_TREE_NODE to 1207 /* Process insns of the basic block given by its LOOP_TREE_NODE to
1098 update allocno live ranges, allocno hard register conflicts, 1208 update allocno live ranges, allocno hard register conflicts,
1099 intersected calls, and register pressure info for allocnos for the 1209 intersected calls, and register pressure info for allocnos for the
1100 basic block for and regions containing the basic block. */ 1210 basic block for and regions containing the basic block. */
1120 } 1230 }
1121 curr_bb_node = loop_tree_node; 1231 curr_bb_node = loop_tree_node;
1122 reg_live_out = df_get_live_out (bb); 1232 reg_live_out = df_get_live_out (bb);
1123 sparseset_clear (objects_live); 1233 sparseset_clear (objects_live);
1124 REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out); 1234 REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
1125 AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset); 1235 hard_regs_live &= ~(eliminable_regset | ira_no_alloc_regs);
1126 AND_COMPL_HARD_REG_SET (hard_regs_live, ira_no_alloc_regs);
1127 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) 1236 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
1128 if (TEST_HARD_REG_BIT (hard_regs_live, i)) 1237 if (TEST_HARD_REG_BIT (hard_regs_live, i))
1129 { 1238 {
1130 enum reg_class aclass, pclass, cl; 1239 enum reg_class aclass, pclass, cl;
1131 1240
1146 } 1255 }
1147 } 1256 }
1148 EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi) 1257 EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi)
1149 mark_pseudo_regno_live (j); 1258 mark_pseudo_regno_live (j);
1150 1259
1260 #ifdef EH_RETURN_DATA_REGNO
1261 process_out_of_region_eh_regs (bb);
1262 #endif
1263
1151 freq = REG_FREQ_FROM_BB (bb); 1264 freq = REG_FREQ_FROM_BB (bb);
1152 if (freq == 0) 1265 if (freq == 0)
1153 freq = 1; 1266 freq = 1;
1154 1267
1155 /* Invalidate all allocno_saved_at_call entries. */ 1268 /* Invalidate all allocno_saved_at_call entries. */
1226 break; 1339 break;
1227 } 1340 }
1228 } 1341 }
1229 } 1342 }
1230 1343
1231 extract_insn (insn); 1344 preferred_alternatives = ira_setup_alts (insn);
1232 preferred_alternatives = get_preferred_alternatives (insn);
1233 preprocess_constraints (insn);
1234 process_single_reg_class_operands (false, freq); 1345 process_single_reg_class_operands (false, freq);
1235
1236 /* See which defined values die here. */
1237 FOR_EACH_INSN_DEF (def, insn)
1238 if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER))
1239 mark_ref_dead (def);
1240 1346
1241 if (call_p) 1347 if (call_p)
1242 { 1348 {
1243 /* Try to find a SET in the CALL_INSN_FUNCTION_USAGE, and from 1349 /* Try to find a SET in the CALL_INSN_FUNCTION_USAGE, and from
1244 there, try to find a pseudo that is live across the call but 1350 there, try to find a pseudo that is live across the call but
1253 EXECUTE_IF_SET_IN_SPARSESET (objects_live, i) 1359 EXECUTE_IF_SET_IN_SPARSESET (objects_live, i)
1254 { 1360 {
1255 ira_object_t obj = ira_object_id_map[i]; 1361 ira_object_t obj = ira_object_id_map[i];
1256 a = OBJECT_ALLOCNO (obj); 1362 a = OBJECT_ALLOCNO (obj);
1257 int num = ALLOCNO_NUM (a); 1363 int num = ALLOCNO_NUM (a);
1258 HARD_REG_SET this_call_used_reg_set; 1364 function_abi callee_abi = insn_callee_abi (insn);
1259
1260 get_call_reg_set_usage (insn, &this_call_used_reg_set,
1261 call_used_reg_set);
1262 1365
1263 /* Don't allocate allocnos that cross setjmps or any 1366 /* Don't allocate allocnos that cross setjmps or any
1264 call, if this function receives a nonlocal 1367 call, if this function receives a nonlocal
1265 goto. */ 1368 goto. */
1266 if (cfun->has_nonlocal_label 1369 if (cfun->has_nonlocal_label
1271 SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj)); 1374 SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj));
1272 SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)); 1375 SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj));
1273 } 1376 }
1274 if (can_throw_internal (insn)) 1377 if (can_throw_internal (insn))
1275 { 1378 {
1276 IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), 1379 OBJECT_CONFLICT_HARD_REGS (obj)
1277 this_call_used_reg_set); 1380 |= callee_abi.mode_clobbers (ALLOCNO_MODE (a));
1278 IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), 1381 OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)
1279 this_call_used_reg_set); 1382 |= callee_abi.mode_clobbers (ALLOCNO_MODE (a));
1280 } 1383 }
1281 1384
1282 if (sparseset_bit_p (allocnos_processed, num)) 1385 if (sparseset_bit_p (allocnos_processed, num))
1283 continue; 1386 continue;
1284 sparseset_set_bit (allocnos_processed, num); 1387 sparseset_set_bit (allocnos_processed, num);
1291 between the two calls. */ 1394 between the two calls. */
1292 ALLOCNO_CALL_FREQ (a) += freq; 1395 ALLOCNO_CALL_FREQ (a) += freq;
1293 /* Mark it as saved at the next call. */ 1396 /* Mark it as saved at the next call. */
1294 allocno_saved_at_call[num] = last_call_num + 1; 1397 allocno_saved_at_call[num] = last_call_num + 1;
1295 ALLOCNO_CALLS_CROSSED_NUM (a)++; 1398 ALLOCNO_CALLS_CROSSED_NUM (a)++;
1296 IOR_HARD_REG_SET (ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS (a), 1399 ALLOCNO_CROSSED_CALLS_ABIS (a) |= 1 << callee_abi.id ();
1297 this_call_used_reg_set); 1400 ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS (a)
1401 |= callee_abi.full_and_partial_reg_clobbers ();
1298 if (cheap_reg != NULL_RTX 1402 if (cheap_reg != NULL_RTX
1299 && ALLOCNO_REGNO (a) == (int) REGNO (cheap_reg)) 1403 && ALLOCNO_REGNO (a) == (int) REGNO (cheap_reg))
1300 ALLOCNO_CHEAP_CALLS_CROSSED_NUM (a)++; 1404 ALLOCNO_CHEAP_CALLS_CROSSED_NUM (a)++;
1301 } 1405 }
1302 } 1406 }
1407
1408 /* See which defined values die here. Note that we include
1409 the call insn in the lifetimes of these values, so we don't
1410 mistakenly consider, for e.g. an addressing mode with a
1411 side-effect like a post-increment fetching the address,
1412 that the use happens before the call, and the def to happen
1413 after the call: we believe both to happen before the actual
1414 call. (We don't handle return-values here.) */
1415 FOR_EACH_INSN_DEF (def, insn)
1416 if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER))
1417 mark_ref_dead (def);
1303 1418
1304 make_early_clobber_and_input_conflicts (); 1419 make_early_clobber_and_input_conflicts ();
1305 1420
1306 curr_point++; 1421 curr_point++;
1307 1422
1345 break; 1460 break;
1346 make_hard_regno_live (regno); 1461 make_hard_regno_live (regno);
1347 } 1462 }
1348 1463
1349 /* Allocnos can't go in stack regs at the start of a basic block 1464 /* Allocnos can't go in stack regs at the start of a basic block
1350 that is reached by an abnormal edge. Likewise for call 1465 that is reached by an abnormal edge. Likewise for registers
1351 clobbered regs, because caller-save, fixup_abnormal_edges and 1466 that are at least partly call clobbered, because caller-save,
1352 possibly the table driven EH machinery are not quite ready to 1467 fixup_abnormal_edges and possibly the table driven EH machinery
1353 handle such allocnos live across such edges. */ 1468 are not quite ready to handle such allocnos live across such
1469 edges. */
1354 if (bb_has_abnormal_pred (bb)) 1470 if (bb_has_abnormal_pred (bb))
1355 { 1471 {
1356 #ifdef STACK_REGS 1472 #ifdef STACK_REGS
1357 EXECUTE_IF_SET_IN_SPARSESET (objects_live, px) 1473 EXECUTE_IF_SET_IN_SPARSESET (objects_live, px)
1358 { 1474 {
1368 have nonlocal labels around, as we don't ever try to 1484 have nonlocal labels around, as we don't ever try to
1369 allocate such regs in this case. */ 1485 allocate such regs in this case. */
1370 if (!cfun->has_nonlocal_label 1486 if (!cfun->has_nonlocal_label
1371 && has_abnormal_call_or_eh_pred_edge_p (bb)) 1487 && has_abnormal_call_or_eh_pred_edge_p (bb))
1372 for (px = 0; px < FIRST_PSEUDO_REGISTER; px++) 1488 for (px = 0; px < FIRST_PSEUDO_REGISTER; px++)
1373 if (call_used_regs[px] 1489 if (eh_edge_abi.clobbers_at_least_part_of_reg_p (px)
1374 #ifdef REAL_PIC_OFFSET_TABLE_REGNUM 1490 #ifdef REAL_PIC_OFFSET_TABLE_REGNUM
1375 /* We should create a conflict of PIC pseudo with 1491 /* We should create a conflict of PIC pseudo with
1376 PIC hard reg as PIC hard reg can have a wrong 1492 PIC hard reg as PIC hard reg can have a wrong
1377 value after jump described by the abnormal edge. 1493 value after jump described by the abnormal edge.
1378 In this case we can not allocate PIC hard reg to 1494 In this case we cannot allocate PIC hard reg to
1379 PIC pseudo as PIC pseudo will also have a wrong 1495 PIC pseudo as PIC pseudo will also have a wrong
1380 value. This code is not critical as LRA can fix 1496 value. This code is not critical as LRA can fix
1381 it but it is better to have the right allocation 1497 it but it is better to have the right allocation
1382 earlier. */ 1498 earlier. */
1383 || (px == REAL_PIC_OFFSET_TABLE_REGNUM 1499 || (px == REAL_PIC_OFFSET_TABLE_REGNUM