patch for 930513-1 on Darwin

Geoff Keating geoffk@geoffk.org
Tue Jun 5 10:32:00 GMT 2001


Dale Johannesen <dalej@apple.com> writes:

> On Thursday, May 31, 2001, at 06:03  PM, Dale Johannesen wrote:
> > On Thursday, May 31, 2001, at 05:52  PM, Richard Henderson wrote:
> >> On Thu, May 31, 2001 at 04:59:37PM -0700, dalej@apple.com wrote:
> >>> On Darwin, the required syntax for a function name is different
> >>> when you call it and when you pass its address, so the inliner
> >>> needs to change things to compensate.
> >>
> >> Err... no it doesn't.  You can get into the same issue without
> >> inlining if you CSE a function address into a call pattern.
> >
> > Hmm, for some reason the function address doesn't seem to get put into 
> > the call in this case, but you're right, obviously it should.   I'll 
> > check it out.
> 
> This turns out to be interesting.  With -static, a function address is 
> pushed forward into a call in a case like this:
>     int (*p) = foo;
>    (*p)();
> It is combine, not cse, that does this, and it does so because combine 
> has hardwired code that knows that (lo_sum (high foo) foo)==(foo).
> 
> The usual case on Darwin, however, is pic, and there is no analogous 
> code in combine for pic trees, so the substitution does not take place.  
> Do you think it might be a good idea to add such code?  Pic trees are 
> different on different targets, of course, so it would have to be a 
> macro.  (I can also imagine that this substitution might not be a good 
> idea with pic on some targets.)

Normally you set a REG_EQUIV note and this tells combine that p is &foo.

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



More information about the Gcc-patches mailing list