Mercurial > hg > CbC > CbC_gcc
comparison gcc/final.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 |
---|---|
60 #include "flags.h" | 60 #include "flags.h" |
61 #include "hard-reg-set.h" | 61 #include "hard-reg-set.h" |
62 #include "output.h" | 62 #include "output.h" |
63 #include "except.h" | 63 #include "except.h" |
64 #include "function.h" | 64 #include "function.h" |
65 #include "toplev.h" | 65 #include "rtl-error.h" |
66 #include "toplev.h" /* exact_log2, floor_log2 */ | |
66 #include "reload.h" | 67 #include "reload.h" |
67 #include "intl.h" | 68 #include "intl.h" |
68 #include "basic-block.h" | 69 #include "basic-block.h" |
69 #include "target.h" | 70 #include "target.h" |
71 #include "targhooks.h" | |
70 #include "debug.h" | 72 #include "debug.h" |
71 #include "expr.h" | 73 #include "expr.h" |
72 #include "cfglayout.h" | 74 #include "cfglayout.h" |
73 #include "tree-pass.h" | 75 #include "tree-pass.h" |
74 #include "tree-flow.h" | 76 #include "tree-flow.h" |
84 #ifdef XCOFF_DEBUGGING_INFO | 86 #ifdef XCOFF_DEBUGGING_INFO |
85 #include "xcoffout.h" /* Needed for external data | 87 #include "xcoffout.h" /* Needed for external data |
86 declarations for e.g. AIX 4.x. */ | 88 declarations for e.g. AIX 4.x. */ |
87 #endif | 89 #endif |
88 | 90 |
89 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO) | |
90 #include "dwarf2out.h" | 91 #include "dwarf2out.h" |
91 #endif | |
92 | 92 |
93 #ifdef DBX_DEBUGGING_INFO | 93 #ifdef DBX_DEBUGGING_INFO |
94 #include "dbxout.h" | 94 #include "dbxout.h" |
95 #endif | 95 #endif |
96 | 96 |
97 #ifdef SDB_DEBUGGING_INFO | 97 #ifdef SDB_DEBUGGING_INFO |
98 #include "sdbout.h" | 98 #include "sdbout.h" |
99 #endif | 99 #endif |
100 | 100 |
101 /* If we aren't using cc0, CC_STATUS_INIT shouldn't exist. So define a | 101 /* Most ports that aren't using cc0 don't need to define CC_STATUS_INIT. |
102 null default for it to save conditionalization later. */ | 102 So define a null default for it to save conditionalization later. */ |
103 #ifndef CC_STATUS_INIT | 103 #ifndef CC_STATUS_INIT |
104 #define CC_STATUS_INIT | 104 #define CC_STATUS_INIT |
105 #endif | 105 #endif |
106 | 106 |
107 /* How to start an assembler comment. */ | 107 /* How to start an assembler comment. */ |
218 static rtx walk_alter_subreg (rtx *, bool *); | 218 static rtx walk_alter_subreg (rtx *, bool *); |
219 static void output_asm_name (void); | 219 static void output_asm_name (void); |
220 static void output_alternate_entry_point (FILE *, rtx); | 220 static void output_alternate_entry_point (FILE *, rtx); |
221 static tree get_mem_expr_from_op (rtx, int *); | 221 static tree get_mem_expr_from_op (rtx, int *); |
222 static void output_asm_operand_names (rtx *, int *, int); | 222 static void output_asm_operand_names (rtx *, int *, int); |
223 static void output_operand (rtx, int); | |
224 #ifdef LEAF_REGISTERS | 223 #ifdef LEAF_REGISTERS |
225 static void leaf_renumber_regs (rtx); | 224 static void leaf_renumber_regs (rtx); |
226 #endif | 225 #endif |
227 #ifdef HAVE_cc0 | 226 #ifdef HAVE_cc0 |
228 static int alter_cond (rtx); | 227 static int alter_cond (rtx); |
252 If not overridden for epilogue code, then the function body itself | 251 If not overridden for epilogue code, then the function body itself |
253 contains return instructions wherever needed. */ | 252 contains return instructions wherever needed. */ |
254 void | 253 void |
255 default_function_pro_epilogue (FILE *file ATTRIBUTE_UNUSED, | 254 default_function_pro_epilogue (FILE *file ATTRIBUTE_UNUSED, |
256 HOST_WIDE_INT size ATTRIBUTE_UNUSED) | 255 HOST_WIDE_INT size ATTRIBUTE_UNUSED) |
256 { | |
257 } | |
258 | |
259 void | |
260 default_function_switched_text_sections (FILE *file ATTRIBUTE_UNUSED, | |
261 tree decl ATTRIBUTE_UNUSED, | |
262 bool new_is_cold ATTRIBUTE_UNUSED) | |
257 { | 263 { |
258 } | 264 } |
259 | 265 |
260 /* Default target hook that outputs nothing to a stream. */ | 266 /* Default target hook that outputs nothing to a stream. */ |
261 void | 267 void |
497 | 503 |
498 #ifndef LABEL_ALIGN | 504 #ifndef LABEL_ALIGN |
499 #define LABEL_ALIGN(LABEL) align_labels_log | 505 #define LABEL_ALIGN(LABEL) align_labels_log |
500 #endif | 506 #endif |
501 | 507 |
502 #ifndef LABEL_ALIGN_MAX_SKIP | |
503 #define LABEL_ALIGN_MAX_SKIP align_labels_max_skip | |
504 #endif | |
505 | |
506 #ifndef LOOP_ALIGN | 508 #ifndef LOOP_ALIGN |
507 #define LOOP_ALIGN(LABEL) align_loops_log | 509 #define LOOP_ALIGN(LABEL) align_loops_log |
508 #endif | 510 #endif |
509 | 511 |
510 #ifndef LOOP_ALIGN_MAX_SKIP | |
511 #define LOOP_ALIGN_MAX_SKIP align_loops_max_skip | |
512 #endif | |
513 | |
514 #ifndef LABEL_ALIGN_AFTER_BARRIER | 512 #ifndef LABEL_ALIGN_AFTER_BARRIER |
515 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) 0 | 513 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) 0 |
516 #endif | 514 #endif |
517 | 515 |
518 #ifndef LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP | |
519 #define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP 0 | |
520 #endif | |
521 | |
522 #ifndef JUMP_ALIGN | 516 #ifndef JUMP_ALIGN |
523 #define JUMP_ALIGN(LABEL) align_jumps_log | 517 #define JUMP_ALIGN(LABEL) align_jumps_log |
524 #endif | 518 #endif |
525 | 519 |
526 #ifndef JUMP_ALIGN_MAX_SKIP | 520 int |
527 #define JUMP_ALIGN_MAX_SKIP align_jumps_max_skip | 521 default_label_align_after_barrier_max_skip (rtx insn ATTRIBUTE_UNUSED) |
528 #endif | 522 { |
523 return 0; | |
524 } | |
525 | |
526 int | |
527 default_loop_align_max_skip (rtx insn ATTRIBUTE_UNUSED) | |
528 { | |
529 return align_loops_max_skip; | |
530 } | |
531 | |
532 int | |
533 default_label_align_max_skip (rtx insn ATTRIBUTE_UNUSED) | |
534 { | |
535 return align_labels_max_skip; | |
536 } | |
537 | |
538 int | |
539 default_jump_align_max_skip (rtx insn ATTRIBUTE_UNUSED) | |
540 { | |
541 return align_jumps_max_skip; | |
542 } | |
529 | 543 |
530 #ifndef ADDR_VEC_ALIGN | 544 #ifndef ADDR_VEC_ALIGN |
531 static int | 545 static int |
532 final_addr_vec_align (rtx addr_vec) | 546 final_addr_vec_align (rtx addr_vec) |
533 { | 547 { |
706 | 720 |
707 if (dump_file) | 721 if (dump_file) |
708 { | 722 { |
709 dump_flow_info (dump_file, TDF_DETAILS); | 723 dump_flow_info (dump_file, TDF_DETAILS); |
710 flow_loops_dump (dump_file, NULL, 1); | 724 flow_loops_dump (dump_file, NULL, 1); |
711 loop_optimizer_init (AVOID_CFG_MODIFICATIONS); | 725 } |
712 } | 726 loop_optimizer_init (AVOID_CFG_MODIFICATIONS); |
713 FOR_EACH_BB (bb) | 727 FOR_EACH_BB (bb) |
714 if (bb->frequency > freq_max) | 728 if (bb->frequency > freq_max) |
715 freq_max = bb->frequency; | 729 freq_max = bb->frequency; |
716 freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD); | 730 freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD); |
717 | 731 |
731 fprintf(dump_file, "BB %4i freq %4i loop %2i loop_depth %2i skipped.\n", | 745 fprintf(dump_file, "BB %4i freq %4i loop %2i loop_depth %2i skipped.\n", |
732 bb->index, bb->frequency, bb->loop_father->num, bb->loop_depth); | 746 bb->index, bb->frequency, bb->loop_father->num, bb->loop_depth); |
733 continue; | 747 continue; |
734 } | 748 } |
735 max_log = LABEL_ALIGN (label); | 749 max_log = LABEL_ALIGN (label); |
736 max_skip = LABEL_ALIGN_MAX_SKIP; | 750 max_skip = targetm.asm_out.label_align_max_skip (label); |
737 | 751 |
738 FOR_EACH_EDGE (e, ei, bb->preds) | 752 FOR_EACH_EDGE (e, ei, bb->preds) |
739 { | 753 { |
740 if (e->flags & EDGE_FALLTHRU) | 754 if (e->flags & EDGE_FALLTHRU) |
741 has_fallthru = 1, fallthru_frequency += EDGE_FREQUENCY (e); | 755 has_fallthru = 1, fallthru_frequency += EDGE_FREQUENCY (e); |
775 if (dump_file) | 789 if (dump_file) |
776 fprintf(dump_file, " jump alignment added.\n"); | 790 fprintf(dump_file, " jump alignment added.\n"); |
777 if (max_log < log) | 791 if (max_log < log) |
778 { | 792 { |
779 max_log = log; | 793 max_log = log; |
780 max_skip = JUMP_ALIGN_MAX_SKIP; | 794 max_skip = targetm.asm_out.jump_align_max_skip (label); |
781 } | 795 } |
782 } | 796 } |
783 /* In case block is frequent and reached mostly by non-fallthru edge, | 797 /* In case block is frequent and reached mostly by non-fallthru edge, |
784 align it. It is most likely a first block of loop. */ | 798 align it. It is most likely a first block of loop. */ |
785 if (has_fallthru | 799 if (has_fallthru |
792 if (dump_file) | 806 if (dump_file) |
793 fprintf(dump_file, " internal loop alignment added.\n"); | 807 fprintf(dump_file, " internal loop alignment added.\n"); |
794 if (max_log < log) | 808 if (max_log < log) |
795 { | 809 { |
796 max_log = log; | 810 max_log = log; |
797 max_skip = LOOP_ALIGN_MAX_SKIP; | 811 max_skip = targetm.asm_out.loop_align_max_skip (label); |
798 } | 812 } |
799 } | 813 } |
800 LABEL_TO_ALIGNMENT (label) = max_log; | 814 LABEL_TO_ALIGNMENT (label) = max_log; |
801 LABEL_TO_MAX_SKIP (label) = max_skip; | 815 LABEL_TO_MAX_SKIP (label) = max_skip; |
802 } | 816 } |
803 | 817 |
804 if (dump_file) | 818 loop_optimizer_finalize (); |
805 { | 819 free_dominance_info (CDI_DOMINATORS); |
806 loop_optimizer_finalize (); | |
807 free_dominance_info (CDI_DOMINATORS); | |
808 } | |
809 return 0; | 820 return 0; |
810 } | 821 } |
811 | 822 |
812 struct rtl_opt_pass pass_compute_alignments = | 823 struct rtl_opt_pass pass_compute_alignments = |
813 { | 824 { |
925 { | 936 { |
926 log = LABEL_ALIGN (insn); | 937 log = LABEL_ALIGN (insn); |
927 if (max_log < log) | 938 if (max_log < log) |
928 { | 939 { |
929 max_log = log; | 940 max_log = log; |
930 max_skip = LABEL_ALIGN_MAX_SKIP; | 941 max_skip = targetm.asm_out.label_align_max_skip (insn); |
931 } | 942 } |
932 } | 943 } |
933 /* ADDR_VECs only take room if read-only data goes into the text | 944 /* ADDR_VECs only take room if read-only data goes into the text |
934 section. */ | 945 section. */ |
935 if ((JUMP_TABLES_IN_TEXT_SECTION | 946 if ((JUMP_TABLES_IN_TEXT_SECTION |
938 { | 949 { |
939 log = ADDR_VEC_ALIGN (next); | 950 log = ADDR_VEC_ALIGN (next); |
940 if (max_log < log) | 951 if (max_log < log) |
941 { | 952 { |
942 max_log = log; | 953 max_log = log; |
943 max_skip = LABEL_ALIGN_MAX_SKIP; | 954 max_skip = targetm.asm_out.label_align_max_skip (insn); |
944 } | 955 } |
945 } | 956 } |
946 LABEL_TO_ALIGNMENT (insn) = max_log; | 957 LABEL_TO_ALIGNMENT (insn) = max_log; |
947 LABEL_TO_MAX_SKIP (insn) = max_skip; | 958 LABEL_TO_MAX_SKIP (insn) = max_skip; |
948 max_log = 0; | 959 max_log = 0; |
958 { | 969 { |
959 log = LABEL_ALIGN_AFTER_BARRIER (insn); | 970 log = LABEL_ALIGN_AFTER_BARRIER (insn); |
960 if (max_log < log) | 971 if (max_log < log) |
961 { | 972 { |
962 max_log = log; | 973 max_log = log; |
963 max_skip = LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP; | 974 max_skip = targetm.asm_out.label_align_after_barrier_max_skip (label); |
964 } | 975 } |
965 break; | 976 break; |
966 } | 977 } |
967 } | 978 } |
968 } | 979 } |
1479 char *s; | 1490 char *s; |
1480 const char *name; | 1491 const char *name; |
1481 size_t name_len; | 1492 size_t name_len; |
1482 | 1493 |
1483 for (map = debug_prefix_maps; map; map = map->next) | 1494 for (map = debug_prefix_maps; map; map = map->next) |
1484 if (strncmp (filename, map->old_prefix, map->old_len) == 0) | 1495 if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) |
1485 break; | 1496 break; |
1486 if (!map) | 1497 if (!map) |
1487 return filename; | 1498 return filename; |
1488 name = filename + map->old_len; | 1499 name = filename + map->old_len; |
1489 name_len = strlen (name) + 1; | 1500 name_len = strlen (name) + 1; |
1512 for the new function. The label for the function and associated | 1523 for the new function. The label for the function and associated |
1513 assembler pseudo-ops have already been output in `assemble_start_function'. | 1524 assembler pseudo-ops have already been output in `assemble_start_function'. |
1514 | 1525 |
1515 FIRST is the first insn of the rtl for the function being compiled. | 1526 FIRST is the first insn of the rtl for the function being compiled. |
1516 FILE is the file to write assembler code to. | 1527 FILE is the file to write assembler code to. |
1517 OPTIMIZE is nonzero if we should eliminate redundant | 1528 OPTIMIZE_P is nonzero if we should eliminate redundant |
1518 test and compare insns. */ | 1529 test and compare insns. */ |
1519 | 1530 |
1520 void | 1531 void |
1521 final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file, | 1532 final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file, |
1522 int optimize ATTRIBUTE_UNUSED) | 1533 int optimize_p ATTRIBUTE_UNUSED) |
1523 { | 1534 { |
1524 block_depth = 0; | 1535 block_depth = 0; |
1525 | 1536 |
1526 this_is_asm_operands = 0; | 1537 this_is_asm_operands = 0; |
1527 | 1538 |
1532 high_block_linenum = high_function_linenum = last_linenum; | 1543 high_block_linenum = high_function_linenum = last_linenum; |
1533 | 1544 |
1534 if (!DECL_IGNORED_P (current_function_decl)) | 1545 if (!DECL_IGNORED_P (current_function_decl)) |
1535 debug_hooks->begin_prologue (last_linenum, last_filename); | 1546 debug_hooks->begin_prologue (last_linenum, last_filename); |
1536 | 1547 |
1537 #if defined (DWARF2_UNWIND_INFO) || defined (TARGET_UNWIND_INFO) | |
1538 if (!dwarf2_debug_info_emitted_p (current_function_decl)) | 1548 if (!dwarf2_debug_info_emitted_p (current_function_decl)) |
1539 dwarf2out_begin_prologue (0, NULL); | 1549 dwarf2out_begin_prologue (0, NULL); |
1540 #endif | |
1541 | 1550 |
1542 #ifdef LEAF_REG_REMAP | 1551 #ifdef LEAF_REG_REMAP |
1543 if (current_function_uses_only_leaf_regs) | 1552 if (current_function_uses_only_leaf_regs) |
1544 leaf_renumber_regs (first); | 1553 leaf_renumber_regs (first); |
1545 #endif | 1554 #endif |
1546 | 1555 |
1547 /* The Sun386i and perhaps other machines don't work right | 1556 /* The Sun386i and perhaps other machines don't work right |
1548 if the profiling code comes after the prologue. */ | 1557 if the profiling code comes after the prologue. */ |
1549 #ifdef PROFILE_BEFORE_PROLOGUE | 1558 if (targetm.profile_before_prologue () && crtl->profile) |
1550 if (crtl->profile) | |
1551 profile_function (file); | 1559 profile_function (file); |
1552 #endif /* PROFILE_BEFORE_PROLOGUE */ | 1560 |
1553 | 1561 #if defined (HAVE_prologue) |
1554 #if defined (DWARF2_UNWIND_INFO) && defined (HAVE_prologue) | |
1555 if (dwarf2out_do_frame ()) | 1562 if (dwarf2out_do_frame ()) |
1556 dwarf2out_frame_debug (NULL_RTX, false); | 1563 dwarf2out_frame_debug (NULL_RTX, false); |
1557 #endif | 1564 #endif |
1558 | 1565 |
1559 /* If debugging, assign block numbers to all of the blocks in this | 1566 /* If debugging, assign block numbers to all of the blocks in this |
1589 } | 1596 } |
1590 | 1597 |
1591 static void | 1598 static void |
1592 profile_after_prologue (FILE *file ATTRIBUTE_UNUSED) | 1599 profile_after_prologue (FILE *file ATTRIBUTE_UNUSED) |
1593 { | 1600 { |
1594 #ifndef PROFILE_BEFORE_PROLOGUE | 1601 if (!targetm.profile_before_prologue () && crtl->profile) |
1595 if (crtl->profile) | |
1596 profile_function (file); | 1602 profile_function (file); |
1597 #endif /* not PROFILE_BEFORE_PROLOGUE */ | |
1598 } | 1603 } |
1599 | 1604 |
1600 static void | 1605 static void |
1601 profile_function (FILE *file ATTRIBUTE_UNUSED) | 1606 profile_function (FILE *file ATTRIBUTE_UNUSED) |
1602 { | 1607 { |
1659 | 1664 |
1660 /* And debug output. */ | 1665 /* And debug output. */ |
1661 if (!DECL_IGNORED_P (current_function_decl)) | 1666 if (!DECL_IGNORED_P (current_function_decl)) |
1662 debug_hooks->end_epilogue (last_linenum, last_filename); | 1667 debug_hooks->end_epilogue (last_linenum, last_filename); |
1663 | 1668 |
1664 #if defined (DWARF2_UNWIND_INFO) | |
1665 if (!dwarf2_debug_info_emitted_p (current_function_decl) | 1669 if (!dwarf2_debug_info_emitted_p (current_function_decl) |
1666 && dwarf2out_do_frame ()) | 1670 && dwarf2out_do_frame ()) |
1667 dwarf2out_end_epilogue (last_linenum, last_filename); | 1671 dwarf2out_end_epilogue (last_linenum, last_filename); |
1668 #endif | |
1669 } | 1672 } |
1670 | 1673 |
1671 /* Output assembler code for some insns: all or part of a function. | 1674 /* Output assembler code for some insns: all or part of a function. |
1672 For description of args, see `final_start_function', above. */ | 1675 For description of args, see `final_start_function', above. */ |
1673 | 1676 |
1674 void | 1677 void |
1675 final (rtx first, FILE *file, int optimize) | 1678 final (rtx first, FILE *file, int optimize_p) |
1676 { | 1679 { |
1677 rtx insn; | 1680 rtx insn; |
1678 int max_uid = 0; | 1681 int max_uid = 0; |
1679 int seen = 0; | 1682 int seen = 0; |
1680 | 1683 |
1685 if (INSN_UID (insn) > max_uid) /* Find largest UID. */ | 1688 if (INSN_UID (insn) > max_uid) /* Find largest UID. */ |
1686 max_uid = INSN_UID (insn); | 1689 max_uid = INSN_UID (insn); |
1687 #ifdef HAVE_cc0 | 1690 #ifdef HAVE_cc0 |
1688 /* If CC tracking across branches is enabled, record the insn which | 1691 /* If CC tracking across branches is enabled, record the insn which |
1689 jumps to each branch only reached from one place. */ | 1692 jumps to each branch only reached from one place. */ |
1690 if (optimize && JUMP_P (insn)) | 1693 if (optimize_p && JUMP_P (insn)) |
1691 { | 1694 { |
1692 rtx lab = JUMP_LABEL (insn); | 1695 rtx lab = JUMP_LABEL (insn); |
1693 if (lab && LABEL_NUSES (lab) == 1) | 1696 if (lab && LABEL_NUSES (lab) == 1) |
1694 { | 1697 { |
1695 LABEL_REFS (lab) = insn; | 1698 LABEL_REFS (lab) = insn; |
1715 } | 1718 } |
1716 else | 1719 else |
1717 insn_current_address = INSN_ADDRESSES (INSN_UID (insn)); | 1720 insn_current_address = INSN_ADDRESSES (INSN_UID (insn)); |
1718 #endif /* HAVE_ATTR_length */ | 1721 #endif /* HAVE_ATTR_length */ |
1719 | 1722 |
1720 insn = final_scan_insn (insn, file, optimize, 0, &seen); | 1723 insn = final_scan_insn (insn, file, optimize_p, 0, &seen); |
1721 } | 1724 } |
1722 } | 1725 } |
1723 | 1726 |
1724 const char * | 1727 const char * |
1725 get_insn_template (int code, rtx insn) | 1728 get_insn_template (int code, rtx insn) |
1811 both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG, or | 1814 both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG, or |
1812 at the beginning of the second basic block, whichever comes | 1815 at the beginning of the second basic block, whichever comes |
1813 first. */ | 1816 first. */ |
1814 | 1817 |
1815 rtx | 1818 rtx |
1816 final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, | 1819 final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, |
1817 int nopeepholes ATTRIBUTE_UNUSED, int *seen) | 1820 int nopeepholes ATTRIBUTE_UNUSED, int *seen) |
1818 { | 1821 { |
1819 #ifdef HAVE_cc0 | 1822 #ifdef HAVE_cc0 |
1820 rtx set; | 1823 rtx set; |
1821 #endif | 1824 #endif |
1836 case NOTE_INSN_DELETED: | 1839 case NOTE_INSN_DELETED: |
1837 break; | 1840 break; |
1838 | 1841 |
1839 case NOTE_INSN_SWITCH_TEXT_SECTIONS: | 1842 case NOTE_INSN_SWITCH_TEXT_SECTIONS: |
1840 in_cold_section_p = !in_cold_section_p; | 1843 in_cold_section_p = !in_cold_section_p; |
1841 #ifdef DWARF2_UNWIND_INFO | 1844 |
1842 if (dwarf2out_do_frame ()) | 1845 if (dwarf2out_do_frame ()) |
1843 dwarf2out_switch_text_section (); | 1846 dwarf2out_switch_text_section (); |
1844 else | 1847 else if (!DECL_IGNORED_P (current_function_decl)) |
1845 #endif | |
1846 if (!DECL_IGNORED_P (current_function_decl)) | |
1847 debug_hooks->switch_text_section (); | 1848 debug_hooks->switch_text_section (); |
1848 | 1849 |
1849 switch_to_section (current_function_section ()); | 1850 switch_to_section (current_function_section ()); |
1851 targetm.asm_out.function_switched_text_sections (asm_out_file, | |
1852 current_function_decl, | |
1853 in_cold_section_p); | |
1850 break; | 1854 break; |
1851 | 1855 |
1852 case NOTE_INSN_BASIC_BLOCK: | 1856 case NOTE_INSN_BASIC_BLOCK: |
1853 #ifdef TARGET_UNWIND_INFO | 1857 if (targetm.asm_out.unwind_emit) |
1854 targetm.asm_out.unwind_emit (asm_out_file, insn); | 1858 targetm.asm_out.unwind_emit (asm_out_file, insn); |
1855 #endif | |
1856 | 1859 |
1857 if (flag_debug_asm) | 1860 if (flag_debug_asm) |
1858 fprintf (asm_out_file, "\t%s basic block %d\n", | 1861 fprintf (asm_out_file, "\t%s basic block %d\n", |
1859 ASM_COMMENT_START, NOTE_BASIC_BLOCK (insn)->index); | 1862 ASM_COMMENT_START, NOTE_BASIC_BLOCK (insn)->index); |
1860 | 1863 |
1893 *seen |= SEEN_NOTE; | 1896 *seen |= SEEN_NOTE; |
1894 | 1897 |
1895 break; | 1898 break; |
1896 | 1899 |
1897 case NOTE_INSN_EPILOGUE_BEG: | 1900 case NOTE_INSN_EPILOGUE_BEG: |
1898 #if defined (DWARF2_UNWIND_INFO) && defined (HAVE_epilogue) | 1901 #if defined (HAVE_epilogue) |
1899 if (dwarf2out_do_frame ()) | 1902 if (dwarf2out_do_frame ()) |
1900 dwarf2out_begin_epilogue (insn); | 1903 dwarf2out_cfi_begin_epilogue (insn); |
1901 #endif | 1904 #endif |
1905 (*debug_hooks->begin_epilogue) (last_linenum, last_filename); | |
1902 targetm.asm_out.function_begin_epilogue (file); | 1906 targetm.asm_out.function_begin_epilogue (file); |
1903 break; | 1907 break; |
1904 | 1908 |
1905 case NOTE_INSN_CFA_RESTORE_STATE: | 1909 case NOTE_INSN_CFA_RESTORE_STATE: |
1906 #if defined (DWARF2_UNWIND_INFO) | |
1907 dwarf2out_frame_debug_restore_state (); | 1910 dwarf2out_frame_debug_restore_state (); |
1908 #endif | |
1909 break; | 1911 break; |
1910 | 1912 |
1911 case NOTE_INSN_FUNCTION_BEG: | 1913 case NOTE_INSN_FUNCTION_BEG: |
1912 app_disable (); | 1914 app_disable (); |
1913 if (!DECL_IGNORED_P (current_function_decl)) | 1915 if (!DECL_IGNORED_P (current_function_decl)) |
2012 break; | 2014 break; |
2013 } | 2015 } |
2014 break; | 2016 break; |
2015 | 2017 |
2016 case BARRIER: | 2018 case BARRIER: |
2017 #if defined (DWARF2_UNWIND_INFO) | |
2018 if (dwarf2out_do_frame ()) | 2019 if (dwarf2out_do_frame ()) |
2019 dwarf2out_frame_debug (insn, false); | 2020 dwarf2out_frame_debug (insn, false); |
2020 #endif | |
2021 break; | 2021 break; |
2022 | 2022 |
2023 case CODE_LABEL: | 2023 case CODE_LABEL: |
2024 /* The target port might emit labels in the output function for | 2024 /* The target port might emit labels in the output function for |
2025 some insn, e.g. sh.c output_branchy_insn. */ | 2025 some insn, e.g. sh.c output_branchy_insn. */ |
2041 ASM_OUTPUT_ALIGN (file, align); | 2041 ASM_OUTPUT_ALIGN (file, align); |
2042 #endif | 2042 #endif |
2043 #endif | 2043 #endif |
2044 } | 2044 } |
2045 } | 2045 } |
2046 #ifdef HAVE_cc0 | |
2047 CC_STATUS_INIT; | 2046 CC_STATUS_INIT; |
2048 #endif | |
2049 | 2047 |
2050 if (!DECL_IGNORED_P (current_function_decl) && LABEL_NAME (insn)) | 2048 if (!DECL_IGNORED_P (current_function_decl) && LABEL_NAME (insn)) |
2051 debug_hooks->label (insn); | 2049 debug_hooks->label (insn); |
2052 | 2050 |
2053 app_disable (); | 2051 app_disable (); |
2285 | 2283 |
2286 final_sequence = body; | 2284 final_sequence = body; |
2287 | 2285 |
2288 /* Record the delay slots' frame information before the branch. | 2286 /* Record the delay slots' frame information before the branch. |
2289 This is needed for delayed calls: see execute_cfa_program(). */ | 2287 This is needed for delayed calls: see execute_cfa_program(). */ |
2290 #if defined (DWARF2_UNWIND_INFO) | |
2291 if (dwarf2out_do_frame ()) | 2288 if (dwarf2out_do_frame ()) |
2292 for (i = 1; i < XVECLEN (body, 0); i++) | 2289 for (i = 1; i < XVECLEN (body, 0); i++) |
2293 dwarf2out_frame_debug (XVECEXP (body, 0, i), false); | 2290 dwarf2out_frame_debug (XVECEXP (body, 0, i), false); |
2294 #endif | |
2295 | 2291 |
2296 /* The first insn in this SEQUENCE might be a JUMP_INSN that will | 2292 /* The first insn in this SEQUENCE might be a JUMP_INSN that will |
2297 force the restoration of a comparison that was previously | 2293 force the restoration of a comparison that was previously |
2298 thought unnecessary. If that happens, cancel this sequence | 2294 thought unnecessary. If that happens, cancel this sequence |
2299 and cause that insn to be restored. */ | 2295 and cause that insn to be restored. */ |
2345 it should be possible for the user to alter a variable | 2341 it should be possible for the user to alter a variable |
2346 with the debugger in between statements | 2342 with the debugger in between statements |
2347 and the next statement should reexamine the variable | 2343 and the next statement should reexamine the variable |
2348 to compute the condition codes. */ | 2344 to compute the condition codes. */ |
2349 | 2345 |
2350 if (optimize) | 2346 if (optimize_p) |
2351 { | 2347 { |
2352 if (set | 2348 if (set |
2353 && GET_CODE (SET_DEST (set)) == CC0 | 2349 && GET_CODE (SET_DEST (set)) == CC0 |
2354 && insn != last_ignored_compare) | 2350 && insn != last_ignored_compare) |
2355 { | 2351 { |
2530 #endif | 2526 #endif |
2531 | 2527 |
2532 #ifdef HAVE_peephole | 2528 #ifdef HAVE_peephole |
2533 /* Do machine-specific peephole optimizations if desired. */ | 2529 /* Do machine-specific peephole optimizations if desired. */ |
2534 | 2530 |
2535 if (optimize && !flag_no_peephole && !nopeepholes) | 2531 if (optimize_p && !flag_no_peephole && !nopeepholes) |
2536 { | 2532 { |
2537 rtx next = peephole (insn); | 2533 rtx next = peephole (insn); |
2538 /* When peepholing, if there were notes within the peephole, | 2534 /* When peepholing, if there were notes within the peephole, |
2539 emit them before the peephole. */ | 2535 emit them before the peephole. */ |
2540 if (next != 0 && next != NEXT_INSN (insn)) | 2536 if (next != 0 && next != NEXT_INSN (insn)) |
2541 { | 2537 { |
2542 rtx note, prev = PREV_INSN (insn); | 2538 rtx note, prev = PREV_INSN (insn); |
2543 | 2539 |
2544 for (note = NEXT_INSN (insn); note != next; | 2540 for (note = NEXT_INSN (insn); note != next; |
2545 note = NEXT_INSN (note)) | 2541 note = NEXT_INSN (note)) |
2546 final_scan_insn (note, file, optimize, nopeepholes, seen); | 2542 final_scan_insn (note, file, optimize_p, nopeepholes, seen); |
2547 | 2543 |
2548 /* Put the notes in the proper position for a later | 2544 /* Put the notes in the proper position for a later |
2549 rescan. For example, the SH target can do this | 2545 rescan. For example, the SH target can do this |
2550 when generating a far jump in a delayed branch | 2546 when generating a far jump in a delayed branch |
2551 sequence. */ | 2547 sequence. */ |
2604 NOTICE_UPDATE_CC (body, insn); | 2600 NOTICE_UPDATE_CC (body, insn); |
2605 #endif | 2601 #endif |
2606 | 2602 |
2607 current_output_insn = debug_insn = insn; | 2603 current_output_insn = debug_insn = insn; |
2608 | 2604 |
2609 #if defined (DWARF2_UNWIND_INFO) | |
2610 if (CALL_P (insn) && dwarf2out_do_frame ()) | 2605 if (CALL_P (insn) && dwarf2out_do_frame ()) |
2611 dwarf2out_frame_debug (insn, false); | 2606 dwarf2out_frame_debug (insn, false); |
2612 #endif | |
2613 | 2607 |
2614 /* Find the proper template for this insn. */ | 2608 /* Find the proper template for this insn. */ |
2615 templ = get_insn_template (insn_code_number, insn); | 2609 templ = get_insn_template (insn_code_number, insn); |
2616 | 2610 |
2617 /* If the C code returns 0, it means that it is a jump insn | 2611 /* If the C code returns 0, it means that it is a jump insn |
2656 #endif | 2650 #endif |
2657 | 2651 |
2658 return new_rtx; | 2652 return new_rtx; |
2659 } | 2653 } |
2660 | 2654 |
2661 #ifdef TARGET_UNWIND_INFO | |
2662 /* ??? This will put the directives in the wrong place if | 2655 /* ??? This will put the directives in the wrong place if |
2663 get_insn_template outputs assembly directly. However calling it | 2656 get_insn_template outputs assembly directly. However calling it |
2664 before get_insn_template breaks if the insns is split. */ | 2657 before get_insn_template breaks if the insns is split. */ |
2665 targetm.asm_out.unwind_emit (asm_out_file, insn); | 2658 if (targetm.asm_out.unwind_emit_before_insn |
2666 #endif | 2659 && targetm.asm_out.unwind_emit) |
2660 targetm.asm_out.unwind_emit (asm_out_file, insn); | |
2667 | 2661 |
2668 if (CALL_P (insn)) | 2662 if (CALL_P (insn)) |
2669 { | 2663 { |
2670 rtx x = call_from_call_insn (insn); | 2664 rtx x = call_from_call_insn (insn); |
2671 x = XEXP (x, 0); | 2665 x = XEXP (x, 0); |
2709 recog_data.n_operands); | 2703 recog_data.n_operands); |
2710 | 2704 |
2711 /* If necessary, report the effect that the instruction has on | 2705 /* If necessary, report the effect that the instruction has on |
2712 the unwind info. We've already done this for delay slots | 2706 the unwind info. We've already done this for delay slots |
2713 and call instructions. */ | 2707 and call instructions. */ |
2714 #if defined (DWARF2_UNWIND_INFO) | |
2715 if (final_sequence == 0 | 2708 if (final_sequence == 0 |
2716 #if !defined (HAVE_prologue) | 2709 #if !defined (HAVE_prologue) |
2717 && !ACCUMULATE_OUTGOING_ARGS | 2710 && !ACCUMULATE_OUTGOING_ARGS |
2718 #endif | 2711 #endif |
2719 && dwarf2out_do_frame ()) | 2712 && dwarf2out_do_frame ()) |
2720 dwarf2out_frame_debug (insn, true); | 2713 dwarf2out_frame_debug (insn, true); |
2721 #endif | 2714 |
2715 if (!targetm.asm_out.unwind_emit_before_insn | |
2716 && targetm.asm_out.unwind_emit) | |
2717 targetm.asm_out.unwind_emit (asm_out_file, insn); | |
2722 | 2718 |
2723 current_output_insn = debug_insn = 0; | 2719 current_output_insn = debug_insn = 0; |
2724 } | 2720 } |
2725 } | 2721 } |
2726 return NEXT_INSN (insn); | 2722 return NEXT_INSN (insn); |
3327 } | 3323 } |
3328 /* % followed by a letter and some digits | 3324 /* % followed by a letter and some digits |
3329 outputs an operand in a special way depending on the letter. | 3325 outputs an operand in a special way depending on the letter. |
3330 Letters `acln' are implemented directly. | 3326 Letters `acln' are implemented directly. |
3331 Other letters are passed to `output_operand' so that | 3327 Other letters are passed to `output_operand' so that |
3332 the PRINT_OPERAND macro can define them. */ | 3328 the TARGET_PRINT_OPERAND hook can define them. */ |
3333 else if (ISALPHA (*p)) | 3329 else if (ISALPHA (*p)) |
3334 { | 3330 { |
3335 int letter = *p++; | 3331 int letter = *p++; |
3336 unsigned long opnum; | 3332 unsigned long opnum; |
3337 char *endptr; | 3333 char *endptr; |
3393 | 3389 |
3394 p = endptr; | 3390 p = endptr; |
3395 c = *p; | 3391 c = *p; |
3396 } | 3392 } |
3397 /* % followed by punctuation: output something for that | 3393 /* % followed by punctuation: output something for that |
3398 punctuation character alone, with no operand. | 3394 punctuation character alone, with no operand. The |
3399 The PRINT_OPERAND macro decides what is actually done. */ | 3395 TARGET_PRINT_OPERAND hook decides what is actually done. */ |
3400 #ifdef PRINT_OPERAND_PUNCT_VALID_P | 3396 else if (targetm.asm_out.print_operand_punct_valid_p ((unsigned char) *p)) |
3401 else if (PRINT_OPERAND_PUNCT_VALID_P ((unsigned char) *p)) | |
3402 output_operand (NULL_RTX, *p++); | 3397 output_operand (NULL_RTX, *p++); |
3403 #endif | |
3404 else | 3398 else |
3405 output_operand_lossage ("invalid %%-code"); | 3399 output_operand_lossage ("invalid %%-code"); |
3406 break; | 3400 break; |
3407 | 3401 |
3408 default: | 3402 default: |
3470 { | 3464 { |
3471 for_each_rtx (&x, mark_symbol_ref_as_used, NULL); | 3465 for_each_rtx (&x, mark_symbol_ref_as_used, NULL); |
3472 } | 3466 } |
3473 | 3467 |
3474 /* Print operand X using machine-dependent assembler syntax. | 3468 /* Print operand X using machine-dependent assembler syntax. |
3475 The macro PRINT_OPERAND is defined just to control this function. | |
3476 CODE is a non-digit that preceded the operand-number in the % spec, | 3469 CODE is a non-digit that preceded the operand-number in the % spec, |
3477 such as 'z' if the spec was `%z3'. CODE is 0 if there was no char | 3470 such as 'z' if the spec was `%z3'. CODE is 0 if there was no char |
3478 between the % and the digits. | 3471 between the % and the digits. |
3479 When CODE is a non-letter, X is 0. | 3472 When CODE is a non-letter, X is 0. |
3480 | 3473 |
3481 The meanings of the letters are machine-dependent and controlled | 3474 The meanings of the letters are machine-dependent and controlled |
3482 by PRINT_OPERAND. */ | 3475 by TARGET_PRINT_OPERAND. */ |
3483 | 3476 |
3484 static void | 3477 void |
3485 output_operand (rtx x, int code ATTRIBUTE_UNUSED) | 3478 output_operand (rtx x, int code ATTRIBUTE_UNUSED) |
3486 { | 3479 { |
3487 if (x && GET_CODE (x) == SUBREG) | 3480 if (x && GET_CODE (x) == SUBREG) |
3488 x = alter_subreg (&x); | 3481 x = alter_subreg (&x); |
3489 | 3482 |
3490 /* X must not be a pseudo reg. */ | 3483 /* X must not be a pseudo reg. */ |
3491 gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER); | 3484 gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER); |
3492 | 3485 |
3493 PRINT_OPERAND (asm_out_file, x, code); | 3486 targetm.asm_out.print_operand (asm_out_file, x, code); |
3494 | 3487 |
3495 if (x == NULL_RTX) | 3488 if (x == NULL_RTX) |
3496 return; | 3489 return; |
3497 | 3490 |
3498 for_each_rtx (&x, mark_symbol_ref_as_used, NULL); | 3491 for_each_rtx (&x, mark_symbol_ref_as_used, NULL); |
3499 } | 3492 } |
3500 | 3493 |
3501 /* Print a memory reference operand for address X | 3494 /* Print a memory reference operand for address X using |
3502 using machine-dependent assembler syntax. | 3495 machine-dependent assembler syntax. */ |
3503 The macro PRINT_OPERAND_ADDRESS exists just to control this function. */ | |
3504 | 3496 |
3505 void | 3497 void |
3506 output_address (rtx x) | 3498 output_address (rtx x) |
3507 { | 3499 { |
3508 bool changed = false; | 3500 bool changed = false; |
3509 walk_alter_subreg (&x, &changed); | 3501 walk_alter_subreg (&x, &changed); |
3510 PRINT_OPERAND_ADDRESS (asm_out_file, x); | 3502 targetm.asm_out.print_operand_address (asm_out_file, x); |
3511 } | 3503 } |
3512 | 3504 |
3513 /* Print an integer constant expression in assembler syntax. | 3505 /* Print an integer constant expression in assembler syntax. |
3514 Addition and subtraction are the only arithmetic | 3506 Addition and subtraction are the only arithmetic |
3515 that may appear in these expressions. */ | 3507 that may appear in these expressions. */ |
3629 case TRUNCATE: | 3621 case TRUNCATE: |
3630 output_addr_const (file, XEXP (x, 0)); | 3622 output_addr_const (file, XEXP (x, 0)); |
3631 break; | 3623 break; |
3632 | 3624 |
3633 default: | 3625 default: |
3634 #ifdef OUTPUT_ADDR_CONST_EXTRA | 3626 if (targetm.asm_out.output_addr_const_extra (file, x)) |
3635 OUTPUT_ADDR_CONST_EXTRA (file, x, fail); | 3627 break; |
3636 break; | 3628 |
3637 | |
3638 fail: | |
3639 #endif | |
3640 output_operand_lossage ("invalid expression as operand"); | 3629 output_operand_lossage ("invalid expression as operand"); |
3641 } | 3630 } |
3631 } | |
3632 | |
3633 /* Output a quoted string. */ | |
3634 | |
3635 void | |
3636 output_quoted_string (FILE *asm_file, const char *string) | |
3637 { | |
3638 #ifdef OUTPUT_QUOTED_STRING | |
3639 OUTPUT_QUOTED_STRING (asm_file, string); | |
3640 #else | |
3641 char c; | |
3642 | |
3643 putc ('\"', asm_file); | |
3644 while ((c = *string++) != 0) | |
3645 { | |
3646 if (ISPRINT (c)) | |
3647 { | |
3648 if (c == '\"' || c == '\\') | |
3649 putc ('\\', asm_file); | |
3650 putc (c, asm_file); | |
3651 } | |
3652 else | |
3653 fprintf (asm_file, "\\%03o", (unsigned char) c); | |
3654 } | |
3655 putc ('\"', asm_file); | |
3656 #endif | |
3642 } | 3657 } |
3643 | 3658 |
3644 /* A poor man's fprintf, with the added features of %I, %R, %L, and %U. | 3659 /* A poor man's fprintf, with the added features of %I, %R, %L, and %U. |
3645 %R prints the value of REGISTER_PREFIX. | 3660 %R prints the value of REGISTER_PREFIX. |
3646 %L prints the value of LOCAL_LABEL_PREFIX. | 3661 %L prints the value of LOCAL_LABEL_PREFIX. |
3826 /* In this case the CONST_INT holds both target words. | 3841 /* In this case the CONST_INT holds both target words. |
3827 Extract the bits from it into two word-sized pieces. | 3842 Extract the bits from it into two word-sized pieces. |
3828 Sign extend each half to HOST_WIDE_INT. */ | 3843 Sign extend each half to HOST_WIDE_INT. */ |
3829 unsigned HOST_WIDE_INT low, high; | 3844 unsigned HOST_WIDE_INT low, high; |
3830 unsigned HOST_WIDE_INT mask, sign_bit, sign_extend; | 3845 unsigned HOST_WIDE_INT mask, sign_bit, sign_extend; |
3846 unsigned bits_per_word = BITS_PER_WORD; | |
3831 | 3847 |
3832 /* Set sign_bit to the most significant bit of a word. */ | 3848 /* Set sign_bit to the most significant bit of a word. */ |
3833 sign_bit = 1; | 3849 sign_bit = 1; |
3834 sign_bit <<= BITS_PER_WORD - 1; | 3850 sign_bit <<= bits_per_word - 1; |
3835 | 3851 |
3836 /* Set mask so that all bits of the word are set. We could | 3852 /* Set mask so that all bits of the word are set. We could |
3837 have used 1 << BITS_PER_WORD instead of basing the | 3853 have used 1 << BITS_PER_WORD instead of basing the |
3838 calculation on sign_bit. However, on machines where | 3854 calculation on sign_bit. However, on machines where |
3839 HOST_BITS_PER_WIDE_INT == BITS_PER_WORD, it could cause a | 3855 HOST_BITS_PER_WIDE_INT == BITS_PER_WORD, it could cause a |
3852 low |= sign_extend; | 3868 low |= sign_extend; |
3853 | 3869 |
3854 /* Pick the higher word, shifted to the least significant | 3870 /* Pick the higher word, shifted to the least significant |
3855 bits, and sign-extend it. */ | 3871 bits, and sign-extend it. */ |
3856 high = INTVAL (value); | 3872 high = INTVAL (value); |
3857 high >>= BITS_PER_WORD - 1; | 3873 high >>= bits_per_word - 1; |
3858 high >>= 1; | 3874 high >>= 1; |
3859 high &= mask; | 3875 high &= mask; |
3860 if (high & sign_bit) | 3876 if (high & sign_bit) |
3861 high |= sign_extend; | 3877 high |= sign_extend; |
3862 | 3878 |
4247 assemble_start_function (current_function_decl, fnname); | 4263 assemble_start_function (current_function_decl, fnname); |
4248 final_start_function (get_insns (), asm_out_file, optimize); | 4264 final_start_function (get_insns (), asm_out_file, optimize); |
4249 final (get_insns (), asm_out_file, optimize); | 4265 final (get_insns (), asm_out_file, optimize); |
4250 final_end_function (); | 4266 final_end_function (); |
4251 | 4267 |
4252 #ifdef TARGET_UNWIND_INFO | 4268 /* The IA-64 ".handlerdata" directive must be issued before the ".endp" |
4253 /* ??? The IA-64 ".handlerdata" directive must be issued before | 4269 directive that closes the procedure descriptor. Similarly, for x64 SEH. |
4254 the ".endp" directive that closes the procedure descriptor. */ | 4270 Otherwise it's not strictly necessary, but it doesn't hurt either. */ |
4255 output_function_exception_table (fnname); | 4271 output_function_exception_table (fnname); |
4256 #endif | |
4257 | 4272 |
4258 assemble_end_function (current_function_decl, fnname); | 4273 assemble_end_function (current_function_decl, fnname); |
4259 | |
4260 #ifndef TARGET_UNWIND_INFO | |
4261 /* Otherwise, it feels unclean to switch sections in the middle. */ | |
4262 output_function_exception_table (fnname); | |
4263 #endif | |
4264 | 4274 |
4265 user_defined_section_attribute = false; | 4275 user_defined_section_attribute = false; |
4266 | 4276 |
4267 /* Free up reg info memory. */ | 4277 /* Free up reg info memory. */ |
4268 free_reg_info (); | 4278 free_reg_info (); |
4361 if (flag_dump_final_insns) | 4371 if (flag_dump_final_insns) |
4362 { | 4372 { |
4363 final_output = fopen (flag_dump_final_insns, "a"); | 4373 final_output = fopen (flag_dump_final_insns, "a"); |
4364 if (!final_output) | 4374 if (!final_output) |
4365 { | 4375 { |
4366 error ("could not open final insn dump file %qs: %s", | 4376 error ("could not open final insn dump file %qs: %m", |
4367 flag_dump_final_insns, strerror (errno)); | 4377 flag_dump_final_insns); |
4368 flag_dump_final_insns = NULL; | 4378 flag_dump_final_insns = NULL; |
4369 } | 4379 } |
4370 else | 4380 else |
4371 { | 4381 { |
4372 const char *aname; | 4382 const char *aname; |
4390 | 4400 |
4391 for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) | 4401 for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) |
4392 if (LABEL_P (insn)) | 4402 if (LABEL_P (insn)) |
4393 INSN_UID (insn) = CODE_LABEL_NUMBER (insn); | 4403 INSN_UID (insn) = CODE_LABEL_NUMBER (insn); |
4394 else | 4404 else |
4395 INSN_UID (insn) = 0; | 4405 { |
4406 if (NOTE_P (insn)) | |
4407 set_block_for_insn (insn, NULL); | |
4408 INSN_UID (insn) = 0; | |
4409 } | |
4396 } | 4410 } |
4397 } | 4411 } |
4398 | 4412 |
4399 /* It is very important to decompose the RTL instruction chain here: | 4413 /* It is very important to decompose the RTL instruction chain here: |
4400 debug information keeps pointing into CODE_LABEL insns inside the function | 4414 debug information keeps pointing into CODE_LABEL insns inside the function |
4411 (NOTE_KIND (insn) != NOTE_INSN_VAR_LOCATION | 4425 (NOTE_KIND (insn) != NOTE_INSN_VAR_LOCATION |
4412 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_BEG | 4426 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_BEG |
4413 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END | 4427 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END |
4414 && NOTE_KIND (insn) != NOTE_INSN_CFA_RESTORE_STATE))) | 4428 && NOTE_KIND (insn) != NOTE_INSN_CFA_RESTORE_STATE))) |
4415 print_rtl_single (final_output, insn); | 4429 print_rtl_single (final_output, insn); |
4416 | |
4417 } | 4430 } |
4418 | 4431 |
4419 if (final_output) | 4432 if (final_output) |
4420 { | 4433 { |
4421 flag_dump_noaddr = save_noaddr; | 4434 flag_dump_noaddr = save_noaddr; |
4422 flag_dump_unnumbered = save_unnumbered; | 4435 flag_dump_unnumbered = save_unnumbered; |
4423 final_insns_dump_p = false; | 4436 final_insns_dump_p = false; |
4424 | 4437 |
4425 if (fclose (final_output)) | 4438 if (fclose (final_output)) |
4426 { | 4439 { |
4427 error ("could not close final insn dump file %qs: %s", | 4440 error ("could not close final insn dump file %qs: %m", |
4428 flag_dump_final_insns, strerror (errno)); | 4441 flag_dump_final_insns); |
4429 flag_dump_final_insns = NULL; | 4442 flag_dump_final_insns = NULL; |
4430 } | 4443 } |
4431 } | 4444 } |
4432 | 4445 |
4433 /* In case the function was not output, | 4446 /* In case the function was not output, |
4454 | 4467 |
4455 free_bb_for_insn (); | 4468 free_bb_for_insn (); |
4456 | 4469 |
4457 delete_tree_ssa (); | 4470 delete_tree_ssa (); |
4458 | 4471 |
4459 if (targetm.binds_local_p (current_function_decl)) | 4472 /* We can reduce stack alignment on call site only when we are sure that |
4473 the function body just produced will be actually used in the final | |
4474 executable. */ | |
4475 if (decl_binds_to_current_def_p (current_function_decl)) | |
4460 { | 4476 { |
4461 unsigned int pref = crtl->preferred_stack_boundary; | 4477 unsigned int pref = crtl->preferred_stack_boundary; |
4462 if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary) | 4478 if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary) |
4463 pref = crtl->stack_alignment_needed; | 4479 pref = crtl->stack_alignment_needed; |
4464 cgraph_rtl_info (current_function_decl)->preferred_incoming_stack_boundary | 4480 cgraph_rtl_info (current_function_decl)->preferred_incoming_stack_boundary |