OSDN Git Service

* (hppa_init_pic_save): Emit the pic offset table
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Feb 2001 04:51:24 +0000 (04:51 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Feb 2001 04:51:24 +0000 (04:51 +0000)
        reg save after last_parm_insn.
        * pa.c (hppa_init_pic_save): New function.
        * pa.h (hppa_init_pic_save): Declare.
        * pa.md (call, call_value, sibcall, sibcall_value): Use
        the above instead of duplicated code.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39386 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/pa/pa.md

index f9c693a..0ec6c1a 100644 (file)
@@ -1,5 +1,12 @@
 2001-01-31  Alan Modra <alan@linuxcare.com.au>
 
+       * (hppa_init_pic_save): Emit the pic offset table
+       reg save after last_parm_insn.
+       * pa.c (hppa_init_pic_save): New function.
+       * pa.h (hppa_init_pic_save): Declare.
+       * pa.md (call, call_value, sibcall, sibcall_value): Use
+       the above instead of duplicated code.
+
        * pa.c (hppa_encode_label): Correct size of alloca buffer
        so we don't overrun it.  Correct leading `*' case.
        * pa.h (STRIP_NAME_ENCODING): Simplify now that we don't
index 738afbe..a7a0b9e 100644 (file)
@@ -3371,6 +3371,21 @@ hppa_expand_epilogue ()
                    - actual_fsize);
 }
 
+/* Set up a callee saved register for the pic offset table register.  */
+void hppa_init_pic_save ()
+{
+  rtx insn, picreg;
+
+  picreg = gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM);
+  PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode);
+  insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, picreg);
+
+  /* Emit the insn at the beginning of the function after the prologue.  */
+  push_topmost_sequence ();
+  emit_insn_after (insn, last_parm_insn ? last_parm_insn : get_insns ());
+  pop_topmost_sequence ();
+}
+
 /* Fetch the return address for the frame COUNT steps up from
    the current frame, after the prologue.  FRAMEADDR is the
    frame pointer of the COUNT frame.
index a5c7a32..e20cffd 100644 (file)
@@ -503,6 +503,7 @@ extern int target_flags;
 /* Register into which we save the PIC_OFFSET_TABLE_REGNUM so that it
    can be restored across function calls.  */
 #define PIC_OFFSET_TABLE_SAVE_RTX (cfun->machine->pic_offset_table_save_rtx)
+extern void hppa_init_pic_save PARAMS ((void));
 
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
index 41dc77c..ac70bfd 100644 (file)
                                  GEN_INT (64)));
 
   if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX)
-    {
-      rtx insn;
-
-      PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode);
-      insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX,
-                         gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
-
-      /* Emit the insn at the beginning of the function after the prologue.  */
-      push_topmost_sequence ();
-      emit_insn_after (insn, get_insns ());
-      pop_topmost_sequence ();
-    }
+    hppa_init_pic_save ();
 
   /* Use two different patterns for calls to explicitly named functions
      and calls through function pointers.  This is necessary as these two
                                  GEN_INT (64)));
 
   if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX)
-    {
-      rtx insn;
-
-      PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode);
-      insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX,
-                         gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
-
-      /* Emit the insn at the beginning of the function after the prologue.  */
-      push_topmost_sequence ();
-      emit_insn_after (insn, get_insns ());
-      pop_topmost_sequence ();
-    }
+    hppa_init_pic_save ();
 
   /* Use two different patterns for calls to explicitly named functions
      and calls through function pointers.  This is necessary as these two
   op = XEXP (operands[0], 0);
 
   if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX)
-    {
-      rtx insn;
-
-      PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode);
-      insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX,
-                         gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
-
-      /* Emit the insn at the beginning of the function after the prologue.  */
-      push_topmost_sequence ();
-      emit_insn_after (insn, get_insns ());
-      pop_topmost_sequence ();
-    }
+    hppa_init_pic_save ();
 
   /* We do not allow indirect sibling calls.  */
   call_insn = emit_call_insn (gen_sibcall_internal_symref (op, operands[1]));
   op = XEXP (operands[1], 0);
 
   if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX)
-    {
-      rtx insn;
-
-      PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode);
-      insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX,
-                         gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
-
-      /* Emit the insn at the beginning of the function after the prologue.  */
-      push_topmost_sequence ();
-      emit_insn_after (insn, get_insns ());
-      pop_topmost_sequence ();
-    }
+    hppa_init_pic_save ();
 
   /* We do not allow indirect sibling calls.  */
   call_insn = emit_call_insn (gen_sibcall_value_internal_symref (operands[0],