This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Fix location for pic register save on trunk


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]