Mercurial > hg > CbC > CbC_gcc
comparison gcc/ira-emit.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
321 setup_entered_from_non_parent_p (void) | 321 setup_entered_from_non_parent_p (void) |
322 { | 322 { |
323 unsigned int i; | 323 unsigned int i; |
324 loop_p loop; | 324 loop_p loop; |
325 | 325 |
326 for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++) | 326 FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop) |
327 if (ira_loop_nodes[i].regno_allocno_map != NULL) | 327 if (ira_loop_nodes[i].regno_allocno_map != NULL) |
328 ira_loop_nodes[i].entered_from_non_parent_p | 328 ira_loop_nodes[i].entered_from_non_parent_p |
329 = entered_from_non_parent_p (&ira_loop_nodes[i]); | 329 = entered_from_non_parent_p (&ira_loop_nodes[i]); |
330 } | 330 } |
331 | 331 |
365 solving a data-flow problem. Unfortunately such global | 365 solving a data-flow problem. Unfortunately such global |
366 solution would complicate IR flattening. Therefore we just | 366 solution would complicate IR flattening. Therefore we just |
367 prohibit removal of the store in such complicated case. */ | 367 prohibit removal of the store in such complicated case. */ |
368 return false; | 368 return false; |
369 } | 369 } |
370 gcc_unreachable (); | 370 /* It is actually a loop entry -- do not remove the store. */ |
371 return false; | |
371 } | 372 } |
372 | 373 |
373 /* Generate and attach moves to the edge E. This looks at the final | 374 /* Generate and attach moves to the edge E. This looks at the final |
374 regnos of allocnos living on the edge with the same original regno | 375 regnos of allocnos living on the edge with the same original regno |
375 to figure out when moves should be generated. */ | 376 to figure out when moves should be generated. */ |
519 { | 520 { |
520 allocno = ira_allocnos[i]; | 521 allocno = ira_allocnos[i]; |
521 regno = ALLOCNO_REGNO (allocno); | 522 regno = ALLOCNO_REGNO (allocno); |
522 if (ALLOCNO_CAP_MEMBER (allocno) != NULL) | 523 if (ALLOCNO_CAP_MEMBER (allocno) != NULL) |
523 continue; | 524 continue; |
524 used_p = bitmap_bit_p (used_regno_bitmap, regno); | 525 used_p = !bitmap_set_bit (used_regno_bitmap, regno); |
525 bitmap_set_bit (used_regno_bitmap, regno); | |
526 ALLOCNO_SOMEWHERE_RENAMED_P (allocno) = true; | 526 ALLOCNO_SOMEWHERE_RENAMED_P (allocno) = true; |
527 if (! used_p) | 527 if (! used_p) |
528 continue; | 528 continue; |
529 bitmap_set_bit (renamed_regno_bitmap, regno); | 529 bitmap_set_bit (renamed_regno_bitmap, regno); |
530 set_allocno_reg (allocno, create_new_reg (ALLOCNO_REG (allocno))); | 530 set_allocno_reg (allocno, create_new_reg (ALLOCNO_REG (allocno))); |
644 result move list. */ | 644 result move list. */ |
645 static move_t | 645 static move_t |
646 modify_move_list (move_t list) | 646 modify_move_list (move_t list) |
647 { | 647 { |
648 int i, n, nregs, hard_regno; | 648 int i, n, nregs, hard_regno; |
649 ira_allocno_t to, from, new_allocno; | 649 ira_allocno_t to, from; |
650 move_t move, new_move, set_move, first, last; | 650 move_t move, new_move, set_move, first, last; |
651 | 651 |
652 if (list == NULL) | 652 if (list == NULL) |
653 return NULL; | 653 return NULL; |
654 /* Creat move deps. */ | 654 /* Creat move deps. */ |
713 for (i = 0; i < nregs; i++) | 713 for (i = 0; i < nregs; i++) |
714 if (hard_regno_last_set_check[hard_regno + i] == curr_tick | 714 if (hard_regno_last_set_check[hard_regno + i] == curr_tick |
715 && ALLOCNO_HARD_REGNO | 715 && ALLOCNO_HARD_REGNO |
716 (hard_regno_last_set[hard_regno + i]->to) >= 0) | 716 (hard_regno_last_set[hard_regno + i]->to) >= 0) |
717 { | 717 { |
718 int n, j; | |
719 ira_allocno_t new_allocno; | |
720 | |
718 set_move = hard_regno_last_set[hard_regno + i]; | 721 set_move = hard_regno_last_set[hard_regno + i]; |
719 /* It does not matter what loop_tree_node (of TO or | 722 /* It does not matter what loop_tree_node (of TO or |
720 FROM) to use for the new allocno because of | 723 FROM) to use for the new allocno because of |
721 subsequent IRA internal representation | 724 subsequent IRA internal representation |
722 flattening. */ | 725 flattening. */ |
724 = ira_create_allocno (ALLOCNO_REGNO (set_move->to), false, | 727 = ira_create_allocno (ALLOCNO_REGNO (set_move->to), false, |
725 ALLOCNO_LOOP_TREE_NODE (set_move->to)); | 728 ALLOCNO_LOOP_TREE_NODE (set_move->to)); |
726 ALLOCNO_MODE (new_allocno) = ALLOCNO_MODE (set_move->to); | 729 ALLOCNO_MODE (new_allocno) = ALLOCNO_MODE (set_move->to); |
727 ira_set_allocno_cover_class | 730 ira_set_allocno_cover_class |
728 (new_allocno, ALLOCNO_COVER_CLASS (set_move->to)); | 731 (new_allocno, ALLOCNO_COVER_CLASS (set_move->to)); |
732 ira_create_allocno_objects (new_allocno); | |
729 ALLOCNO_ASSIGNED_P (new_allocno) = true; | 733 ALLOCNO_ASSIGNED_P (new_allocno) = true; |
730 ALLOCNO_HARD_REGNO (new_allocno) = -1; | 734 ALLOCNO_HARD_REGNO (new_allocno) = -1; |
731 ALLOCNO_REG (new_allocno) | 735 ALLOCNO_REG (new_allocno) |
732 = create_new_reg (ALLOCNO_REG (set_move->to)); | 736 = create_new_reg (ALLOCNO_REG (set_move->to)); |
733 ALLOCNO_CONFLICT_ID (new_allocno) = ALLOCNO_NUM (new_allocno); | 737 |
734 /* Make it possibly conflicting with all earlier | 738 /* Make it possibly conflicting with all earlier |
735 created allocnos. Cases where temporary allocnos | 739 created allocnos. Cases where temporary allocnos |
736 created to remove the cycles are quite rare. */ | 740 created to remove the cycles are quite rare. */ |
737 ALLOCNO_MIN (new_allocno) = 0; | 741 n = ALLOCNO_NUM_OBJECTS (new_allocno); |
738 ALLOCNO_MAX (new_allocno) = ira_allocnos_num - 1; | 742 gcc_assert (n == ALLOCNO_NUM_OBJECTS (set_move->to)); |
743 for (j = 0; j < n; j++) | |
744 { | |
745 ira_object_t new_obj = ALLOCNO_OBJECT (new_allocno, j); | |
746 | |
747 OBJECT_MIN (new_obj) = 0; | |
748 OBJECT_MAX (new_obj) = ira_objects_num - 1; | |
749 } | |
750 | |
739 new_move = create_move (set_move->to, new_allocno); | 751 new_move = create_move (set_move->to, new_allocno); |
740 set_move->to = new_allocno; | 752 set_move->to = new_allocno; |
741 VEC_safe_push (move_t, heap, move_vec, new_move); | 753 VEC_safe_push (move_t, heap, move_vec, new_move); |
742 ira_move_loops_num++; | 754 ira_move_loops_num++; |
743 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 755 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) |
909 bitmap live_through, int freq) | 921 bitmap live_through, int freq) |
910 { | 922 { |
911 int start, n; | 923 int start, n; |
912 unsigned int regno; | 924 unsigned int regno; |
913 move_t move; | 925 move_t move; |
914 ira_allocno_t to, from, a; | 926 ira_allocno_t a; |
915 ira_copy_t cp; | 927 ira_copy_t cp; |
916 allocno_live_range_t r; | 928 live_range_t r; |
917 bitmap_iterator bi; | 929 bitmap_iterator bi; |
918 HARD_REG_SET hard_regs_live; | 930 HARD_REG_SET hard_regs_live; |
919 | 931 |
920 if (list == NULL) | 932 if (list == NULL) |
921 return; | 933 return; |
927 the old ones. */ | 939 the old ones. */ |
928 ira_max_point++; | 940 ira_max_point++; |
929 start = ira_max_point; | 941 start = ira_max_point; |
930 for (move = list; move != NULL; move = move->next) | 942 for (move = list; move != NULL; move = move->next) |
931 { | 943 { |
932 from = move->from; | 944 ira_allocno_t from = move->from; |
933 to = move->to; | 945 ira_allocno_t to = move->to; |
934 if (ALLOCNO_CONFLICT_ALLOCNO_ARRAY (to) == NULL) | 946 int nr, i; |
935 { | 947 |
936 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | |
937 fprintf (ira_dump_file, " Allocate conflicts for a%dr%d\n", | |
938 ALLOCNO_NUM (to), REGNO (ALLOCNO_REG (to))); | |
939 ira_allocate_allocno_conflicts (to, n); | |
940 } | |
941 bitmap_clear_bit (live_through, ALLOCNO_REGNO (from)); | 948 bitmap_clear_bit (live_through, ALLOCNO_REGNO (from)); |
942 bitmap_clear_bit (live_through, ALLOCNO_REGNO (to)); | 949 bitmap_clear_bit (live_through, ALLOCNO_REGNO (to)); |
943 IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (from), hard_regs_live); | 950 |
944 IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (to), hard_regs_live); | 951 nr = ALLOCNO_NUM_OBJECTS (to); |
945 IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (from), | 952 for (i = 0; i < nr; i++) |
946 hard_regs_live); | 953 { |
947 IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (to), hard_regs_live); | 954 ira_object_t to_obj = ALLOCNO_OBJECT (to, i); |
955 if (OBJECT_CONFLICT_ARRAY (to_obj) == NULL) | |
956 { | |
957 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | |
958 fprintf (ira_dump_file, " Allocate conflicts for a%dr%d\n", | |
959 ALLOCNO_NUM (to), REGNO (ALLOCNO_REG (to))); | |
960 ira_allocate_object_conflicts (to_obj, n); | |
961 } | |
962 } | |
963 ior_hard_reg_conflicts (from, &hard_regs_live); | |
964 ior_hard_reg_conflicts (to, &hard_regs_live); | |
965 | |
948 update_costs (from, true, freq); | 966 update_costs (from, true, freq); |
949 update_costs (to, false, freq); | 967 update_costs (to, false, freq); |
950 cp = ira_add_allocno_copy (from, to, freq, false, move->insn, NULL); | 968 cp = ira_add_allocno_copy (from, to, freq, false, move->insn, NULL); |
951 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 969 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) |
952 fprintf (ira_dump_file, " Adding cp%d:a%dr%d-a%dr%d\n", | 970 fprintf (ira_dump_file, " Adding cp%d:a%dr%d-a%dr%d\n", |
953 cp->num, ALLOCNO_NUM (cp->first), | 971 cp->num, ALLOCNO_NUM (cp->first), |
954 REGNO (ALLOCNO_REG (cp->first)), ALLOCNO_NUM (cp->second), | 972 REGNO (ALLOCNO_REG (cp->first)), ALLOCNO_NUM (cp->second), |
955 REGNO (ALLOCNO_REG (cp->second))); | 973 REGNO (ALLOCNO_REG (cp->second))); |
956 r = ALLOCNO_LIVE_RANGES (from); | 974 |
957 if (r == NULL || r->finish >= 0) | 975 nr = ALLOCNO_NUM_OBJECTS (from); |
958 { | 976 for (i = 0; i < nr; i++) |
959 ALLOCNO_LIVE_RANGES (from) | 977 { |
960 = ira_create_allocno_live_range (from, start, ira_max_point, r); | 978 ira_object_t from_obj = ALLOCNO_OBJECT (from, i); |
961 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 979 r = OBJECT_LIVE_RANGES (from_obj); |
962 fprintf (ira_dump_file, | 980 if (r == NULL || r->finish >= 0) |
963 " Adding range [%d..%d] to allocno a%dr%d\n", | 981 { |
964 start, ira_max_point, ALLOCNO_NUM (from), | 982 ira_add_live_range_to_object (from_obj, start, ira_max_point); |
965 REGNO (ALLOCNO_REG (from))); | 983 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) |
966 } | 984 fprintf (ira_dump_file, |
967 else | 985 " Adding range [%d..%d] to allocno a%dr%d\n", |
968 { | 986 start, ira_max_point, ALLOCNO_NUM (from), |
969 r->finish = ira_max_point; | 987 REGNO (ALLOCNO_REG (from))); |
970 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 988 } |
971 fprintf (ira_dump_file, | 989 else |
972 " Adding range [%d..%d] to allocno a%dr%d\n", | 990 { |
973 r->start, ira_max_point, ALLOCNO_NUM (from), | 991 r->finish = ira_max_point; |
974 REGNO (ALLOCNO_REG (from))); | 992 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) |
993 fprintf (ira_dump_file, | |
994 " Adding range [%d..%d] to allocno a%dr%d\n", | |
995 r->start, ira_max_point, ALLOCNO_NUM (from), | |
996 REGNO (ALLOCNO_REG (from))); | |
997 } | |
975 } | 998 } |
976 ira_max_point++; | 999 ira_max_point++; |
977 ALLOCNO_LIVE_RANGES (to) | 1000 nr = ALLOCNO_NUM_OBJECTS (to); |
978 = ira_create_allocno_live_range (to, ira_max_point, -1, | 1001 for (i = 0; i < nr; i++) |
979 ALLOCNO_LIVE_RANGES (to)); | 1002 { |
1003 ira_object_t to_obj = ALLOCNO_OBJECT (to, i); | |
1004 ira_add_live_range_to_object (to_obj, ira_max_point, -1); | |
1005 } | |
980 ira_max_point++; | 1006 ira_max_point++; |
981 } | 1007 } |
982 for (move = list; move != NULL; move = move->next) | 1008 for (move = list; move != NULL; move = move->next) |
983 { | 1009 { |
984 r = ALLOCNO_LIVE_RANGES (move->to); | 1010 int nr, i; |
985 if (r->finish < 0) | 1011 nr = ALLOCNO_NUM_OBJECTS (move->to); |
986 { | 1012 for (i = 0; i < nr; i++) |
987 r->finish = ira_max_point - 1; | 1013 { |
988 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 1014 ira_object_t to_obj = ALLOCNO_OBJECT (move->to, i); |
989 fprintf (ira_dump_file, | 1015 r = OBJECT_LIVE_RANGES (to_obj); |
990 " Adding range [%d..%d] to allocno a%dr%d\n", | 1016 if (r->finish < 0) |
991 r->start, r->finish, ALLOCNO_NUM (move->to), | 1017 { |
992 REGNO (ALLOCNO_REG (move->to))); | 1018 r->finish = ira_max_point - 1; |
1019 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | |
1020 fprintf (ira_dump_file, | |
1021 " Adding range [%d..%d] to allocno a%dr%d\n", | |
1022 r->start, r->finish, ALLOCNO_NUM (move->to), | |
1023 REGNO (ALLOCNO_REG (move->to))); | |
1024 } | |
993 } | 1025 } |
994 } | 1026 } |
995 EXECUTE_IF_SET_IN_BITMAP (live_through, FIRST_PSEUDO_REGISTER, regno, bi) | 1027 EXECUTE_IF_SET_IN_BITMAP (live_through, FIRST_PSEUDO_REGISTER, regno, bi) |
996 { | 1028 { |
1029 ira_allocno_t to; | |
1030 int nr, i; | |
1031 | |
997 a = node->regno_allocno_map[regno]; | 1032 a = node->regno_allocno_map[regno]; |
998 if ((to = ALLOCNO_MEM_OPTIMIZED_DEST (a)) != NULL) | 1033 if ((to = ALLOCNO_MEM_OPTIMIZED_DEST (a)) != NULL) |
999 a = to; | 1034 a = to; |
1000 ALLOCNO_LIVE_RANGES (a) | 1035 nr = ALLOCNO_NUM_OBJECTS (a); |
1001 = ira_create_allocno_live_range (a, start, ira_max_point - 1, | 1036 for (i = 0; i < nr; i++) |
1002 ALLOCNO_LIVE_RANGES (a)); | 1037 { |
1038 ira_object_t obj = ALLOCNO_OBJECT (a, i); | |
1039 ira_add_live_range_to_object (obj, start, ira_max_point - 1); | |
1040 } | |
1003 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) | 1041 if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) |
1004 fprintf | 1042 fprintf |
1005 (ira_dump_file, | 1043 (ira_dump_file, |
1006 " Adding range [%d..%d] to live through %s allocno a%dr%d\n", | 1044 " Adding range [%d..%d] to live through %s allocno a%dr%d\n", |
1007 start, ira_max_point - 1, | 1045 start, ira_max_point - 1, |