@@ -53,7 +53,7 @@ extern void xtensa_expand_atomic (enum rtx_code, rtx, rtx, rtx, bool);
extern void xtensa_emit_loop_end (rtx_insn *, rtx *);
extern char *xtensa_emit_branch (bool, rtx *);
extern char *xtensa_emit_movcc (bool, bool, bool, rtx *);
-extern void xtensa_expand_call (int, rtx *);
+extern void xtensa_expand_call (int, rtx *, bool);
extern char *xtensa_emit_call (int, rtx *);
extern char *xtensa_emit_sibcall (int, rtx *);
extern bool xtensa_tls_referenced_p (rtx);
@@ -76,7 +76,7 @@ extern void xtensa_setup_frame_addresses (void);
extern int xtensa_debugger_regno (int);
extern long compute_frame_size (poly_int64);
extern void xtensa_expand_prologue (void);
-extern void xtensa_expand_epilogue (bool);
+extern void xtensa_expand_epilogue (void);
extern void xtensa_adjust_reg_alloc_order (void);
extern enum reg_class xtensa_regno_to_class (int regno);
extern HOST_WIDE_INT xtensa_initial_elimination_offset (int from, int to);
@@ -2239,7 +2239,7 @@ xtensa_emit_movcc (bool inverted, bool isfp, bool isbool, rtx *operands)
void
-xtensa_expand_call (int callop, rtx *operands)
+xtensa_expand_call (int callop, rtx *operands, bool sibcall_p)
{
rtx call;
rtx_insn *call_insn;
@@ -2281,6 +2281,14 @@ xtensa_expand_call (int callop, rtx *operands)
CALL_INSN_FUNCTION_USAGE (call_insn) =
gen_rtx_EXPR_LIST (Pmode, clob, CALL_INSN_FUNCTION_USAGE (call_insn));
}
+ else if (sibcall_p)
+ {
+ /* Sibling call requires a return address to the caller, similar to
+ "return" insn. */
+ rtx use = gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, A0_REG));
+ CALL_INSN_FUNCTION_USAGE (call_insn) =
+ gen_rtx_EXPR_LIST (Pmode, use, CALL_INSN_FUNCTION_USAGE (call_insn));
+ }
}
@@ -3671,7 +3679,7 @@ xtensa_expand_prologue (void)
}
void
-xtensa_expand_epilogue (bool sibcall_p)
+xtensa_expand_epilogue (void)
{
if (!TARGET_WINDOWED_ABI)
{
@@ -3736,10 +3744,6 @@ xtensa_expand_epilogue (bool sibcall_p)
stack_pointer_rtx,
EH_RETURN_STACKADJ_RTX));
}
- if (sibcall_p)
- emit_use (gen_rtx_REG (SImode, A0_REG));
- else
- emit_jump_insn (gen_return ());
}
void
@@ -2553,7 +2553,7 @@
(match_operand 1 "" ""))]
""
{
- xtensa_expand_call (0, operands);
+ xtensa_expand_call (0, operands, false);
DONE;
})
@@ -2574,7 +2574,7 @@
(match_operand 2 "" "")))]
""
{
- xtensa_expand_call (1, operands);
+ xtensa_expand_call (1, operands, false);
DONE;
})
@@ -2595,7 +2595,7 @@
(match_operand 1 "" ""))]
"!TARGET_WINDOWED_ABI"
{
- xtensa_expand_call (0, operands);
+ xtensa_expand_call (0, operands, true);
DONE;
})
@@ -2616,7 +2616,7 @@
(match_operand 2 "" "")))]
"!TARGET_WINDOWED_ABI"
{
- xtensa_expand_call (1, operands);
+ xtensa_expand_call (1, operands, true);
DONE;
})
@@ -2723,7 +2723,8 @@
[(return)]
""
{
- xtensa_expand_epilogue (false);
+ xtensa_expand_epilogue ();
+ emit_jump_insn (gen_return ());
DONE;
})
@@ -2731,7 +2732,7 @@
[(return)]
"!TARGET_WINDOWED_ABI"
{
- xtensa_expand_epilogue (true);
+ xtensa_expand_epilogue ();
DONE;
})