diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-06-28 18:04:16 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-06-28 18:04:16 -0400 |
commit | 853e4dfd6b4c79cb0948cda20af3b84d59fc531b (patch) | |
tree | 853cb032c624f3e233522696b9228af26e573d29 /gcc/config/pa/pa.c | |
parent | 71fce386de7a2a51bd05a36ef1e2ae2e019d35b1 (diff) | |
download | gcc-853e4dfd6b4c79cb0948cda20af3b84d59fc531b.zip gcc-853e4dfd6b4c79cb0948cda20af3b84d59fc531b.tar.gz gcc-853e4dfd6b4c79cb0948cda20af3b84d59fc531b.tar.bz2 |
(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
Diffstat (limited to 'gcc/config/pa/pa.c')
-rw-r--r-- | gcc/config/pa/pa.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 22d2b4f..f2c7acc 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)); } |