From: Richard Kenner Date: Wed, 28 Jun 1995 22:04:16 +0000 (-0400) Subject: (hppa_save_pic_table_rtx): Delete variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=853e4dfd6b4c79cb0948cda20af3b84d59fc531b;p=gcc.git (hppa_save_pic_table_rtx): Delete variable. (hppa_expand_prologue): For PIC generation, copy the PIC register into a fixed callee register at the end of the prologue of non-leaf functions. From-SVN: r10088 --- diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 22d2b4f9a9b..f2c7acc774e 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -48,8 +48,6 @@ enum processor_type pa_cpu; /* String to hold which cpu we are scheduling for. */ char *pa_cpu_string; -rtx hppa_save_pic_table_rtx; - /* Set by the FUNCTION_PROFILER macro. */ int hp_profile_labelno; @@ -2348,6 +2346,27 @@ hppa_expand_prologue() fr_saved++; } } + + /* When generating PIC code it is necessary to save/restore the + PIC register around each function call. We used to do this + in the call patterns themselves, but that implementation + made incorrect assumptions about using global variables to hold + per-function rtl code generated in the backend. + + So instead, we copy the PIC register into a reserved callee saved + register in the prologue. Then after each call we reload the PIC + register from the callee saved register. We also reload the PIC + register from the callee saved register in the epilogue ensure the + PIC register is valid at function exit. + + This may (depending on the exact characteristics of the function) + even be more efficient. + + Avoid this if the callee saved register wasn't used (these are + leaf functions. */ + if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM_SAVED]) + emit_move_insn (gen_rtx (REG, SImode, PIC_OFFSET_TABLE_REGNUM_SAVED), + gen_rtx (REG, SImode, PIC_OFFSET_TABLE_REGNUM)); }