This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PowerPC] Fix PR25176: Array_3 bytecode->native test fail
On Thu, Dec 01, 2005 at 07:50:55PM +1030, Alan Modra wrote:
> A quick fix is relatively easy.
This is the powerpc fix I'm currently testing. I've verified that it
fixes the libjava test failure for powerpc64-linux, but bootstrap and
regression test on both powerpc-linux and powerpc64-linux are not yet
complete.
gen_blockage stops all instructions from crossing the stack restore.
Perhaps it is an unnecessarily big hammer, but I was worried about
floating point instructions crossing the stack restore.
PR target/25176
* config/rs6000/rs6000.c (rs6000_emit_epilogue): Emit blockage at
stack restore for dwarf2 exceptions.
Index: gcc/config/rs6000/rs6000.c
===================================================================
*** gcc/config/rs6000/rs6000.c (revision 107758)
--- gcc/config/rs6000/rs6000.c (working copy)
*************** rs6000_emit_epilogue (int sibcall)
*** 14711,14719 ****
if (DEFAULT_ABI == ABI_V4)
frame_reg_rtx = gen_rtx_REG (Pmode, 11);
emit_move_insn (frame_reg_rtx,
gen_rtx_MEM (Pmode, sp_reg_rtx));
-
}
else if (info->push_p)
{
--- 14703,14717 ----
if (DEFAULT_ABI == ABI_V4)
frame_reg_rtx = gen_rtx_REG (Pmode, 11);
+ /* Don't allow potentially trapping instructions to cross the
+ stack pointer restore. We don't emit unwind info for the
+ epilogue, so the unwinder will use an incorrect cfa for any
+ exception taken after the restore. */
+ else if (!USING_SJLJ_EXCEPTIONS && flag_exceptions)
+ emit_insn (gen_blockage ());
+
emit_move_insn (frame_reg_rtx,
gen_rtx_MEM (Pmode, sp_reg_rtx));
}
else if (info->push_p)
{
*************** rs6000_emit_epilogue (int sibcall)
*** 14722,14727 ****
--- 14720,14727 ----
sp_offset = info->total_size;
else
{
+ if (!USING_SJLJ_EXCEPTIONS && flag_exceptions)
+ emit_insn (gen_blockage ());
emit_insn (TARGET_32BIT
? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
GEN_INT (info->total_size))
*************** rs6000_emit_epilogue (int sibcall)
*** 14947,14975 ****
}
/* If this is V.4, unwind the stack pointer after all of the loads
! have been done. We need to emit a block here so that sched
! doesn't decide to move the sp change before the register restores
! (which may not have any obvious dependency on the stack). This
! doesn't hurt performance, because there is no scheduling that can
! be done after this point. */
! if (DEFAULT_ABI == ABI_V4
! || current_function_calls_eh_return)
{
! if (frame_reg_rtx != sp_reg_rtx)
rs6000_emit_stack_tie ();
!
! if (use_backchain_to_restore_sp)
! {
! emit_move_insn (sp_reg_rtx, frame_reg_rtx);
! }
! else if (sp_offset != 0)
! {
! emit_insn (TARGET_32BIT
! ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
! GEN_INT (sp_offset))
! : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
! GEN_INT (sp_offset)));
! }
}
if (current_function_calls_eh_return)
--- 14947,14974 ----
}
/* If this is V.4, unwind the stack pointer after all of the loads
! have been done. */
! if (frame_reg_rtx != sp_reg_rtx)
{
! if (!USING_SJLJ_EXCEPTIONS && flag_exceptions)
! /* This block is needed for proper unwinding. See the comment
! earlier in this function. */
! emit_insn (gen_blockage ());
! else
! /* This less rigorous block is needed so that sched doesn't
! decide to move the sp change before the register restores. */
rs6000_emit_stack_tie ();
! emit_move_insn (sp_reg_rtx, frame_reg_rtx);
! }
! else if (sp_offset != 0)
! {
! if (!USING_SJLJ_EXCEPTIONS && flag_exceptions)
! emit_insn (gen_blockage ());
! emit_insn (TARGET_32BIT
! ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
! GEN_INT (sp_offset))
! : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
! GEN_INT (sp_offset)));
}
if (current_function_calls_eh_return)
--
Alan Modra
IBM OzLabs - Linux Technology Centre