Mercurial > hg > CbC > CbC_gcc
comparison gcc/ira-lives.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | 855418dad1a3 |
children | b7f97abdc517 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
232 != LIM_REG_CLASSES; | 232 != LIM_REG_CLASSES; |
233 i++) | 233 i++) |
234 if (high_pressure_start_point[cl] >= 0 | 234 if (high_pressure_start_point[cl] >= 0 |
235 && curr_reg_pressure[cl] <= ira_available_class_regs[cl]) | 235 && curr_reg_pressure[cl] <= ira_available_class_regs[cl]) |
236 high_pressure_start_point[cl] = -1; | 236 high_pressure_start_point[cl] = -1; |
237 | 237 |
238 } | 238 } |
239 } | 239 } |
240 sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (a)); | 240 sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (a)); |
241 } | 241 } |
242 | 242 |
414 { | 414 { |
415 ira_allocno_t a; | 415 ira_allocno_t a; |
416 | 416 |
417 if (GET_CODE (reg) == SUBREG) | 417 if (GET_CODE (reg) == SUBREG) |
418 reg = SUBREG_REG (reg); | 418 reg = SUBREG_REG (reg); |
419 | 419 |
420 if (! REG_P (reg) || REGNO (reg) < FIRST_PSEUDO_REGISTER) | 420 if (! REG_P (reg) || REGNO (reg) < FIRST_PSEUDO_REGISTER) |
421 return advance_p; | 421 return advance_p; |
422 | 422 |
423 a = ira_curr_regno_allocno_map[REGNO (reg)]; | 423 a = ira_curr_regno_allocno_map[REGNO (reg)]; |
424 if (! reg_classes_intersect_p (cl, ALLOCNO_COVER_CLASS (a))) | 424 if (! reg_classes_intersect_p (cl, ALLOCNO_COVER_CLASS (a))) |
425 return advance_p; | 425 return advance_p; |
426 | 426 |
427 if (advance_p) | 427 if (advance_p) |
445 int use, enum reg_class use_cl, | 445 int use, enum reg_class use_cl, |
446 bool advance_p) | 446 bool advance_p) |
447 { | 447 { |
448 if (! reg_classes_intersect_p (def_cl, use_cl)) | 448 if (! reg_classes_intersect_p (def_cl, use_cl)) |
449 return advance_p; | 449 return advance_p; |
450 | 450 |
451 advance_p = make_pseudo_conflict (recog_data.operand[use], | 451 advance_p = make_pseudo_conflict (recog_data.operand[use], |
452 use_cl, dreg, advance_p); | 452 use_cl, dreg, advance_p); |
453 /* Reload may end up swapping commutative operands, so you | 453 /* Reload may end up swapping commutative operands, so you |
454 have to take both orderings into account. The | 454 have to take both orderings into account. The |
455 constraints for the two operands can be completely | 455 constraints for the two operands can be completely |
478 int use, use_match; | 478 int use, use_match; |
479 ira_allocno_t a; | 479 ira_allocno_t a; |
480 enum reg_class use_cl, acl; | 480 enum reg_class use_cl, acl; |
481 bool advance_p; | 481 bool advance_p; |
482 rtx dreg = recog_data.operand[def]; | 482 rtx dreg = recog_data.operand[def]; |
483 | 483 |
484 if (def_cl == NO_REGS) | 484 if (def_cl == NO_REGS) |
485 return; | 485 return; |
486 | 486 |
487 if (GET_CODE (dreg) == SUBREG) | 487 if (GET_CODE (dreg) == SUBREG) |
488 dreg = SUBREG_REG (dreg); | 488 dreg = SUBREG_REG (dreg); |
489 | 489 |
490 if (! REG_P (dreg) || REGNO (dreg) < FIRST_PSEUDO_REGISTER) | 490 if (! REG_P (dreg) || REGNO (dreg) < FIRST_PSEUDO_REGISTER) |
491 return; | 491 return; |
492 | 492 |
493 a = ira_curr_regno_allocno_map[REGNO (dreg)]; | 493 a = ira_curr_regno_allocno_map[REGNO (dreg)]; |
494 acl = ALLOCNO_COVER_CLASS (a); | 494 acl = ALLOCNO_COVER_CLASS (a); |
495 if (! reg_classes_intersect_p (acl, def_cl)) | 495 if (! reg_classes_intersect_p (acl, def_cl)) |
496 return; | 496 return; |
497 | 497 |
498 advance_p = true; | 498 advance_p = true; |
499 | 499 |
500 for (use = 0; use < recog_data.n_operands; use++) | 500 for (use = 0; use < recog_data.n_operands; use++) |
501 { | 501 { |
502 if (use == def || recog_data.operand_type[use] == OP_OUT) | 502 if (use == def || recog_data.operand_type[use] == OP_OUT) |
503 continue; | 503 continue; |
504 | 504 |
505 if (recog_op_alt[use][alt].anything_ok) | 505 if (recog_op_alt[use][alt].anything_ok) |
506 use_cl = ALL_REGS; | 506 use_cl = ALL_REGS; |
507 else | 507 else |
508 use_cl = recog_op_alt[use][alt].cl; | 508 use_cl = recog_op_alt[use][alt].cl; |
509 | 509 |
510 advance_p = check_and_make_def_use_conflict (dreg, def_cl, use, | 510 advance_p = check_and_make_def_use_conflict (dreg, def_cl, use, |
511 use_cl, advance_p); | 511 use_cl, advance_p); |
512 | 512 |
513 if ((use_match = recog_op_alt[use][alt].matches) >= 0) | 513 if ((use_match = recog_op_alt[use][alt].matches) >= 0) |
514 { | 514 { |
515 if (use_match == def) | 515 if (use_match == def) |
516 continue; | 516 continue; |
517 | 517 |
518 if (recog_op_alt[use_match][alt].anything_ok) | 518 if (recog_op_alt[use_match][alt].anything_ok) |
519 use_cl = ALL_REGS; | 519 use_cl = ALL_REGS; |
520 else | 520 else |
521 use_cl = recog_op_alt[use_match][alt].cl; | 521 use_cl = recog_op_alt[use_match][alt].cl; |
522 advance_p = check_and_make_def_use_conflict (dreg, def_cl, use, | 522 advance_p = check_and_make_def_use_conflict (dreg, def_cl, use, |
571 | 571 |
572 for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++) | 572 for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++) |
573 if (DF_REF_FLAGS_IS_SET (*def_rec, DF_REF_MUST_CLOBBER)) | 573 if (DF_REF_FLAGS_IS_SET (*def_rec, DF_REF_MUST_CLOBBER)) |
574 { | 574 { |
575 rtx dreg = DF_REF_REG (*def_rec); | 575 rtx dreg = DF_REF_REG (*def_rec); |
576 | 576 |
577 if (GET_CODE (dreg) == SUBREG) | 577 if (GET_CODE (dreg) == SUBREG) |
578 dreg = SUBREG_REG (dreg); | 578 dreg = SUBREG_REG (dreg); |
579 if (! REG_P (dreg) || REGNO (dreg) >= FIRST_PSEUDO_REGISTER) | 579 if (! REG_P (dreg) || REGNO (dreg) >= FIRST_PSEUDO_REGISTER) |
580 continue; | 580 continue; |
581 | 581 |
582 /* Hard register clobbers are believed to be early clobber | 582 /* Hard register clobbers are believed to be early clobber |
583 because there is no way to say that non-operand hard | 583 because there is no way to say that non-operand hard |
584 register clobbers are not early ones. */ | 584 register clobbers are not early ones. */ |
585 if (live_p) | 585 if (live_p) |
586 mark_ref_live (*def_rec); | 586 mark_ref_live (*def_rec); |
587 else | 587 else |
588 mark_ref_dead (*def_rec); | 588 mark_ref_dead (*def_rec); |
589 set_p = true; | 589 set_p = true; |
628 || (equiv_const != NULL_RTX && CONSTANT_P (equiv_const))) | 628 || (equiv_const != NULL_RTX && CONSTANT_P (equiv_const))) |
629 return NO_REGS; | 629 return NO_REGS; |
630 break; | 630 break; |
631 | 631 |
632 case 'n': | 632 case 'n': |
633 if (GET_CODE (op) == CONST_INT | 633 if (CONST_INT_P (op) |
634 || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode) | 634 || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode) |
635 || (equiv_const != NULL_RTX | 635 || (equiv_const != NULL_RTX |
636 && (GET_CODE (equiv_const) == CONST_INT | 636 && (CONST_INT_P (equiv_const) |
637 || (GET_CODE (equiv_const) == CONST_DOUBLE | 637 || (GET_CODE (equiv_const) == CONST_DOUBLE |
638 && GET_MODE (equiv_const) == VOIDmode)))) | 638 && GET_MODE (equiv_const) == VOIDmode)))) |
639 return NO_REGS; | 639 return NO_REGS; |
640 break; | 640 break; |
641 | 641 |
642 case 's': | 642 case 's': |
643 if ((CONSTANT_P (op) && GET_CODE (op) != CONST_INT | 643 if ((CONSTANT_P (op) && !CONST_INT_P (op) |
644 && (GET_CODE (op) != CONST_DOUBLE || GET_MODE (op) != VOIDmode)) | 644 && (GET_CODE (op) != CONST_DOUBLE || GET_MODE (op) != VOIDmode)) |
645 || (equiv_const != NULL_RTX | 645 || (equiv_const != NULL_RTX |
646 && CONSTANT_P (equiv_const) | 646 && CONSTANT_P (equiv_const) |
647 && GET_CODE (equiv_const) != CONST_INT | 647 && !CONST_INT_P (equiv_const) |
648 && (GET_CODE (equiv_const) != CONST_DOUBLE | 648 && (GET_CODE (equiv_const) != CONST_DOUBLE |
649 || GET_MODE (equiv_const) != VOIDmode))) | 649 || GET_MODE (equiv_const) != VOIDmode))) |
650 return NO_REGS; | 650 return NO_REGS; |
651 break; | 651 break; |
652 | 652 |
653 case 'I': | 653 case 'I': |
654 case 'J': | 654 case 'J': |
655 case 'K': | 655 case 'K': |
656 case 'L': | 656 case 'L': |
657 case 'M': | 657 case 'M': |
658 case 'N': | 658 case 'N': |
659 case 'O': | 659 case 'O': |
660 case 'P': | 660 case 'P': |
661 if ((GET_CODE (op) == CONST_INT | 661 if ((CONST_INT_P (op) |
662 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, constraints)) | 662 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, constraints)) |
663 || (equiv_const != NULL_RTX | 663 || (equiv_const != NULL_RTX |
664 && GET_CODE (equiv_const) == CONST_INT | 664 && CONST_INT_P (equiv_const) |
665 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (equiv_const), | 665 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (equiv_const), |
666 c, constraints))) | 666 c, constraints))) |
667 return NO_REGS; | 667 return NO_REGS; |
668 break; | 668 break; |
669 | 669 |
670 case 'E': | 670 case 'E': |
671 case 'F': | 671 case 'F': |
672 if (GET_CODE (op) == CONST_DOUBLE | 672 if (GET_CODE (op) == CONST_DOUBLE |
673 || (GET_CODE (op) == CONST_VECTOR | 673 || (GET_CODE (op) == CONST_VECTOR |
674 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT) | 674 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT) |
677 || (GET_CODE (equiv_const) == CONST_VECTOR | 677 || (GET_CODE (equiv_const) == CONST_VECTOR |
678 && (GET_MODE_CLASS (GET_MODE (equiv_const)) | 678 && (GET_MODE_CLASS (GET_MODE (equiv_const)) |
679 == MODE_VECTOR_FLOAT))))) | 679 == MODE_VECTOR_FLOAT))))) |
680 return NO_REGS; | 680 return NO_REGS; |
681 break; | 681 break; |
682 | 682 |
683 case 'G': | 683 case 'G': |
684 case 'H': | 684 case 'H': |
685 if ((GET_CODE (op) == CONST_DOUBLE | 685 if ((GET_CODE (op) == CONST_DOUBLE |
686 && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, constraints)) | 686 && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, constraints)) |
687 || (equiv_const != NULL_RTX | 687 || (equiv_const != NULL_RTX |
700 case 'W': case 'Y': case 'Z': | 700 case 'W': case 'Y': case 'Z': |
701 next_cl = (c == 'r' | 701 next_cl = (c == 'r' |
702 ? GENERAL_REGS | 702 ? GENERAL_REGS |
703 : REG_CLASS_FROM_CONSTRAINT (c, constraints)); | 703 : REG_CLASS_FROM_CONSTRAINT (c, constraints)); |
704 if ((cl != NO_REGS && next_cl != cl) | 704 if ((cl != NO_REGS && next_cl != cl) |
705 || ira_available_class_regs[next_cl] > 1) | 705 || (ira_available_class_regs[next_cl] |
706 > ira_reg_class_nregs[next_cl][GET_MODE (op)])) | |
706 return NO_REGS; | 707 return NO_REGS; |
707 cl = next_cl; | 708 cl = next_cl; |
708 break; | 709 break; |
709 | 710 |
710 case '0': case '1': case '2': case '3': case '4': | 711 case '0': case '1': case '2': case '3': case '4': |
711 case '5': case '6': case '7': case '8': case '9': | 712 case '5': case '6': case '7': case '8': case '9': |
712 next_cl | 713 next_cl |
713 = single_reg_class (recog_data.constraints[c - '0'], | 714 = single_reg_class (recog_data.constraints[c - '0'], |
714 recog_data.operand[c - '0'], NULL_RTX); | 715 recog_data.operand[c - '0'], NULL_RTX); |
715 if ((cl != NO_REGS && next_cl != cl) || next_cl == NO_REGS | 716 if ((cl != NO_REGS && next_cl != cl) |
716 || ira_available_class_regs[next_cl] > 1) | 717 || next_cl == NO_REGS |
718 || (ira_available_class_regs[next_cl] | |
719 > ira_reg_class_nregs[next_cl][GET_MODE (op)])) | |
717 return NO_REGS; | 720 return NO_REGS; |
718 cl = next_cl; | 721 cl = next_cl; |
719 break; | 722 break; |
720 | 723 |
721 default: | 724 default: |
722 return NO_REGS; | 725 return NO_REGS; |
723 } | 726 } |
724 return cl; | 727 return cl; |
725 } | 728 } |
734 return NO_REGS; | 737 return NO_REGS; |
735 return single_reg_class (recog_data.constraints[op_num], | 738 return single_reg_class (recog_data.constraints[op_num], |
736 recog_data.operand[op_num], NULL_RTX); | 739 recog_data.operand[op_num], NULL_RTX); |
737 } | 740 } |
738 | 741 |
742 /* The function sets up hard register set *SET to hard registers which | |
743 might be used by insn reloads because the constraints are too | |
744 strict. */ | |
745 void | |
746 ira_implicitly_set_insn_hard_regs (HARD_REG_SET *set) | |
747 { | |
748 int i, c, regno = 0; | |
749 bool ignore_p; | |
750 enum reg_class cl; | |
751 rtx op; | |
752 enum machine_mode mode; | |
753 | |
754 CLEAR_HARD_REG_SET (*set); | |
755 for (i = 0; i < recog_data.n_operands; i++) | |
756 { | |
757 op = recog_data.operand[i]; | |
758 | |
759 if (GET_CODE (op) == SUBREG) | |
760 op = SUBREG_REG (op); | |
761 | |
762 if (GET_CODE (op) == SCRATCH | |
763 || (REG_P (op) && (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER)) | |
764 { | |
765 const char *p = recog_data.constraints[i]; | |
766 | |
767 mode = (GET_CODE (op) == SCRATCH | |
768 ? GET_MODE (op) : PSEUDO_REGNO_MODE (regno)); | |
769 cl = NO_REGS; | |
770 for (ignore_p = false; (c = *p); p += CONSTRAINT_LEN (c, p)) | |
771 if (c == '#') | |
772 ignore_p = true; | |
773 else if (c == ',') | |
774 ignore_p = false; | |
775 else if (! ignore_p) | |
776 switch (c) | |
777 { | |
778 case 'r': | |
779 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | |
780 case 'h': case 'j': case 'k': case 'l': | |
781 case 'q': case 't': case 'u': | |
782 case 'v': case 'w': case 'x': case 'y': case 'z': | |
783 case 'A': case 'B': case 'C': case 'D': | |
784 case 'Q': case 'R': case 'S': case 'T': case 'U': | |
785 case 'W': case 'Y': case 'Z': | |
786 cl = (c == 'r' | |
787 ? GENERAL_REGS | |
788 : REG_CLASS_FROM_CONSTRAINT (c, p)); | |
789 if (cl != NO_REGS | |
790 && (ira_available_class_regs[cl] | |
791 <= ira_reg_class_nregs[cl][mode])) | |
792 IOR_HARD_REG_SET (*set, reg_class_contents[cl]); | |
793 break; | |
794 } | |
795 } | |
796 } | |
797 } | |
739 /* Processes input operands, if IN_P, or output operands otherwise of | 798 /* Processes input operands, if IN_P, or output operands otherwise of |
740 the current insn with FREQ to find allocno which can use only one | 799 the current insn with FREQ to find allocno which can use only one |
741 hard register and makes other currently living allocnos conflicting | 800 hard register and makes other currently living allocnos conflicting |
742 with the hard register. */ | 801 with the hard register. */ |
743 static void | 802 static void |
744 process_single_reg_class_operands (bool in_p, int freq) | 803 process_single_reg_class_operands (bool in_p, int freq) |
745 { | 804 { |
746 int i, regno, cost; | 805 int i, regno, cost; |
747 unsigned int px; | 806 unsigned int px; |
748 enum reg_class cl, cover_class; | 807 enum reg_class cl; |
749 rtx operand; | 808 rtx operand; |
750 ira_allocno_t operand_a, a; | 809 ira_allocno_t operand_a, a; |
751 | 810 |
752 for (i = 0; i < recog_data.n_operands; i++) | 811 for (i = 0; i < recog_data.n_operands; i++) |
753 { | 812 { |
764 | 823 |
765 operand_a = NULL; | 824 operand_a = NULL; |
766 | 825 |
767 if (GET_CODE (operand) == SUBREG) | 826 if (GET_CODE (operand) == SUBREG) |
768 operand = SUBREG_REG (operand); | 827 operand = SUBREG_REG (operand); |
769 | 828 |
770 if (REG_P (operand) | 829 if (REG_P (operand) |
771 && (regno = REGNO (operand)) >= FIRST_PSEUDO_REGISTER) | 830 && (regno = REGNO (operand)) >= FIRST_PSEUDO_REGISTER) |
772 { | 831 { |
773 enum machine_mode mode; | 832 enum machine_mode mode; |
774 enum reg_class cover_class; | 833 enum reg_class cover_class; |
780 && ira_class_hard_regs_num[cl] != 0 | 839 && ira_class_hard_regs_num[cl] != 0 |
781 && (ira_class_hard_reg_index[cover_class] | 840 && (ira_class_hard_reg_index[cover_class] |
782 [ira_class_hard_regs[cl][0]]) >= 0 | 841 [ira_class_hard_regs[cl][0]]) >= 0 |
783 && reg_class_size[cl] <= (unsigned) CLASS_MAX_NREGS (cl, mode)) | 842 && reg_class_size[cl] <= (unsigned) CLASS_MAX_NREGS (cl, mode)) |
784 { | 843 { |
844 int i, size; | |
785 cost | 845 cost |
786 = (freq | 846 = (freq |
787 * (in_p | 847 * (in_p |
788 ? ira_get_register_move_cost (mode, cover_class, cl) | 848 ? ira_get_register_move_cost (mode, cover_class, cl) |
789 : ira_get_register_move_cost (mode, cl, cover_class))); | 849 : ira_get_register_move_cost (mode, cl, cover_class))); |
790 ira_allocate_and_set_costs | 850 ira_allocate_and_set_costs |
791 (&ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a), cover_class, 0); | 851 (&ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a), cover_class, 0); |
792 ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a) | 852 size = ira_reg_class_nregs[cover_class][mode]; |
793 [ira_class_hard_reg_index | 853 for (i = 0; i < size; i++) |
794 [cover_class][ira_class_hard_regs[cl][0]]] | 854 ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a) |
795 -= cost; | 855 [ira_class_hard_reg_index |
856 [cover_class][ira_class_hard_regs[cl][i]]] | |
857 -= cost; | |
796 } | 858 } |
797 } | 859 } |
798 | 860 |
799 EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, px) | 861 EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, px) |
800 { | 862 { |
801 a = ira_allocnos[px]; | 863 a = ira_allocnos[px]; |
802 cover_class = ALLOCNO_COVER_CLASS (a); | |
803 if (a != operand_a) | 864 if (a != operand_a) |
804 { | 865 { |
805 /* We could increase costs of A instead of making it | 866 /* We could increase costs of A instead of making it |
806 conflicting with the hard register. But it works worse | 867 conflicting with the hard register. But it works worse |
807 because it will be spilled in reload in anyway. */ | 868 because it will be spilled in reload in anyway. */ |
812 } | 873 } |
813 } | 874 } |
814 } | 875 } |
815 } | 876 } |
816 | 877 |
878 /* Return true when one of the predecessor edges of BB is marked with | |
879 EDGE_ABNORMAL_CALL or EDGE_EH. */ | |
880 static bool | |
881 bb_has_abnormal_call_pred (basic_block bb) | |
882 { | |
883 edge e; | |
884 edge_iterator ei; | |
885 | |
886 FOR_EACH_EDGE (e, ei, bb->preds) | |
887 { | |
888 if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)) | |
889 return true; | |
890 } | |
891 return false; | |
892 } | |
893 | |
817 /* Process insns of the basic block given by its LOOP_TREE_NODE to | 894 /* Process insns of the basic block given by its LOOP_TREE_NODE to |
818 update allocno live ranges, allocno hard register conflicts, | 895 update allocno live ranges, allocno hard register conflicts, |
819 intersected calls, and register pressure info for allocnos for the | 896 intersected calls, and register pressure info for allocnos for the |
820 basic block for and regions containing the basic block. */ | 897 basic block for and regions containing the basic block. */ |
821 static void | 898 static void |
846 AND_COMPL_HARD_REG_SET (hard_regs_live, ira_no_alloc_regs); | 923 AND_COMPL_HARD_REG_SET (hard_regs_live, ira_no_alloc_regs); |
847 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) | 924 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) |
848 if (TEST_HARD_REG_BIT (hard_regs_live, i)) | 925 if (TEST_HARD_REG_BIT (hard_regs_live, i)) |
849 { | 926 { |
850 enum reg_class cover_class, cl; | 927 enum reg_class cover_class, cl; |
851 | 928 |
852 cover_class = ira_class_translate[REGNO_REG_CLASS (i)]; | 929 cover_class = ira_class_translate[REGNO_REG_CLASS (i)]; |
853 for (j = 0; | 930 for (j = 0; |
854 (cl = ira_reg_class_super_classes[cover_class][j]) | 931 (cl = ira_reg_class_super_classes[cover_class][j]) |
855 != LIM_REG_CLASSES; | 932 != LIM_REG_CLASSES; |
856 j++) | 933 j++) |
863 } | 940 } |
864 } | 941 } |
865 EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi) | 942 EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi) |
866 { | 943 { |
867 ira_allocno_t a = ira_curr_regno_allocno_map[j]; | 944 ira_allocno_t a = ira_curr_regno_allocno_map[j]; |
868 | 945 |
869 if (a == NULL) | 946 if (a == NULL) |
870 continue; | 947 continue; |
871 ira_assert (! sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a))); | 948 ira_assert (! sparseset_bit_p (allocnos_live, ALLOCNO_NUM (a))); |
872 set_allocno_live (a); | 949 set_allocno_live (a); |
873 make_regno_born (j); | 950 make_regno_born (j); |
874 } | 951 } |
875 | 952 |
876 freq = REG_FREQ_FROM_BB (bb); | 953 freq = REG_FREQ_FROM_BB (bb); |
877 if (freq == 0) | 954 if (freq == 0) |
878 freq = 1; | 955 freq = 1; |
879 | 956 |
880 /* Invalidate all allocno_saved_at_call entries. */ | 957 /* Invalidate all allocno_saved_at_call entries. */ |
891 pessimistic, but it probably doesn't matter much in practice. */ | 968 pessimistic, but it probably doesn't matter much in practice. */ |
892 FOR_BB_INSNS_REVERSE (bb, insn) | 969 FOR_BB_INSNS_REVERSE (bb, insn) |
893 { | 970 { |
894 df_ref *def_rec, *use_rec; | 971 df_ref *def_rec, *use_rec; |
895 bool call_p; | 972 bool call_p; |
896 | 973 |
897 if (! INSN_P (insn)) | 974 if (!NONDEBUG_INSN_P (insn)) |
898 continue; | 975 continue; |
899 | 976 |
900 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 977 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) |
901 fprintf (ira_dump_file, " Insn %u(l%d): point = %d\n", | 978 fprintf (ira_dump_file, " Insn %u(l%d): point = %d\n", |
902 INSN_UID (insn), loop_tree_node->parent->loop->num, | 979 INSN_UID (insn), loop_tree_node->parent->loop->num, |
903 curr_point); | 980 curr_point); |
904 | 981 |
947 mark_ref_live (*use_rec); | 1024 mark_ref_live (*use_rec); |
948 break; | 1025 break; |
949 } | 1026 } |
950 } | 1027 } |
951 } | 1028 } |
952 | 1029 |
953 extract_insn (insn); | 1030 extract_insn (insn); |
954 preprocess_constraints (); | 1031 preprocess_constraints (); |
955 process_single_reg_class_operands (false, freq); | 1032 process_single_reg_class_operands (false, freq); |
956 | 1033 |
957 /* See which defined values die here. */ | 1034 /* See which defined values die here. */ |
958 for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++) | 1035 for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++) |
959 if (!call_p || !DF_REF_FLAGS_IS_SET (*def_rec, DF_REF_MAY_CLOBBER)) | 1036 if (!call_p || !DF_REF_FLAGS_IS_SET (*def_rec, DF_REF_MAY_CLOBBER)) |
960 mark_ref_dead (*def_rec); | 1037 mark_ref_dead (*def_rec); |
961 | 1038 |
964 last_call_num++; | 1041 last_call_num++; |
965 /* The current set of live allocnos are live across the call. */ | 1042 /* The current set of live allocnos are live across the call. */ |
966 EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i) | 1043 EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i) |
967 { | 1044 { |
968 ira_allocno_t a = ira_allocnos[i]; | 1045 ira_allocno_t a = ira_allocnos[i]; |
969 | 1046 |
970 if (allocno_saved_at_call[i] != last_call_num) | 1047 if (allocno_saved_at_call[i] != last_call_num) |
971 /* Here we are mimicking caller-save.c behaviour | 1048 /* Here we are mimicking caller-save.c behaviour |
972 which does not save hard register at a call if | 1049 which does not save hard register at a call if |
973 it was saved on previous call in the same basic | 1050 it was saved on previous call in the same basic |
974 block and the hard register was not mentioned | 1051 block and the hard register was not mentioned |
994 IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a), | 1071 IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a), |
995 call_used_reg_set); | 1072 call_used_reg_set); |
996 } | 1073 } |
997 } | 1074 } |
998 } | 1075 } |
999 | 1076 |
1000 make_early_clobber_and_input_conflicts (); | 1077 make_early_clobber_and_input_conflicts (); |
1001 | 1078 |
1002 curr_point++; | 1079 curr_point++; |
1003 | 1080 |
1004 /* Mark each used value as live. */ | 1081 /* Mark each used value as live. */ |
1005 for (use_rec = DF_INSN_USES (insn); *use_rec; use_rec++) | 1082 for (use_rec = DF_INSN_USES (insn); *use_rec; use_rec++) |
1006 mark_ref_live (*use_rec); | 1083 mark_ref_live (*use_rec); |
1007 | 1084 |
1008 process_single_reg_class_operands (true, freq); | 1085 process_single_reg_class_operands (true, freq); |
1009 | 1086 |
1010 set_p = mark_hard_reg_early_clobbers (insn, true); | 1087 set_p = mark_hard_reg_early_clobbers (insn, true); |
1011 | 1088 |
1012 if (set_p) | 1089 if (set_p) |
1013 { | 1090 { |
1014 mark_hard_reg_early_clobbers (insn, false); | 1091 mark_hard_reg_early_clobbers (insn, false); |
1017 hard register can be in clobber and in an insn | 1094 hard register can be in clobber and in an insn |
1018 input. */ | 1095 input. */ |
1019 for (use_rec = DF_INSN_USES (insn); *use_rec; use_rec++) | 1096 for (use_rec = DF_INSN_USES (insn); *use_rec; use_rec++) |
1020 { | 1097 { |
1021 rtx ureg = DF_REF_REG (*use_rec); | 1098 rtx ureg = DF_REF_REG (*use_rec); |
1022 | 1099 |
1023 if (GET_CODE (ureg) == SUBREG) | 1100 if (GET_CODE (ureg) == SUBREG) |
1024 ureg = SUBREG_REG (ureg); | 1101 ureg = SUBREG_REG (ureg); |
1025 if (! REG_P (ureg) || REGNO (ureg) >= FIRST_PSEUDO_REGISTER) | 1102 if (! REG_P (ureg) || REGNO (ureg) >= FIRST_PSEUDO_REGISTER) |
1026 continue; | 1103 continue; |
1027 | 1104 |
1028 mark_ref_live (*use_rec); | 1105 mark_ref_live (*use_rec); |
1029 } | 1106 } |
1030 } | 1107 } |
1031 | 1108 |
1032 curr_point++; | 1109 curr_point++; |
1060 make_regno_born (px); | 1137 make_regno_born (px); |
1061 #endif | 1138 #endif |
1062 /* No need to record conflicts for call clobbered regs if we | 1139 /* No need to record conflicts for call clobbered regs if we |
1063 have nonlocal labels around, as we don't ever try to | 1140 have nonlocal labels around, as we don't ever try to |
1064 allocate such regs in this case. */ | 1141 allocate such regs in this case. */ |
1065 if (!cfun->has_nonlocal_label) | 1142 if (!cfun->has_nonlocal_label && bb_has_abnormal_call_pred (bb)) |
1066 for (px = 0; px < FIRST_PSEUDO_REGISTER; px++) | 1143 for (px = 0; px < FIRST_PSEUDO_REGISTER; px++) |
1067 if (call_used_regs[px]) | 1144 if (call_used_regs[px]) |
1068 make_regno_born (px); | 1145 make_regno_born (px); |
1069 } | 1146 } |
1070 | 1147 |
1143 ira_allocno_t a; | 1220 ira_allocno_t a; |
1144 ira_allocno_iterator ai; | 1221 ira_allocno_iterator ai; |
1145 allocno_live_range_t r; | 1222 allocno_live_range_t r; |
1146 bitmap born_or_died; | 1223 bitmap born_or_died; |
1147 bitmap_iterator bi; | 1224 bitmap_iterator bi; |
1148 | 1225 |
1149 born_or_died = ira_allocate_bitmap (); | 1226 born_or_died = ira_allocate_bitmap (); |
1150 FOR_EACH_ALLOCNO (a, ai) | 1227 FOR_EACH_ALLOCNO (a, ai) |
1151 { | 1228 { |
1152 for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next) | 1229 for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next) |
1153 { | 1230 { |