This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
bug ? apply_change_group & insn_invalid_p
- To: gcc at gcc dot gnu dot org
- Subject: bug ? apply_change_group & insn_invalid_p
- From: Denis Chertykov <denisc at overta dot ru>
- Date: Fri, 10 Aug 2001 20:00:49 +0400
The `apply_change_group' wide used in GCC for applying changes to
insns and check insns.
Description of apply_change_group:
/* Apply a group of changes previously issued with `validate_change'.
Return 1 if all changes are valid, zero otherwise. */
`apply_change_group' use the `insn_invalid_p' for checking an insn
validity.
But, the `insn_invalid_p' even not test a result of `recog'.
Is this right ?
Denis.
insn_invalid_p:
/* This subroutine of apply_change_group verifies whether the changes to INSN
were valid; i.e. whether INSN can still be recognized. */
int
insn_invalid_p (insn)
rtx insn;
{
rtx pat = PATTERN (insn);
int num_clobbers = 0;
/* If we are before reload and the pattern is a SET, see if we can add
clobbers. */
int icode = recog (pat, insn,
(GET_CODE (pat) == SET
&& ! reload_completed && ! reload_in_progress)
? &num_clobbers : 0);
int is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0;
/* If this is an asm and the operand aren't legal, then fail. Likewise if
this is not an asm and the insn wasn't recognized. */
if ((is_asm && ! check_asm_operands (PATTERN (insn)))
|| (!is_asm && icode < 0))
return 1;
/* If we have to add CLOBBERs, fail if we have to add ones that reference
hard registers since our callers can't know if they are live or not.
Otherwise, add them. */
if (num_clobbers > 0)
{
rtx newpat;
if (added_clobbers_hard_reg_p (icode))
return 1;
newpat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (num_clobbers + 1));
XVECEXP (newpat, 0, 0) = pat;
add_clobbers (newpat, icode);
PATTERN (insn) = pat = newpat;
}
/* After reload, verify that all constraints are satisfied. */
if (reload_completed)
{
extract_insn (insn);
if (! constrain_operands (1))
return 1;
}
INSN_CODE (insn) = icode;
return 0;
}
The `insn_invalid_p' even not test return of `recog' and returns 0
even if insn invalid.
Denis.