diff options
Diffstat (limited to 'gcc/config/m68k/m68k.c')
-rw-r--r-- | gcc/config/m68k/m68k.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 98f51978ac8..9567c9d63a8 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -126,24 +126,6 @@ override_options () m68k_align_funcs = def_align; } -/* Emit a (use pic_offset_table_rtx) if we used PIC relocation in the - function at any time during the compilation process. In the future - we should try and eliminate the USE if we can easily determine that - all PIC references were deleted from the current function. That would - save an address register */ - -void -finalize_pic () -{ - if (flag_pic && current_function_uses_pic_offset_table) - { - rtx insn = gen_rtx_USE (VOIDmode, pic_offset_table_rtx); - emit_insn_after (insn, get_insns ()); - emit_insn (insn); - } -} - - /* This function generates the assembly code for function entry. STREAM is a stdio stream to output the code to. SIZE is an int: how many units of temporary storage to allocate. @@ -260,10 +242,10 @@ output_function_prologue (stream, size) /* asm_fprintf() cannot handle %. */ #ifdef MOTOROLA asm_fprintf (stream, "\tsubq.w %0I8,%Rsp\n\tsubq.w %0I%d,%Rsp\n", - fsize + 4); + fsize + 4 - 8); #else asm_fprintf (stream, "\tsubqw %0I8,%Rsp\n\tsubqw %0I%d,%Rsp\n", - fsize + 4); + fsize + 4 - 8); #endif } else @@ -374,6 +356,11 @@ output_function_prologue (stream, size) mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM)); num_saved_regs--; } + if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM]) + { + mask |= 1 << (15 - PIC_OFFSET_TABLE_REGNUM); + num_saved_regs++; + } #if NEED_PROBE #ifdef MOTOROLA @@ -581,6 +568,11 @@ output_function_epilogue (stream, size) nregs++; mask |= 1 << regno; } + if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM]) + { + nregs++; + mask |= 1 << PIC_OFFSET_TABLE_REGNUM; + } offset = foffset + nregs * 4; /* FIXME : leaf_function_p below is too strong. What we really need to know there is if there could be pending @@ -798,10 +790,10 @@ output_function_epilogue (stream, size) /* asm_fprintf() cannot handle %. */ #ifdef MOTOROLA asm_fprintf (stream, "\taddq.w %0I8,%Rsp\n\taddq.w %0I%d,%Rsp\n", - fsize + 4); + fsize + 4 - 8); #else asm_fprintf (stream, "\taddqw %0I8,%Rsp\n\taddqw %0I%d,%Rsp\n", - fsize + 4); + fsize + 4 - 8); #endif } else |