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
- 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.
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],