2000-09-18 Alexandre Oliva <aoliva@redhat.com>
+ * config/sh/sh.c (sh_expand_prologue): Mark GOTaddr2picreg as
+ MAYBE_DEAD.
+ (sh_expand_epilogue): Take the PIC register into account when
+ computing the frame size.
+
* config/sh/sh.c (nonpic_symbol_mentioned_p): Check LABEL_REFs.
* config/sh/sh.md (sym_label2reg, symPLT_label2reg): Protect
LABEL_REFs with a PIC-safe unspec.
if (flag_pic && (current_function_uses_pic_offset_table
|| regs_ever_live[PIC_OFFSET_TABLE_REGNUM]))
- emit_insn (gen_GOTaddr2picreg ());
+ {
+ rtx insn = get_last_insn ();
+ rtx insn_end = emit_insn (gen_GOTaddr2picreg ());
+ while (insn != insn_end)
+ {
+ insn = NEXT_INSN (insn);
+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
+ const0_rtx,
+ REG_NOTES (insn));
+ }
+ }
if (target_flags != save_flags)
emit_insn (gen_toggle_sz ());
live_regs_mask = calc_live_regs (&d, &live_regs_mask2);
+ if (flag_pic && current_function_uses_pic_offset_table)
+ {
+ if ((live_regs_mask & (1 << PIC_OFFSET_TABLE_REGNUM)) != 0)
+ abort ();
+ live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
+ d += UNITS_PER_WORD;
+ }
+
frame_size = rounded_frame_size (d);
if (frame_pointer_needed)
if (target_flags != save_flags)
emit_insn (gen_toggle_sz ());
- if (flag_pic && current_function_uses_pic_offset_table)
- live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
if (live_regs_mask & (1 << PR_REG))
pop (PR_REG);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)