Ulrich Weigand <email address hidden> writes:
> The (reg:SI 95 d16 [orig:149 lx ] [149]) is generated by the
> cprop_hardreg pass substituting d16 for r2 inside a var_location debug
> insn.
>
> Of course, the regcprop.c code does perform the usual back-end checks:
>
> static bool
> mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
> unsigned int regno ATTRIBUTE_UNUSED)
> {
> if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
> return false;
>
> #ifdef CANNOT_CHANGE_MODE_CLASS
> return !REG_CANNOT_CHANGE_MODE_P (regno, orig_mode, new_mode);
> #endif
>
> return true;
> }
We ought to be checking HARD_REGNO_MODE_OK as well. That's required
for correctness even on targets for which CANNOT_CHANGE_MODE_CLASS
is not defined.
CANNOT_CHANGE_MODE_CLASS is designed to be used in cases where mode
changes aren't allowed even though the old and new registers are
valid as far as HARD_REGNO_MODE_OK is concerned.
Ulrich Weigand <email address hidden> writes: CHANGE_ MODE_CLASS CHANGE_ MODE_P (regno, orig_mode, new_mode);
> The (reg:SI 95 d16 [orig:149 lx ] [149]) is generated by the
> cprop_hardreg pass substituting d16 for r2 inside a var_location debug
> insn.
>
> Of course, the regcprop.c code does perform the usual back-end checks:
>
> static bool
> mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
> unsigned int regno ATTRIBUTE_UNUSED)
> {
> if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
> return false;
>
> #ifdef CANNOT_
> return !REG_CANNOT_
> #endif
>
> return true;
> }
We ought to be checking HARD_REGNO_MODE_OK as well. That's required CHANGE_ MODE_CLASS
for correctness even on targets for which CANNOT_
is not defined.
CANNOT_ CHANGE_ MODE_CLASS is designed to be used in cases where mode
changes aren't allowed even though the old and new registers are
valid as far as HARD_REGNO_MODE_OK is concerned.
Richard