Reload bug (missing REG_INC note) & questions

Toshiyasu Morita tm@netcom.com
Thu Jan 6 18:56:00 GMT 2000


I'm currently tracking down a problem where reload generates rtxes with
no REG_INC notes. In particular, I'm seeing this rtx prior to reload:

(insn:HI 836 4541 837 (parallel[
            (set (mem:SF (plus:SI (reg:SI 14 r14)
                        (const_int 52)))
                (mem/s:SF (post_inc:SI (reg:SI 2 r2))))
            (use (reg/v:PSI 48 fpscr))
            (clobber (scratch:SI))
        ] ) 157 {movsf_ie} (insn_list 4541 (nil))
    (expr_list:REG_INC (reg:SI 2 r2)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

and post-reload it has been converted to:

(insn:HI 836 4916 837 (parallel[
            (set (mem:SF (plus:SI (reg:SI 14 r14)
                        (reg:SI 0 r0)))
                (reg:SF 24 fr0))
            (use (reg/v:PSI 48 fpscr))
            (clobber (scratch:SI))
        ] ) 157 {movsf_ie} (insn_list 4541 (nil))
    (expr_list:REG_DEAD (reg:SF 24 fr0)
        (expr_list:REG_INC (reg:SI 2 r2)		<- bad note!
            (expr_list:REG_UNUSED (scratch:SI)
                (nil)))))

The problem appears to be in emit_reload_insns(). This code block
is finally executed:

              if (! special && ! rtx_equal_p (reloadreg, oldequiv))
                {
                  rtx real_oldequiv = oldequiv;

                  if ((GET_CODE (oldequiv) == REG
                       && REGNO (oldequiv) >= FIRST_PSEUDO_REGISTER
                       && reg_equiv_memory_loc[REGNO (oldequiv)] != 0)
                      || (GET_CODE (oldequiv) == SUBREG
                          && GET_CODE (SUBREG_REG (oldequiv)) == REG
                          && (REGNO (SUBREG_REG (oldequiv))
                              >= FIRST_PSEUDO_REGISTER)
                          && (reg_equiv_memory_loc
                              [REGNO (SUBREG_REG (oldequiv))] != 0)))
                    real_oldequiv = reload_in[j];
                  gen_reload (reloadreg, real_oldequiv, reload_opnum[j],
                              reload_when_needed[j]);
                }

...and gen_reload(arg0, arg1, arg2, arg3) is called with the following
parameters:

  arg0 = (reg:SF 24 fr0);
  arg1 = (mem/s:SF (post_inc:SI (reg:SI 2 r2)))
  arg2 = 1;
  arg3 = RELOAD_FOR_INPUT;

I guess I have two questions regarding these parameters:

1) Are these reasonable parameters for emit_reload_insns?
   I ask this because emit_reload_insns() doesn't seem to create any
   REG_INC notes.

2) Given the orginal rtx, should inc_for_reload() have been called instead?

Toshi



More information about the Gcc-bugs mailing list