Millicode calls, GP register, ld -r
John David Anglin
dave@hiauly1.hia.nrc.ca
Sat, 12 Aug 2000 12:07:56 -0400 (EDT)
> Alan Modra <alan@linuxcare.com.au> writes:
>
> > I'll install a slightly modified version of your patch. The other PLABEL
> > relocs should be handled as for PLABEL32, not that it matters for gcc
> > output as I've never caught gcc generating code that used PLABEL14R and
> > PLABEL21L. A pity, because current gcc PIC code for handling function
> > pointers is rather inefficient. Typically, you get something like:
> >
> > .LC1:
> > .word P'bar
> > .
> > .
> > addil LT'.LC1,%r19
> > ldw RT'.LC1(%r1),%r22
> > ldw 0(%r22),%r22
> >
> > which could all be replaced with
> >
> > ldil LP'bar,%r22
> > ldo RP'bar(%r22),%r22
> >
> > saving on code size, memory accesses, and relocs.
>
> Interesting. It would be trivial to hack that into GCC, I just wonder
> if there's some good reason it hasn't been done before.
The HP linker `-O' option eliminates unnecessary ADDIL instructions and
dead procedures. Probably, it wasn't deemed necessary. However, not
many remember to include -Wl,-O in their link flags.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)