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
This commit is contained in:
Jeff Law 1998-08-22 17:21:24 -06:00
parent edfac33e82
commit e757da5ef3
2 changed files with 21 additions and 11 deletions

View File

@ -32,6 +32,7 @@ extern int constrain_operands PROTO((int, int));
extern int memory_address_p PROTO((enum machine_mode, rtx));
extern int strict_memory_address_p PROTO((enum machine_mode, rtx));
extern int validate_replace_rtx PROTO((rtx, rtx, rtx));
extern void validate_replace_rtx_group PROTO((rtx, rtx, rtx));
extern int validate_replace_src PROTO((rtx, rtx, rtx));
extern int reg_fits_class_p PROTO((rtx, enum reg_class, int,
enum machine_mode));

View File

@ -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);
}