This is the mail archive of the gcc@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]

Re: extra rtl at end of function


dj@redhat.com (DJ Delorie) writes:

> The two specific problems I ran into with pseudos are:
> 
> 1. Making sure they're in the right hard registers when I reference
>    the symbol.  Unfortunately, I don't know if the symbol will use
>    gp/tp until after reload when I'm emitting the asms for it (well, I
>    know beforehand, but how do you code a gp-relative load in rtx?,
>    such that it knows the difference between that and using gp as a
>    generic base pointer with a symbol?)

I don't understand this bit, but I'm worried that you might be making
the mistake that the rs6000 port used to make, which is to try to represent
loads (in this case, of addresses) as

(set (reg 3) (symbol_ref "foo"))

when no such instruction really existed, and the real instruction was

(set (reg 3) (mem (plus (reg 31) (unspec (symbol_ref "foo")))))

where the 'unspec' meant that the access was really to 'foo@got'.  The
reason this became impossible was that the compiler never knew when
reg 31 was used, and so the load of register 31 in the prolog would
get scheduled down to nearly the end of the procedure.

As a general rule, if you find that you have two things that are
really different but that you are representing the same way in RTL,
you need to re-think your RTL generation.

You can force a pseudo into the right hard register by simply having
a constraint that only accepts that register.

> 2. Making sure the gp/tp registers have the right value at the end of
>    the function.  Currently the epilogue handles it, but it would be
>    more efficient to add a (set) from the pseudo, in case the right
>    value happens to be in a register at the moment.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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