This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unrevied patches^3


Richard Henderson <rth@redhat.com> writes:
> On Mon, Oct 20, 2003 at 06:28:29PM +0100, Richard Sandiford wrote:
> >     (set (reg x) (high (const (plus (symbol_ref "foo") (const_int 4)))))
> >     (set (reg y)
> > 	 (lo_sum (reg x) (const (plus (symbol_ref "foo") (const_int 4)))))
> 
> Eh?  Why would this be wrong?  Can the relocs not handle this?

It isn't wrong!  I'm obviously not explaining this very well at all.

  1. The mips port currently uses (set (reg x) (mem ...)) to load a
     page address from the GOT.  We attach a REG_EQUAL note to say
     that it's equal to (high ...).

  2. The move expanders will convert (set (reg x) (high ...)) into the
     (set (reg x) (mem ...)) form.  If, like combine, you create a
     (set (reg x) (high...)) insn directly, it won't be recognised.

  3. Combine can only optimise the three instructions I posted by
     creating the two instructions above.  If either one of the
     insns doesn't match, the optimisation is rejected.

All I'm trying to do is to get combine to optimize:

    (set (reg x) (mem ...))
    (set (reg y) (lo_sum (reg x) ...))
    (set (reg z) (plus (reg y) (const_int 4)))

into the equivalent two-insn sequence.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]