This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Fix location for pic register save on trunk
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Subject: Re: PATCH: Fix location for pic register save on trunk
- From: Alan Modra <amodra at bigpond dot net dot au>
- Date: Tue, 19 Jun 2001 11:02:27 +0930
- Cc: gcc-patches at gcc dot gnu dot org
- References: <200106181803.OAA22502@hiauly1.hia.nrc.ca>
On Mon, Jun 18, 2001 at 02:03:32PM -0400, John David Anglin wrote:
> This patch changes the location used for the pic register save to be the
> same as that used in the 3.0 release. With this patch installed, the g++
> and v3 testsuite results are essentially identical to those of the release.
>
> Without the patch, there are a large number of g++ and v3 failures. I posted
Oh, why did I ever change this code? Can I suggest this slightly cleaner
variation which avoids the {push,pop}_topmost_sequence in most cases?
hppa-linux-gcc has been using this (minus your comment) for quite a
while.
Index: gcc/config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.112
diff -u -p -r1.112 pa.c
--- pa.c 2001/05/07 01:50:52 1.112
+++ pa.c 2001/06/19 01:09:18
@@ -3364,19 +3364,24 @@ hppa_expand_epilogue ()
void
hppa_init_pic_save ()
{
- rtx insn, picreg;
+ rtx insn, picreg, where;
picreg = gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM);
PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode);
RTX_UNCHANGING_P (PIC_OFFSET_TABLE_SAVE_RTX) = 1;
insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, picreg);
- /* Emit the insn at the beginning of the function after the prologue. */
- if (tail_recursion_reentry)
- emit_insn_before (insn, tail_recursion_reentry);
- else
- /* We must have been called via PROFILE_HOOK. */
- emit_insn (insn);
+ /* Emit the insn at the beginning of the function after the prologue.
+ The save must come before the NOTE_INSN_FUNCTION_BEG note. EH
+ inserts its setup insns just after this note. */
+ where = last_parm_insn;
+ if (!where)
+ {
+ push_topmost_sequence ();
+ where = get_insns ();
+ pop_topmost_sequence ();
+ }
+ emit_insn_after (insn, where);
}
void