From: Nick Clifton Date: Tue, 17 Sep 2002 19:29:12 +0000 (+0000) Subject: (output_return_instruction): Do not writeback the stack pointer when it is being... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1acdf8b0f9af8020d8eccc2862822e650e1b6d4;p=gcc.git (output_return_instruction): Do not writeback the stack pointer when it is being loaded. (output_return_instruction): Do not writeback the stack pointer when it is being loaded. (arm_output_epilogue): Likewise. From-SVN: r57256 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34852fe2cc3..78348154a2d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-09-17 Nick Clifton + + * config/arm/arm.c (output_return_instruction): Do not + writeback the stack pointer when it is being loaded. + (arm_output_epilogue): Likewise. + 2002-09-17 Kazu Hirata * optabs.c (prepare_cmp_insn): Let emit_library_call_value diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index acdce8ebaf5..41eb93a9c47 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -7325,6 +7325,8 @@ output_return_instruction (operand, really_return, reverse) /* Generate the load multiple instruction to restore the registers. */ if (frame_pointer_needed) sprintf (instr, "ldm%sea\t%%|fp, {", conditional); + else if (live_regs_mask & (1 << SP_REGNUM)) + sprintf (instr, "ldm%sfd\t%%|sp, {", conditional); else sprintf (instr, "ldm%sfd\t%%|sp!, {", conditional); @@ -7736,7 +7738,16 @@ arm_output_epilogue (really_return) asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM); } else if (saved_regs_mask) - print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask); + { + if (saved_regs_mask & (1 << SP_REGNUM)) + /* Note - write back to the stack register is not enabled + (ie "ldmfd sp!..."). We know that the stack pointer is + in the list of registers and if we add writeback the + instruction becomes UNPREDICTABLE. */ + print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask); + else + print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask); + } if (current_function_pretend_args_size) {