PATCH: PA PIC symbolic memory fix PART 2

John David Anglin dave@hiauly1.hia.nrc.ca
Wed Feb 21 09:58:00 GMT 2001


>   > PIC references because the register used to construct the LO_SUM must
>   > be kept alive or saved in the frame.  It is better to keep the register
>   > with the address result alive, and let the intermediate temporary register
>   > die.
> Actually, it can easily cut down the number of registers.
> 
> Instead of extending the lifetime of the destination of the HIGH, you
> simply resynthesize the HIGH when you need it.  It's just an addil
> instruction, which is way cheap.

Hmm.  This suggests that the the DLT load insn should again be a separate
insn.  Then, when a spill occurs for a source MEM equivalent pseudo, the
destination register could be used as a scratch register to resynthesize
the HIGH part.  However, we then have to ensure that reload does generate
a spill when it encounters a PIC DLT reference and resolve the insn
recognition issues.

This suggests another idea.  Instead of breaking the load insn for
a long pic_ref into two parts, possibly this could be represented in the
rtl as a single insn.  For example,

(set (reg:) (mem: (low_sum: (plus: (pic_offset_table_rtx) (high: (symbol))
			    (unspec: [(symbol)] 0))))

The register reg can be used for the intermediate result of the plus
and the life issue goes away because the MEM is now stable modulo the
restore of the pic register after function calls.

I don't know enough about splitters but possibly this could be split
after reload for further optimisation.  The HP linker can also eliminate
unnecessary addil's.

> 
>   > This patch is simple and should have limited side effects.  It allows
>   > me to do a full bootstrap check in PIC mode, something that has not
>   > been possible previously for hppa1.1-hp-hpux10.20.
>   > 
>   > Please review?
>   > 
>   > Dave
>   > -- 
>   > J. David Anglin                                  dave.anglin@nrc.ca
>   > National Research Council of Canada              (613) 990-0752 (FAX: 952-6
>   > 605)
>   > 
>   > 2001-02-17  John David Anglin  <dave@hiauly1.hia.nrc.ca>
>   > 
>   > 	* local-alloc.c (update_equiv_regs): Only add REG_EQUIV notes to MEMs
>   > 	that are not unstable.
> Let's just hold off for a little while so that I can think this through
> carefully.  
> 
> One of the problems (in my mind) is we've got too many patches flying by
> all to fix the same set of problems or symptoms of those problems.

You still can't compile c-typeck.c with -fPIC without a fix to the zombie
MEM problem, or stopping the equivalences from being generated in the first
place as with this patch.  I agree that backend issues can't be tested or
resolved with this patch in place.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)



More information about the Gcc-patches mailing list