comparison gcc/jump.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 /* Optimize jump instructions, for GNU compiler. 1 /* Optimize jump instructions, for GNU compiler.
2 Copyright (C) 1987-2017 Free Software Foundation, Inc. 2 Copyright (C) 1987-2018 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
121 rtx_insn *insn; 121 rtx_insn *insn;
122 for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) 122 for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
123 { 123 {
124 if (BARRIER_P (insn)) 124 if (BARRIER_P (insn))
125 { 125 {
126 rtx_insn *prev = prev_nonnote_insn (insn); 126 rtx_insn *prev = prev_nonnote_nondebug_insn (insn);
127 if (!prev) 127 if (!prev)
128 continue; 128 continue;
129
130 if (CALL_P (prev))
131 {
132 /* Make sure we do not split a call and its corresponding
133 CALL_ARG_LOCATION note. */
134 rtx_insn *next = NEXT_INSN (prev);
135
136 if (NOTE_P (next)
137 && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
138 prev = next;
139 }
140 129
141 if (BARRIER_P (prev)) 130 if (BARRIER_P (prev))
142 delete_insn (insn); 131 delete_insn (insn);
143 else if (prev != PREV_INSN (insn)) 132 else if (prev != PREV_INSN (insn))
144 { 133 {
1103 { 1092 {
1104 case PC: 1093 case PC:
1105 case CC0: 1094 case CC0:
1106 case REG: 1095 case REG:
1107 case CLOBBER: 1096 case CLOBBER:
1097 case CLOBBER_HIGH:
1108 case CALL: 1098 case CALL:
1109 return; 1099 return;
1110 1100
1111 case RETURN: 1101 case RETURN:
1112 case SIMPLE_RETURN: 1102 case SIMPLE_RETURN:
1276 /* If instruction is followed by a barrier, 1266 /* If instruction is followed by a barrier,
1277 delete the barrier too. */ 1267 delete the barrier too. */
1278 1268
1279 if (next != 0 && BARRIER_P (next)) 1269 if (next != 0 && BARRIER_P (next))
1280 delete_insn (next); 1270 delete_insn (next);
1281
1282 /* If this is a call, then we have to remove the var tracking note
1283 for the call arguments. */
1284
1285 if (CALL_P (insn)
1286 || (NONJUMP_INSN_P (insn)
1287 && GET_CODE (PATTERN (insn)) == SEQUENCE
1288 && CALL_P (XVECEXP (PATTERN (insn), 0, 0))))
1289 {
1290 rtx_insn *p;
1291
1292 for (p = next && next->deleted () ? NEXT_INSN (next) : next;
1293 p && NOTE_P (p);
1294 p = NEXT_INSN (p))
1295 if (NOTE_KIND (p) == NOTE_INSN_CALL_ARG_LOCATION)
1296 {
1297 remove_insn (p);
1298 break;
1299 }
1300 }
1301 1271
1302 /* If deleting a jump, decrement the count of the label, 1272 /* If deleting a jump, decrement the count of the label,
1303 and delete the label if it is now unused. */ 1273 and delete the label if it is now unused. */
1304 1274
1305 if (jump_to_label_p (insn)) 1275 if (jump_to_label_p (insn))
1722 if ((code == REG || (code == SUBREG && REG_P (SUBREG_REG (x)))) 1692 if ((code == REG || (code == SUBREG && REG_P (SUBREG_REG (x))))
1723 && (REG_P (y) || (GET_CODE (y) == SUBREG 1693 && (REG_P (y) || (GET_CODE (y) == SUBREG
1724 && REG_P (SUBREG_REG (y))))) 1694 && REG_P (SUBREG_REG (y)))))
1725 { 1695 {
1726 int reg_x = -1, reg_y = -1; 1696 int reg_x = -1, reg_y = -1;
1727 int byte_x = 0, byte_y = 0; 1697 poly_int64 byte_x = 0, byte_y = 0;
1728 struct subreg_info info; 1698 struct subreg_info info;
1729 1699
1730 if (GET_MODE (x) != GET_MODE (y)) 1700 if (GET_MODE (x) != GET_MODE (y))
1731 return 0; 1701 return 0;
1732 1702
1779 reg_y = REGNO (y); 1749 reg_y = REGNO (y);
1780 if (reg_renumber[reg_y] >= 0) 1750 if (reg_renumber[reg_y] >= 0)
1781 reg_y = reg_renumber[reg_y]; 1751 reg_y = reg_renumber[reg_y];
1782 } 1752 }
1783 1753
1784 return reg_x >= 0 && reg_x == reg_y && byte_x == byte_y; 1754 return reg_x >= 0 && reg_x == reg_y && known_eq (byte_x, byte_y);
1785 } 1755 }
1786 1756
1787 /* Now we have disposed of all the cases 1757 /* Now we have disposed of all the cases
1788 in which different rtx codes can match. */ 1758 in which different rtx codes can match. */
1789 if (code != GET_CODE (y)) 1759 if (code != GET_CODE (y))
1871 break; 1841 break;
1872 return 0; 1842 return 0;
1873 } 1843 }
1874 break; 1844 break;
1875 1845
1846 case 'p':
1847 if (maybe_ne (SUBREG_BYTE (x), SUBREG_BYTE (y)))
1848 return 0;
1849 break;
1850
1876 case 't': 1851 case 't':
1877 if (XTREE (x, i) != XTREE (y, i)) 1852 if (XTREE (x, i) != XTREE (y, i))
1878 return 0; 1853 return 0;
1879 break; 1854 break;
1880 1855