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


Geoff Keating <geoffk@geoffk.org> writes:
> Richard Henderson <rth@redhat.com>:
> > It's a somewhat clever scheme to reduce the number of got entries
> > for local data.  Instead of having one entry per referenced local,
> > you have one entry per 64k "page".  Addresses are formed with
> > 
> > 	lw  r2, %got_page(x)(gp)
> > 	la  r3, %got_ofst(x)(r2)
> > 
> > and of course the second insn can also be folded into memory 
> > operations, so it's often effectively free.
> > 
> > Of course, this *could* be represented just as (HIGH X).
> 
> OK, that makes sense.  In that case, the right thing to do is to
> represent the first instruction as something like:
> 
> (set (reg r2) (mem ...)) (REG_EQUIV (high (symbol_ref "x")))

Right.  That's exactly what MIPS port does.  And from a correctness
POV, it seems to work.

The problem is that combine can optimise something like:

    (set (reg x) (high (symbol_ref "foo")))
    (set (reg y) (lo_sum (reg x) (symbol_ref "foo")))
    (set (reg z) (plus (reg y) (const_int 4)))

into:

    (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)))))

But it doesn't know how to do that when you use a mem for
the high part.  The point of this patch is to tell it.

Richard


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