diff options
author | Jeffrey A Law <law@cygnus.com> | 1999-10-12 05:44:39 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-10-11 23:44:39 -0600 |
commit | c84a15b040a179e4ce28fca2636ed88b0503517b (patch) | |
tree | 81455d0c66323dbfd56e35a9b22529f0996a4230 | |
parent | 8650dafc19d2a48f2d81b58ec6d20efd7d4b76e6 (diff) | |
download | gcc-c84a15b040a179e4ce28fca2636ed88b0503517b.zip gcc-c84a15b040a179e4ce28fca2636ed88b0503517b.tar.gz gcc-c84a15b040a179e4ce28fca2636ed88b0503517b.tar.bz2 |
regmove.c (fixup_match_1): Don't change an unchanging register.
Thu Sep 2 20:08:23 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
* regmove.c (fixup_match_1): Don't change an unchanging register.
(stable_but_for_p): Renamed to:
(stable_and_no_regs_but_for_p). Reject unchanging registers too.
Changed all callers.
From-SVN: r29910
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/regmove.c | 34 |
2 files changed, 32 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d7b339d7..2b4d598 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ Mon Oct 11 23:35:19 1999 Jeffrey A Law (law@cygnus.com) + Thu Sep 2 20:08:23 1999 J"orn Rennecke <amylaar@cygnus.co.uk> + * regmove.c (fixup_match_1): Don't change an unchanging register. + (stable_but_for_p): Renamed to: + (stable_and_no_regs_but_for_p). Reject unchanging registers too. + Changed all callers. + Tue Aug 17 22:06:11 1999 Jan Hubicka <hubicka@freesoft.cz> * haifa-sched.c (insn_unit): Fix typo on out of range test. * sched.c (insn_unit): Likewise. diff --git a/gcc/regmove.c b/gcc/regmove.c index 81a3520..8008595 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -62,7 +62,7 @@ static int find_matches PROTO((rtx, struct match *)); static int fixup_match_1 PROTO((rtx, rtx, rtx, rtx, rtx, int, int, int, FILE *)) ; static int reg_is_remote_constant_p PROTO((rtx, rtx, rtx)); -static int stable_but_for_p PROTO((rtx, rtx, rtx)); +static int stable_and_no_regs_but_for_p PROTO((rtx, rtx, rtx)); static int regclass_compatible_p PROTO((int, int)); static int loop_depth; @@ -1663,6 +1663,12 @@ fixup_match_1 (insn, set, src, src_subreg, dst, backward, operand_number, rtx src_note = find_reg_note (insn, REG_DEAD, src), dst_note; int length, s_length, true_loop_depth; + /* If SRC is marked as unchanging, we may not change it. + ??? Maybe we could get better code by removing the unchanging bit + instead, and changing it back if we don't succeed? */ + if (RTX_UNCHANGING_P (src)) + return 0; + if (! src_note) { /* Look for (set (regX) (op regA constX)) @@ -1679,7 +1685,7 @@ fixup_match_1 (insn, set, src, src_subreg, dst, backward, operand_number, && XEXP (SET_SRC (set), 0) == src && GET_CODE (XEXP (SET_SRC (set), 1)) == CONST_INT) insn_const = INTVAL (XEXP (SET_SRC (set), 1)); - else if (! stable_but_for_p (SET_SRC (set), src, dst)) + else if (! stable_and_no_regs_but_for_p (SET_SRC (set), src, dst)) return 0; else /* We might find a src_note while scanning. */ @@ -2089,10 +2095,16 @@ fixup_match_1 (insn, set, src, src_subreg, dst, backward, operand_number, } -/* return nonzero if X is stable but for mentioning SRC or mentioning / - changing DST . If in doubt, presume it is unstable. */ +/* return nonzero if X is stable and mentions no regsiters but for + mentioning SRC or mentioning / changing DST . If in doubt, presume + it is unstable. + The rationale is that we want to check if we can move an insn easily + while just paying attention to SRC and DST. A register is considered + stable if it has the RTX_UNCHANGING_P bit set, but that would still + leave the burden to update REG_DEAD / REG_UNUSED notes, so we don't + want any registers but SRC and DST. */ static int -stable_but_for_p (x, src, dst) +stable_and_no_regs_but_for_p (x, src, dst) rtx x, src, dst; { RTX_CODE code = GET_CODE (x); @@ -2103,13 +2115,19 @@ stable_but_for_p (x, src, dst) int i; char *fmt = GET_RTX_FORMAT (code); for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - if (fmt[i] == 'e' && ! stable_but_for_p (XEXP (x, i), src, dst)) + if (fmt[i] == 'e' + && ! stable_and_no_regs_but_for_p (XEXP (x, i), src, dst)) return 0; return 1; } case 'o': - if (x == src || x == dst) - return 1; + if (code == REG) + return x == src || x == dst; + /* If this is a MEM, look inside - there might be a register hidden in + the address of an unchanging MEM. */ + if (code == MEM + && ! stable_and_no_regs_but_for_p (XEXP (x, 0), src, dst)) + return 0; /* fall through */ default: return ! rtx_unstable_p (x); |