Painful problems with -fpic implementation on powerpc-sysv

H.J. Lu hjl@lucon.org
Thu Aug 20 09:57:00 GMT 1998


> The underlying problem for both of these is the same.
> 
> The powerpc -fpic implementation works by allocating a pseudo to hold
> the GOT pointer, when required, (in the routine rs6000_got_register).
> In rs6000_finalise_pic, the pseudo is initialised.  The result is used
> in the movsi_got_internal insn.
> 
> There are two problems with this:
> 
> 1. rs6000_finalise_pic is run before reload.  But sometimes reload can
>    create a new memory reference (see, for instance, test4.c).  So
>    rs6000_finalise_pic does not know where all the memory references
>    are, or even if there are any at all.
> 
> 2. Worse, rs6000_finalise_pic is actually run before scheduling, and
>    so the scheduler can get the dependencies wrong if new memory
>    references appear later.  For instance, in test3.c after local
>    register allocation, there is:
> 

That sounds similar to the x86 -fPIC/-fomit-frame-pointer bug we fixed
earlier. What we did was to make sure the PIC register is used when in
 doubt:

Sun Jul 26 01:11:12 1998  H.J. Lu  (hjl@gnu.org)
       
        * i386.h (CONST_DOUBLE_OK_FOR_LETTER_P): Return 0 when eliminating
        the frame pointer and compiling PIC code and reload has not completed.
   
Can you do something like that for PPC?


H.J.



More information about the Gcc mailing list