On Mon, Jul 4, 2011 at 12:57 PM, Richard Sandiford
<rdsandif...@googlemail.com> wrote:
> "H.J. Lu" <hongjiu...@intel.com> writes:
>> RTL-based forward propagation pass shouldn't propagate hard register.
>
> That's seems a bit draconian.  Many fixed hard registers ought to be OK.
> E.g. there doesn't seem to be anything wrong with propagating uses of
> the stack or frame pointers, subject to the usual availability checks.
>
> To play devil's advocate, an alternative might be to
>
> (a) make local_ref_killed_between_p return true for non-fixed hard
>    registers when a call or asm comes between the two instructions
>
> (b) make use_killed_between return true for non-fixed hard registers
>    when the instructions are in different basic blocks
>
> Thoughts?
>

There are a few problems with this suggestions:

1. The comments says:

/* If USE is a subreg, see if it can be replaced by a pseudo.  */

static bool
forward_propagate_subreg (df_ref use, rtx def_insn, rtx def_set)
{

It indicates this function is intended to work on pseudo registers.

2. propagate_rtx avoids hard registers:

static rtx
propagate_rtx (rtx x, enum machine_mode mode, rtx old_rtx, rtx new_rtx,
               bool speed)
{
  rtx tem;
  bool collapsed;
  int flags;

  if (REG_P (new_rtx) && REGNO (new_rtx) < FIRST_PSEUDO_REGISTER)
    return NULL_RTX;

It seems that fwprop is intended to deal with pseudo registers.  If we
want to extend it to hard registers, that should be a separate project.

Thanks.

-- 
H.J.

Reply via email to