This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cfg merge part 19 - gcse tweek
> >
> > The problem is that gcse_emit_move_after, called from pre_delete creates an
> > instruction:
> >
> >
> > (insn 858 467 468 25 (nil) (set (reg/v:SF 210)
> > (reg:SF 258)) -1 (nil)
> > (nil))
> >
> > If you are trying to generate a move insn that 'just works', I suggest you look
> > at
> > gen_move_insn.
>
> Hmm, I sitll keep it reading that way. want_to_gcse does:
>
>
> /* Otherwise, check if we can make a valid insn from it. First initialize
> our test insn if we haven't already. */
> if (test_insn == 0)
> {
> test_insn
> = make_insn_raw (gen_rtx_SET (VOIDmode,
> gen_rtx_REG (word_mode,
> FIRST_PSEUDO_REGISTER * 2),
> const0_rtx));
> NEXT_INSN (test_insn) = PREV_INSN (test_insn) = 0;
> }
>
> /* Now make an insn like the one we would make when GCSE'ing and see if
> valid. */
> PUT_MODE (SET_DEST (PATTERN (test_insn)), GET_MODE (x));
> SET_SRC (PATTERN (test_insn)) = x;
> return ((icode = recog (PATTERN (test_insn), test_insn, &num_clobbers)) >= 0
> && (num_clobbers == 0 || ! added_clobbers_hard_reg_p (icode)));
>
> So basically it test that (set (destination) (register)) is a valid
> instruction and that is exactly what I emit. What did I missed?
> What I am affraid of is the fact that the dest don't have to be
> gneeral_operand, so passing it into gen_move is de-facto invalid.
I see it now. The code is allowing pseudo register clobbers to be
added. I guess proper fix is the to teach emit_gcse_move to add the
clobbers as well, like apply_change_group does? Makes this sense?
Honza
>
> Honza