aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips
diff options
context:
space:
mode:
authormacro <macro@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-01 12:56:08 +0000
committermacro <macro@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-01 12:56:08 +0000
commitd7143c09fba9a31bebdc0efb25ee63e0ed201cc2 (patch)
treed4b75e1a2a77fc2a2dc6d8c329b70a72f0679a3b /gcc/config/mips
parent3f4cf42da55e4d14969dde09a84d35e186544351 (diff)
* config/mips/mips.c (mips16_build_call_stub): Move the save of
the return address in $18 ahead of passing arguments to FPRs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218209 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/mips')
-rw-r--r--gcc/config/mips/mips.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 5a53d5fefc9..85992852cfe 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -6942,6 +6942,17 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code)
/* "Save" $sp in itself so we don't use the fake CFA.
This is: DW_CFA_val_expression r29, { DW_OP_reg29 }. */
fprintf (asm_out_file, "\t.cfi_escape 0x16,29,1,0x6d\n");
+
+ /* Save the return address in $18. The stub's caller knows
+ that $18 might be clobbered, even though $18 is usually
+ a call-saved register.
+
+ Do it early on in case the last move to a floating-point
+ register can be scheduled into the delay slot of the
+ call we are about to make. */
+ fprintf (asm_out_file, "\tmove\t%s,%s\n",
+ reg_names[GP_REG_FIRST + 18],
+ reg_names[RETURN_ADDR_REGNUM]);
}
else
{
@@ -6963,11 +6974,7 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code)
if (fp_ret_p)
{
- /* Save the return address in $18 and call the non-MIPS16 function.
- The stub's caller knows that $18 might be clobbered, even though
- $18 is usually a call-saved register. */
- fprintf (asm_out_file, "\tmove\t%s,%s\n",
- reg_names[GP_REG_FIRST + 18], reg_names[RETURN_ADDR_REGNUM]);
+ /* Now call the non-MIPS16 function. */
output_asm_insn (MIPS_CALL ("jal", &fn, 0, -1), &fn);
fprintf (asm_out_file, "\t.cfi_register 31,18\n");