GCC with patches for OS216
Revision | c84a15b040a179e4ce28fca2636ed88b0503517b (tree) |
---|---|
Zeit | 1999-10-12 14:44:39 |
Autor | Jeffrey A Law <law@cygn...> |
Commiter | Jeff Law |
regmove.c (fixup_match_1): Don't change an unchanging register.
From-SVN: r29910
@@ -1,5 +1,11 @@ | ||
1 | 1 | Mon Oct 11 23:35:19 1999 Jeffrey A Law (law@cygnus.com) |
2 | 2 | |
3 | + Thu Sep 2 20:08:23 1999 J"orn Rennecke <amylaar@cygnus.co.uk> | |
4 | + * regmove.c (fixup_match_1): Don't change an unchanging register. | |
5 | + (stable_but_for_p): Renamed to: | |
6 | + (stable_and_no_regs_but_for_p). Reject unchanging registers too. | |
7 | + Changed all callers. | |
8 | + | |
3 | 9 | Tue Aug 17 22:06:11 1999 Jan Hubicka <hubicka@freesoft.cz> |
4 | 10 | * haifa-sched.c (insn_unit): Fix typo on out of range test. |
5 | 11 | * sched.c (insn_unit): Likewise. |
@@ -62,7 +62,7 @@ static int find_matches PROTO((rtx, struct match *)); | ||
62 | 62 | static int fixup_match_1 PROTO((rtx, rtx, rtx, rtx, rtx, int, int, int, FILE *)) |
63 | 63 | ; |
64 | 64 | static int reg_is_remote_constant_p PROTO((rtx, rtx, rtx)); |
65 | -static int stable_but_for_p PROTO((rtx, rtx, rtx)); | |
65 | +static int stable_and_no_regs_but_for_p PROTO((rtx, rtx, rtx)); | |
66 | 66 | static int regclass_compatible_p PROTO((int, int)); |
67 | 67 | static int loop_depth; |
68 | 68 |
@@ -1663,6 +1663,12 @@ fixup_match_1 (insn, set, src, src_subreg, dst, backward, operand_number, | ||
1663 | 1663 | rtx src_note = find_reg_note (insn, REG_DEAD, src), dst_note; |
1664 | 1664 | int length, s_length, true_loop_depth; |
1665 | 1665 | |
1666 | + /* If SRC is marked as unchanging, we may not change it. | |
1667 | + ??? Maybe we could get better code by removing the unchanging bit | |
1668 | + instead, and changing it back if we don't succeed? */ | |
1669 | + if (RTX_UNCHANGING_P (src)) | |
1670 | + return 0; | |
1671 | + | |
1666 | 1672 | if (! src_note) |
1667 | 1673 | { |
1668 | 1674 | /* Look for (set (regX) (op regA constX)) |
@@ -1679,7 +1685,7 @@ fixup_match_1 (insn, set, src, src_subreg, dst, backward, operand_number, | ||
1679 | 1685 | && XEXP (SET_SRC (set), 0) == src |
1680 | 1686 | && GET_CODE (XEXP (SET_SRC (set), 1)) == CONST_INT) |
1681 | 1687 | insn_const = INTVAL (XEXP (SET_SRC (set), 1)); |
1682 | - else if (! stable_but_for_p (SET_SRC (set), src, dst)) | |
1688 | + else if (! stable_and_no_regs_but_for_p (SET_SRC (set), src, dst)) | |
1683 | 1689 | return 0; |
1684 | 1690 | else |
1685 | 1691 | /* We might find a src_note while scanning. */ |
@@ -2089,10 +2095,16 @@ fixup_match_1 (insn, set, src, src_subreg, dst, backward, operand_number, | ||
2089 | 2095 | } |
2090 | 2096 | |
2091 | 2097 | |
2092 | -/* return nonzero if X is stable but for mentioning SRC or mentioning / | |
2093 | - changing DST . If in doubt, presume it is unstable. */ | |
2098 | +/* return nonzero if X is stable and mentions no regsiters but for | |
2099 | + mentioning SRC or mentioning / changing DST . If in doubt, presume | |
2100 | + it is unstable. | |
2101 | + The rationale is that we want to check if we can move an insn easily | |
2102 | + while just paying attention to SRC and DST. A register is considered | |
2103 | + stable if it has the RTX_UNCHANGING_P bit set, but that would still | |
2104 | + leave the burden to update REG_DEAD / REG_UNUSED notes, so we don't | |
2105 | + want any registers but SRC and DST. */ | |
2094 | 2106 | static int |
2095 | -stable_but_for_p (x, src, dst) | |
2107 | +stable_and_no_regs_but_for_p (x, src, dst) | |
2096 | 2108 | rtx x, src, dst; |
2097 | 2109 | { |
2098 | 2110 | RTX_CODE code = GET_CODE (x); |
@@ -2103,13 +2115,19 @@ stable_but_for_p (x, src, dst) | ||
2103 | 2115 | int i; |
2104 | 2116 | char *fmt = GET_RTX_FORMAT (code); |
2105 | 2117 | for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) |
2106 | - if (fmt[i] == 'e' && ! stable_but_for_p (XEXP (x, i), src, dst)) | |
2118 | + if (fmt[i] == 'e' | |
2119 | + && ! stable_and_no_regs_but_for_p (XEXP (x, i), src, dst)) | |
2107 | 2120 | return 0; |
2108 | 2121 | return 1; |
2109 | 2122 | } |
2110 | 2123 | case 'o': |
2111 | - if (x == src || x == dst) | |
2112 | - return 1; | |
2124 | + if (code == REG) | |
2125 | + return x == src || x == dst; | |
2126 | + /* If this is a MEM, look inside - there might be a register hidden in | |
2127 | + the address of an unchanging MEM. */ | |
2128 | + if (code == MEM | |
2129 | + && ! stable_and_no_regs_but_for_p (XEXP (x, 0), src, dst)) | |
2130 | + return 0; | |
2113 | 2131 | /* fall through */ |
2114 | 2132 | default: |
2115 | 2133 | return ! rtx_unstable_p (x); |