Mercurial > hg > CbC > CbC_gcc
comparison gcc/lra-lives.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Build live ranges for pseudos. | 1 /* Build live ranges for pseudos. |
2 Copyright (C) 2010-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2010-2018 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 |
94 static bitmap_head temp_bitmap; | 94 static bitmap_head temp_bitmap; |
95 | 95 |
96 /* Pool for pseudo live ranges. */ | 96 /* Pool for pseudo live ranges. */ |
97 static object_allocator<lra_live_range> lra_live_range_pool ("live ranges"); | 97 static object_allocator<lra_live_range> lra_live_range_pool ("live ranges"); |
98 | 98 |
99 /* If non-NULL, the source operand of a register to register copy for which | |
100 we should not add a conflict with the copy's destination operand. */ | |
101 static rtx ignore_reg_for_conflicts; | |
102 | |
99 /* Free live range list LR. */ | 103 /* Free live range list LR. */ |
100 static void | 104 static void |
101 free_live_range_list (lra_live_range_t lr) | 105 free_live_range_list (lra_live_range_t lr) |
102 { | 106 { |
103 lra_live_range_t next; | 107 lra_live_range_t next; |
221 } | 225 } |
222 | 226 |
223 /* The corresponding bitmaps of BB currently being processed. */ | 227 /* The corresponding bitmaps of BB currently being processed. */ |
224 static bitmap bb_killed_pseudos, bb_gen_pseudos; | 228 static bitmap bb_killed_pseudos, bb_gen_pseudos; |
225 | 229 |
226 /* The function processing birth of hard register REGNO. It updates | 230 /* Record hard register REGNO as now being live. It updates |
227 living hard regs, START_LIVING, and conflict hard regs for living | 231 living hard regs and START_LIVING. */ |
228 pseudos. Conflict hard regs for the pic pseudo is not updated if | |
229 REGNO is REAL_PIC_OFFSET_TABLE_REGNUM and CHECK_PIC_PSEUDO_P is | |
230 true. */ | |
231 static void | 232 static void |
232 make_hard_regno_born (int regno, bool check_pic_pseudo_p ATTRIBUTE_UNUSED) | 233 make_hard_regno_live (int regno) |
233 { | 234 { |
234 unsigned int i; | |
235 | |
236 lra_assert (regno < FIRST_PSEUDO_REGISTER); | 235 lra_assert (regno < FIRST_PSEUDO_REGISTER); |
237 if (TEST_HARD_REG_BIT (hard_regs_live, regno)) | 236 if (TEST_HARD_REG_BIT (hard_regs_live, regno)) |
238 return; | 237 return; |
239 SET_HARD_REG_BIT (hard_regs_live, regno); | 238 SET_HARD_REG_BIT (hard_regs_live, regno); |
240 sparseset_set_bit (start_living, regno); | 239 sparseset_set_bit (start_living, regno); |
241 EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, i) | 240 if (fixed_regs[regno] || TEST_HARD_REG_BIT (hard_regs_spilled_into, regno)) |
242 #ifdef REAL_PIC_OFFSET_TABLE_REGNUM | |
243 if (! check_pic_pseudo_p | |
244 || regno != REAL_PIC_OFFSET_TABLE_REGNUM | |
245 || pic_offset_table_rtx == NULL | |
246 || i != REGNO (pic_offset_table_rtx)) | |
247 #endif | |
248 SET_HARD_REG_BIT (lra_reg_info[i].conflict_hard_regs, regno); | |
249 if (fixed_regs[regno]) | |
250 bitmap_set_bit (bb_gen_pseudos, regno); | 241 bitmap_set_bit (bb_gen_pseudos, regno); |
251 } | 242 } |
252 | 243 |
253 /* Process the death of hard register REGNO. This updates | 244 /* Process the definition of hard register REGNO. This updates |
254 hard_regs_live and START_DYING. */ | 245 hard_regs_live, START_DYING and conflict hard regs for living |
246 pseudos. */ | |
255 static void | 247 static void |
256 make_hard_regno_dead (int regno) | 248 make_hard_regno_dead (int regno) |
257 { | 249 { |
258 lra_assert (regno < FIRST_PSEUDO_REGISTER); | 250 lra_assert (regno < FIRST_PSEUDO_REGISTER); |
259 if (! TEST_HARD_REG_BIT (hard_regs_live, regno)) | 251 if (! TEST_HARD_REG_BIT (hard_regs_live, regno)) |
260 return; | 252 return; |
261 sparseset_set_bit (start_dying, regno); | 253 sparseset_set_bit (start_dying, regno); |
254 unsigned int i; | |
255 EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, i) | |
256 { | |
257 if (ignore_reg_for_conflicts != NULL_RTX | |
258 && REGNO (ignore_reg_for_conflicts) == i) | |
259 continue; | |
260 SET_HARD_REG_BIT (lra_reg_info[i].conflict_hard_regs, regno); | |
261 } | |
262 CLEAR_HARD_REG_BIT (hard_regs_live, regno); | 262 CLEAR_HARD_REG_BIT (hard_regs_live, regno); |
263 if (fixed_regs[regno]) | 263 if (fixed_regs[regno] || TEST_HARD_REG_BIT (hard_regs_spilled_into, regno)) |
264 { | 264 { |
265 bitmap_clear_bit (bb_gen_pseudos, regno); | 265 bitmap_clear_bit (bb_gen_pseudos, regno); |
266 bitmap_set_bit (bb_killed_pseudos, regno); | 266 bitmap_set_bit (bb_killed_pseudos, regno); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 /* Mark pseudo REGNO as living at program point POINT, update conflicting | 270 /* Mark pseudo REGNO as living at program point POINT, update START_LIVING |
271 hard registers of the pseudo and START_LIVING, and start a new live | 271 and start a new live range for the pseudo corresponding to REGNO if it |
272 range for the pseudo corresponding to REGNO if it is necessary. */ | 272 is necessary. */ |
273 static void | 273 static void |
274 mark_pseudo_live (int regno, int point) | 274 mark_pseudo_live (int regno, int point) |
275 { | 275 { |
276 lra_live_range_t p; | 276 lra_live_range_t p; |
277 | 277 |
278 lra_assert (regno >= FIRST_PSEUDO_REGISTER); | 278 lra_assert (regno >= FIRST_PSEUDO_REGISTER); |
279 lra_assert (! sparseset_bit_p (pseudos_live, regno)); | 279 lra_assert (! sparseset_bit_p (pseudos_live, regno)); |
280 sparseset_set_bit (pseudos_live, regno); | 280 sparseset_set_bit (pseudos_live, regno); |
281 IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs, hard_regs_live); | |
282 | 281 |
283 if ((complete_info_p || lra_get_regno_hard_regno (regno) < 0) | 282 if ((complete_info_p || lra_get_regno_hard_regno (regno) < 0) |
284 && ((p = lra_reg_info[regno].live_ranges) == NULL | 283 && ((p = lra_reg_info[regno].live_ranges) == NULL |
285 || (p->finish != point && p->finish + 1 != point))) | 284 || (p->finish != point && p->finish + 1 != point))) |
286 lra_reg_info[regno].live_ranges | 285 lra_reg_info[regno].live_ranges |
294 to REGNO. */ | 293 to REGNO. */ |
295 static void | 294 static void |
296 mark_pseudo_dead (int regno, int point) | 295 mark_pseudo_dead (int regno, int point) |
297 { | 296 { |
298 lra_live_range_t p; | 297 lra_live_range_t p; |
298 int ignore_regno = -1; | |
299 int end_regno = -1; | |
299 | 300 |
300 lra_assert (regno >= FIRST_PSEUDO_REGISTER); | 301 lra_assert (regno >= FIRST_PSEUDO_REGISTER); |
301 lra_assert (sparseset_bit_p (pseudos_live, regno)); | 302 lra_assert (sparseset_bit_p (pseudos_live, regno)); |
302 sparseset_clear_bit (pseudos_live, regno); | 303 sparseset_clear_bit (pseudos_live, regno); |
303 sparseset_set_bit (start_dying, regno); | 304 sparseset_set_bit (start_dying, regno); |
305 | |
306 /* Check whether any part of IGNORE_REG_FOR_CONFLICTS already conflicts | |
307 with REGNO. */ | |
308 if (ignore_reg_for_conflicts != NULL_RTX | |
309 && REGNO (ignore_reg_for_conflicts) < FIRST_PSEUDO_REGISTER) | |
310 { | |
311 end_regno = END_REGNO (ignore_reg_for_conflicts); | |
312 int src_regno = ignore_regno = REGNO (ignore_reg_for_conflicts); | |
313 | |
314 while (src_regno < end_regno) | |
315 { | |
316 if (TEST_HARD_REG_BIT (lra_reg_info[regno].conflict_hard_regs, | |
317 src_regno)) | |
318 { | |
319 ignore_regno = end_regno = -1; | |
320 break; | |
321 } | |
322 src_regno++; | |
323 } | |
324 } | |
325 | |
326 IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs, hard_regs_live); | |
327 | |
328 /* If IGNORE_REG_FOR_CONFLICTS did not already conflict with REGNO, make | |
329 sure it still doesn't. */ | |
330 for (; ignore_regno < end_regno; ignore_regno++) | |
331 CLEAR_HARD_REG_BIT (lra_reg_info[regno].conflict_hard_regs, ignore_regno); | |
332 | |
304 if (complete_info_p || lra_get_regno_hard_regno (regno) < 0) | 333 if (complete_info_p || lra_get_regno_hard_regno (regno) < 0) |
305 { | 334 { |
306 p = lra_reg_info[regno].live_ranges; | 335 p = lra_reg_info[regno].live_ranges; |
307 lra_assert (p != NULL); | 336 lra_assert (p != NULL); |
308 p->finish = point; | 337 p->finish = point; |
320 bool changed = false; | 349 bool changed = false; |
321 | 350 |
322 if (regno < FIRST_PSEUDO_REGISTER) | 351 if (regno < FIRST_PSEUDO_REGISTER) |
323 { | 352 { |
324 for (last = end_hard_regno (mode, regno); regno < last; regno++) | 353 for (last = end_hard_regno (mode, regno); regno < last; regno++) |
325 make_hard_regno_born (regno, false); | 354 make_hard_regno_live (regno); |
326 } | 355 } |
327 else | 356 else |
328 { | 357 { |
329 if (! sparseset_bit_p (pseudos_live, regno)) | 358 if (! sparseset_bit_p (pseudos_live, regno)) |
330 { | 359 { |
579 last_call_used_reg_set); | 608 last_call_used_reg_set); |
580 | 609 |
581 for (hr = 0; hr < FIRST_PSEUDO_REGISTER; hr++) | 610 for (hr = 0; hr < FIRST_PSEUDO_REGISTER; hr++) |
582 if (targetm.hard_regno_call_part_clobbered (hr, | 611 if (targetm.hard_regno_call_part_clobbered (hr, |
583 PSEUDO_REGNO_MODE (regno))) | 612 PSEUDO_REGNO_MODE (regno))) |
584 SET_HARD_REG_BIT (lra_reg_info[regno].conflict_hard_regs, hr); | 613 add_to_hard_reg_set (&lra_reg_info[regno].conflict_hard_regs, |
614 PSEUDO_REGNO_MODE (regno), hr); | |
585 lra_reg_info[regno].call_p = true; | 615 lra_reg_info[regno].call_p = true; |
586 if (! sparseset_bit_p (pseudos_live_through_setjumps, regno)) | 616 if (! sparseset_bit_p (pseudos_live_through_setjumps, regno)) |
587 return; | 617 return; |
588 sparseset_clear_bit (pseudos_live_through_setjumps, regno); | 618 sparseset_clear_bit (pseudos_live_through_setjumps, regno); |
589 /* Don't allocate pseudos that cross setjmps or any call, if this | 619 /* Don't allocate pseudos that cross setjmps or any call, if this |
596 alternative. So assume the worst. */ | 626 alternative. So assume the worst. */ |
597 static inline bool | 627 static inline bool |
598 reg_early_clobber_p (const struct lra_insn_reg *reg, int n_alt) | 628 reg_early_clobber_p (const struct lra_insn_reg *reg, int n_alt) |
599 { | 629 { |
600 return (reg->early_clobber | 630 return (reg->early_clobber |
601 && (n_alt < 0 || TEST_BIT (reg->early_clobber_alts, n_alt))); | 631 && (n_alt == LRA_UNKNOWN_ALT |
632 || (n_alt != LRA_NON_CLOBBERED_ALT | |
633 && TEST_BIT (reg->early_clobber_alts, n_alt)))); | |
602 } | 634 } |
603 | 635 |
604 /* Process insns of the basic block BB to update pseudo live ranges, | 636 /* Process insns of the basic block BB to update pseudo live ranges, |
605 pseudo hard register conflicts, and insn notes. We do it on | 637 pseudo hard register conflicts, and insn notes. We do it on |
606 backward scan of BB insns. CURR_POINT is the program point where | 638 backward scan of BB insns. CURR_POINT is the program point where |
653 FOR_BB_INSNS_REVERSE_SAFE (bb, curr_insn, next) | 685 FOR_BB_INSNS_REVERSE_SAFE (bb, curr_insn, next) |
654 { | 686 { |
655 bool call_p; | 687 bool call_p; |
656 int n_alt, dst_regno, src_regno; | 688 int n_alt, dst_regno, src_regno; |
657 rtx set; | 689 rtx set; |
658 struct lra_insn_reg *reg; | 690 struct lra_insn_reg *reg, *hr; |
659 | 691 |
660 if (!NONDEBUG_INSN_P (curr_insn)) | 692 if (!NONDEBUG_INSN_P (curr_insn)) |
661 continue; | 693 continue; |
662 | 694 |
663 curr_id = lra_get_insn_recog_data (curr_insn); | 695 curr_id = lra_get_insn_recog_data (curr_insn); |
685 { | 717 { |
686 remove_p = false; | 718 remove_p = false; |
687 break; | 719 break; |
688 } | 720 } |
689 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) | 721 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) |
690 if (reg->type != OP_IN) | 722 if (reg->type != OP_IN && !reg->clobber_high) |
691 { | 723 { |
692 remove_p = false; | 724 remove_p = false; |
693 break; | 725 break; |
694 } | 726 } |
727 | |
695 if (remove_p && ! volatile_refs_p (PATTERN (curr_insn))) | 728 if (remove_p && ! volatile_refs_p (PATTERN (curr_insn))) |
696 { | 729 { |
697 dst_regno = REGNO (SET_DEST (set)); | 730 dst_regno = REGNO (SET_DEST (set)); |
698 if (lra_dump_file != NULL) | 731 if (lra_dump_file != NULL) |
699 fprintf (lra_dump_file, " Deleting dead insn %u\n", | 732 fprintf (lra_dump_file, " Deleting dead insn %u\n", |
740 = GET_MODE (regno_reg_rtx[regno + i]); | 773 = GET_MODE (regno_reg_rtx[regno + i]); |
741 } | 774 } |
742 } | 775 } |
743 | 776 |
744 call_p = CALL_P (curr_insn); | 777 call_p = CALL_P (curr_insn); |
778 ignore_reg_for_conflicts = non_conflicting_reg_copy_p (curr_insn); | |
745 src_regno = (set != NULL_RTX && REG_P (SET_SRC (set)) | 779 src_regno = (set != NULL_RTX && REG_P (SET_SRC (set)) |
746 ? REGNO (SET_SRC (set)) : -1); | 780 ? REGNO (SET_SRC (set)) : -1); |
747 dst_regno = (set != NULL_RTX && REG_P (SET_DEST (set)) | 781 dst_regno = (set != NULL_RTX && REG_P (SET_DEST (set)) |
748 ? REGNO (SET_DEST (set)) : -1); | 782 ? REGNO (SET_DEST (set)) : -1); |
749 if (complete_info_p | 783 if (complete_info_p |
807 | 841 |
808 /* Mark each defined value as live. We need to do this for | 842 /* Mark each defined value as live. We need to do this for |
809 unused values because they still conflict with quantities | 843 unused values because they still conflict with quantities |
810 that are live at the time of the definition. */ | 844 that are live at the time of the definition. */ |
811 for (reg = curr_id->regs; reg != NULL; reg = reg->next) | 845 for (reg = curr_id->regs; reg != NULL; reg = reg->next) |
812 if (reg->type != OP_IN) | 846 { |
813 { | 847 if (reg->type != OP_IN) |
814 need_curr_point_incr | 848 { |
815 |= mark_regno_live (reg->regno, reg->biggest_mode, | 849 need_curr_point_incr |
816 curr_point); | 850 |= mark_regno_live (reg->regno, reg->biggest_mode, |
817 check_pseudos_live_through_calls (reg->regno, | 851 curr_point); |
818 last_call_used_reg_set); | 852 check_pseudos_live_through_calls (reg->regno, |
819 } | 853 last_call_used_reg_set); |
854 } | |
855 | |
856 if (reg->regno >= FIRST_PSEUDO_REGISTER) | |
857 for (hr = curr_static_id->hard_regs; hr != NULL; hr = hr->next) | |
858 if (hr->clobber_high | |
859 && maybe_gt (GET_MODE_SIZE (PSEUDO_REGNO_MODE (reg->regno)), | |
860 GET_MODE_SIZE (hr->biggest_mode))) | |
861 SET_HARD_REG_BIT (lra_reg_info[reg->regno].conflict_hard_regs, | |
862 hr->regno); | |
863 } | |
820 | 864 |
821 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) | 865 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) |
822 if (reg->type != OP_IN) | 866 if (reg->type != OP_IN) |
823 make_hard_regno_born (reg->regno, false); | 867 make_hard_regno_live (reg->regno); |
824 | 868 |
825 if (curr_id->arg_hard_regs != NULL) | 869 if (curr_id->arg_hard_regs != NULL) |
826 for (i = 0; (regno = curr_id->arg_hard_regs[i]) >= 0; i++) | 870 for (i = 0; (regno = curr_id->arg_hard_regs[i]) >= 0; i++) |
827 if (regno >= FIRST_PSEUDO_REGISTER) | 871 if (regno >= FIRST_PSEUDO_REGISTER) |
828 /* It is a clobber. */ | 872 /* It is a clobber. */ |
829 make_hard_regno_born (regno - FIRST_PSEUDO_REGISTER, false); | 873 make_hard_regno_live (regno - FIRST_PSEUDO_REGISTER); |
830 | 874 |
831 sparseset_copy (unused_set, start_living); | 875 sparseset_copy (unused_set, start_living); |
832 | 876 |
833 sparseset_clear (start_dying); | 877 sparseset_clear (start_dying); |
834 | 878 |
877 } | 921 } |
878 | 922 |
879 sparseset_ior (pseudos_live_through_calls, | 923 sparseset_ior (pseudos_live_through_calls, |
880 pseudos_live_through_calls, pseudos_live); | 924 pseudos_live_through_calls, pseudos_live); |
881 if (cfun->has_nonlocal_label | 925 if (cfun->has_nonlocal_label |
882 || find_reg_note (curr_insn, REG_SETJMP, | 926 || (!targetm.setjmp_preserves_nonvolatile_regs_p () |
883 NULL_RTX) != NULL_RTX) | 927 && (find_reg_note (curr_insn, REG_SETJMP, NULL_RTX) |
928 != NULL_RTX))) | |
884 sparseset_ior (pseudos_live_through_setjumps, | 929 sparseset_ior (pseudos_live_through_setjumps, |
885 pseudos_live_through_setjumps, pseudos_live); | 930 pseudos_live_through_setjumps, pseudos_live); |
886 } | 931 } |
887 | 932 |
888 /* Increment the current program point if we must. */ | 933 /* Increment the current program point if we must. */ |
904 last_call_used_reg_set); | 949 last_call_used_reg_set); |
905 } | 950 } |
906 | 951 |
907 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) | 952 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) |
908 if (reg->type == OP_IN) | 953 if (reg->type == OP_IN) |
909 make_hard_regno_born (reg->regno, false); | 954 make_hard_regno_live (reg->regno); |
910 | 955 |
911 if (curr_id->arg_hard_regs != NULL) | 956 if (curr_id->arg_hard_regs != NULL) |
912 /* Make argument hard registers live. Don't create conflict | 957 /* Make argument hard registers live. */ |
913 of used REAL_PIC_OFFSET_TABLE_REGNUM and the pic pseudo. */ | |
914 for (i = 0; (regno = curr_id->arg_hard_regs[i]) >= 0; i++) | 958 for (i = 0; (regno = curr_id->arg_hard_regs[i]) >= 0; i++) |
915 if (regno < FIRST_PSEUDO_REGISTER) | 959 if (regno < FIRST_PSEUDO_REGISTER) |
916 make_hard_regno_born (regno, true); | 960 make_hard_regno_live (regno); |
917 | 961 |
918 sparseset_and_compl (dead_set, start_living, start_dying); | 962 sparseset_and_compl (dead_set, start_living, start_dying); |
919 | 963 |
920 /* Mark early clobber outputs dead. */ | 964 /* Mark early clobber outputs dead. */ |
921 for (reg = curr_id->regs; reg != NULL; reg = reg->next) | 965 for (reg = curr_id->regs; reg != NULL; reg = reg->next) |
926 curr_point); | 970 curr_point); |
927 | 971 |
928 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) | 972 for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next) |
929 if (reg->type == OP_OUT | 973 if (reg->type == OP_OUT |
930 && reg_early_clobber_p (reg, n_alt) && ! reg->subreg_p) | 974 && reg_early_clobber_p (reg, n_alt) && ! reg->subreg_p) |
931 make_hard_regno_dead (reg->regno); | 975 { |
976 struct lra_insn_reg *reg2; | |
977 | |
978 /* We can have early clobbered non-operand hard reg and | |
979 the same hard reg as an insn input. Don't make hard | |
980 reg dead before the insns. */ | |
981 for (reg2 = curr_id->regs; reg2 != NULL; reg2 = reg2->next) | |
982 if (reg2->type != OP_OUT && reg2->regno == reg->regno) | |
983 break; | |
984 if (reg2 == NULL) | |
985 make_hard_regno_dead (reg->regno); | |
986 } | |
932 | 987 |
933 if (need_curr_point_incr) | 988 if (need_curr_point_incr) |
934 next_program_point (curr_point, freq); | 989 next_program_point (curr_point, freq); |
935 | 990 |
936 /* Update notes. */ | 991 /* Update notes. */ |
960 EXECUTE_IF_SET_IN_SPARSESET (dead_set, j) | 1015 EXECUTE_IF_SET_IN_SPARSESET (dead_set, j) |
961 add_reg_note (curr_insn, REG_DEAD, regno_reg_rtx[j]); | 1016 add_reg_note (curr_insn, REG_DEAD, regno_reg_rtx[j]); |
962 EXECUTE_IF_SET_IN_SPARSESET (unused_set, j) | 1017 EXECUTE_IF_SET_IN_SPARSESET (unused_set, j) |
963 add_reg_note (curr_insn, REG_UNUSED, regno_reg_rtx[j]); | 1018 add_reg_note (curr_insn, REG_UNUSED, regno_reg_rtx[j]); |
964 } | 1019 } |
1020 ignore_reg_for_conflicts = NULL_RTX; | |
965 | 1021 |
966 if (bb_has_eh_pred (bb)) | 1022 if (bb_has_eh_pred (bb)) |
967 for (j = 0; ; ++j) | 1023 for (j = 0; ; ++j) |
968 { | 1024 { |
969 unsigned int regno = EH_RETURN_DATA_REGNO (j); | 1025 unsigned int regno = EH_RETURN_DATA_REGNO (j); |
970 | 1026 |
971 if (regno == INVALID_REGNUM) | 1027 if (regno == INVALID_REGNUM) |
972 break; | 1028 break; |
973 make_hard_regno_born (regno, false); | 1029 make_hard_regno_live (regno); |
974 } | 1030 } |
975 | 1031 |
976 /* Pseudos can't go in stack regs at the start of a basic block that | 1032 /* Pseudos can't go in stack regs at the start of a basic block that |
977 is reached by an abnormal edge. Likewise for call clobbered regs, | 1033 is reached by an abnormal edge. Likewise for call clobbered regs, |
978 because caller-save, fixup_abnormal_edges and possibly the table | 1034 because caller-save, fixup_abnormal_edges and possibly the table |
982 { | 1038 { |
983 #ifdef STACK_REGS | 1039 #ifdef STACK_REGS |
984 EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, px) | 1040 EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, px) |
985 lra_reg_info[px].no_stack_p = true; | 1041 lra_reg_info[px].no_stack_p = true; |
986 for (px = FIRST_STACK_REG; px <= LAST_STACK_REG; px++) | 1042 for (px = FIRST_STACK_REG; px <= LAST_STACK_REG; px++) |
987 make_hard_regno_born (px, false); | 1043 make_hard_regno_live (px); |
988 #endif | 1044 #endif |
989 /* No need to record conflicts for call clobbered regs if we | 1045 /* No need to record conflicts for call clobbered regs if we |
990 have nonlocal labels around, as we don't ever try to | 1046 have nonlocal labels around, as we don't ever try to |
991 allocate such regs in this case. */ | 1047 allocate such regs in this case. */ |
992 if (!cfun->has_nonlocal_label | 1048 if (!cfun->has_nonlocal_label |
1002 || (px == REAL_PIC_OFFSET_TABLE_REGNUM | 1058 || (px == REAL_PIC_OFFSET_TABLE_REGNUM |
1003 && pic_offset_table_rtx != NULL_RTX | 1059 && pic_offset_table_rtx != NULL_RTX |
1004 && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) | 1060 && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) |
1005 #endif | 1061 #endif |
1006 ) | 1062 ) |
1007 make_hard_regno_born (px, false); | 1063 make_hard_regno_live (px); |
1008 } | 1064 } |
1009 | 1065 |
1010 bool live_change_p = false; | 1066 bool live_change_p = false; |
1011 /* Check if bb border live info was changed. */ | 1067 /* Check if bb border live info was changed. */ |
1012 unsigned int live_pseudos_num = 0; | 1068 unsigned int live_pseudos_num = 0; |
1047 break; | 1103 break; |
1048 if (sparseset_bit_p (pseudos_live_through_calls, j)) | 1104 if (sparseset_bit_p (pseudos_live_through_calls, j)) |
1049 check_pseudos_live_through_calls (j, last_call_used_reg_set); | 1105 check_pseudos_live_through_calls (j, last_call_used_reg_set); |
1050 } | 1106 } |
1051 | 1107 |
1108 for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i) | |
1109 { | |
1110 if (!TEST_HARD_REG_BIT (hard_regs_live, i)) | |
1111 continue; | |
1112 | |
1113 if (!TEST_HARD_REG_BIT (hard_regs_spilled_into, i)) | |
1114 continue; | |
1115 | |
1116 if (bitmap_bit_p (df_get_live_in (bb), i)) | |
1117 continue; | |
1118 | |
1119 live_change_p = true; | |
1120 if (lra_dump_file) | |
1121 fprintf (lra_dump_file, | |
1122 " hard reg r%d is added to live at bb%d start\n", i, | |
1123 bb->index); | |
1124 bitmap_set_bit (df_get_live_in (bb), i); | |
1125 } | |
1126 | |
1052 if (need_curr_point_incr) | 1127 if (need_curr_point_incr) |
1053 next_program_point (curr_point, freq); | 1128 next_program_point (curr_point, freq); |
1054 | 1129 |
1055 return live_change_p; | 1130 return live_change_p; |
1056 } | 1131 } |
1107 prev_dead_p = dead_p; | 1182 prev_dead_p = dead_p; |
1108 } | 1183 } |
1109 n++; | 1184 n++; |
1110 if (lra_dump_file != NULL) | 1185 if (lra_dump_file != NULL) |
1111 fprintf (lra_dump_file, "Compressing live ranges: from %d to %d - %d%%\n", | 1186 fprintf (lra_dump_file, "Compressing live ranges: from %d to %d - %d%%\n", |
1112 lra_live_max_point, n, 100 * n / lra_live_max_point); | 1187 lra_live_max_point, n, |
1188 lra_live_max_point ? 100 * n / lra_live_max_point : 100); | |
1113 if (n < lra_live_max_point) | 1189 if (n < lra_live_max_point) |
1114 { | 1190 { |
1115 lra_live_max_point = n; | 1191 lra_live_max_point = n; |
1116 for (i = FIRST_PSEUDO_REGISTER; i < (unsigned) max_regno; i++) | 1192 for (i = FIRST_PSEUDO_REGISTER; i < (unsigned) max_regno; i++) |
1117 { | 1193 { |
1316 bitmap_clear_range (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, | 1392 bitmap_clear_range (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, |
1317 max_regno - FIRST_PSEUDO_REGISTER); | 1393 max_regno - FIRST_PSEUDO_REGISTER); |
1318 } | 1394 } |
1319 /* As we did not change CFG since LRA start we can use | 1395 /* As we did not change CFG since LRA start we can use |
1320 DF-infrastructure solver to solve live data flow problem. */ | 1396 DF-infrastructure solver to solve live data flow problem. */ |
1397 for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i) | |
1398 { | |
1399 if (TEST_HARD_REG_BIT (hard_regs_spilled_into, i)) | |
1400 bitmap_clear_bit (&all_hard_regs_bitmap, i); | |
1401 } | |
1321 df_simple_dataflow | 1402 df_simple_dataflow |
1322 (DF_BACKWARD, NULL, live_con_fun_0, live_con_fun_n, | 1403 (DF_BACKWARD, NULL, live_con_fun_0, live_con_fun_n, |
1323 live_trans_fun, &all_blocks, | 1404 live_trans_fun, &all_blocks, |
1324 df_get_postorder (DF_BACKWARD), df_get_n_blocks (DF_BACKWARD)); | 1405 df_get_postorder (DF_BACKWARD), df_get_n_blocks (DF_BACKWARD)); |
1325 if (lra_dump_file != NULL) | 1406 if (lra_dump_file != NULL) |