diff options
author | Jeff Law <law@gcc.gnu.org> | 1998-08-22 17:21:24 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-08-22 17:21:24 -0600 |
commit | e757da5ef3e07c518620a35cbba35b5ac656fdcc (patch) | |
tree | 6e6ec836aedf9ef4467ecc2d2415fd0259f4e746 /gcc/regmove.c | |
parent | edfac33e828bec837550da110999793dd436a551 (diff) | |
download | gcc-e757da5ef3e07c518620a35cbba35b5ac656fdcc.tar.gz |
recog.c (validate_replace_rtx_group): New function.
�
* recog.c (validate_replace_rtx_group): New function.
* recog.h (validate_replace_rtx_group): Declare it.
* regmove.c (optimize_reg_copy_3): If any substitution fails, then undo
the entire group of substitutions.
From-SVN: r21910
Diffstat (limited to 'gcc/regmove.c')
-rw-r--r-- | gcc/regmove.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/gcc/regmove.c b/gcc/regmove.c index 089dc46e8a7..b4f7b6dd1bc 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -549,23 +549,32 @@ optimize_reg_copy_3 (insn, dest, src) old_mode = GET_MODE (src_reg); PUT_MODE (src_reg, GET_MODE (src)); XEXP (src, 0) = SET_SRC (set); - if (! validate_change (p, &SET_SRC (set), src, 0)) - { - PUT_MODE (src_reg, old_mode); - XEXP (src, 0) = src_reg; - return; - } + + /* Include this change in the group so that it's easily undone if + one of the changes in the group is invalid. */ + validate_change (p, &SET_SRC (set), src, 1); + + /* Now walk forward making additional replacements. We want to be able + to undo all the changes if a later substitution fails. */ subreg = gen_rtx_SUBREG (old_mode, src_reg, 0); while (p = NEXT_INSN (p), p != insn) { if (GET_RTX_CLASS (GET_CODE (p)) != 'i') continue; - /* If we can not perform the replacement, then abort now - to make debugging easier. */ - if (! validate_replace_rtx (src_reg, subreg, p)) - abort (); + + /* Make a tenative change. */ + validate_replace_rtx_group (src_reg, subreg, p); + } + + validate_replace_rtx_group (src, src_reg, insn); + + /* Now see if all the changes are valid. */ + if (! apply_change_group ()) + { + /* One or more changes were no good. Back out everything. */ + PUT_MODE (src_reg, old_mode); + XEXP (src, 0) = src_reg; } - validate_replace_rtx (src, src_reg, insn); } |