Problem in gen_reload(), seeking an explanation

Joern Rennecke amylaar@cygnus.co.uk
Wed Jun 30 15:43:00 GMT 1999


> Hmm, something like this?
> 
> --- reload1.c   1999/05/08 01:34:55     1.145
> +++ reload1.c   1999/06/21 20:30:19
> @@ -7819,9 +7819,13 @@ gen_reload (out, in, opnum, type)
>          DEFINE_PEEPHOLE should be specified that recognizes the sequence
>          we emit below.  */
> 
> +      code = (int) add_optab->handlers[(int) GET_MODE (out)].insn_code;
> +
>        if (CONSTANT_P (op1) || GET_CODE (op1) == MEM || GET_CODE (op1) == SUBREG
>           || (GET_CODE (op1) == REG
> -             && REGNO (op1) >= FIRST_PSEUDO_REGISTER))
> +             && REGNO (op1) >= FIRST_PSEUDO_REGISTER)
> +         || (code != CODE_FOR_nothing
> +             && ! (*insn_operand_predicate[code][2]) (op1, insn_operand_mode[code][2])))
>         tem = op0, op0 = op1, op1 = tem;
> 
>        gen_reload (out, op0, opnum, type);

Yes.  The comment above the patch would have to be updated, of course.

> Actually I believe this solution is way better than the regclass approach. Do I
> have to guard this with a (GET_CODE (op1) == REG && REGNO (op1) <
> FIRST_PSEUDO_REGISTER)?

No, that shouldn't be necessary.  If the predicate returns false, the
add can't be recognized.



More information about the Gcc mailing list