No functional changes.
gcc/ChangeLog:
* config/xtensa/xtensa-protos.h (xtensa_expand_call):
Add the third argument as boolean.
(xtensa_expand_epilogue): Remove the first argument.
* config/xtensa/xtensa.cc (xtensa_expand_call):
Add the third argument "sibcall_p", and modify in order to prepend
"(use A0_REG)" to CALL_INSN_FUNCTION_USAGE if the argument is true.
(xtensa_expand_epilogue): Remove the first argument "sibcall_p" and
its conditional clause.
* config/xtensa/xtensa.md (call, call_value, sibcall, sibcall_value):
Append a boolean value to the argument of xtensa_expand_call()
indicating whether it is sibling call or not.
(epilogue): Remove the boolean argument from xtensa_expand_epilogue(),
and then append emitting "(return)".
(sibcall_epilogue): Remove the boolean argument from
xtensa_expand_epilogue().
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);
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);
void
-xtensa_expand_call (int callop, rtx *operands)
+xtensa_expand_call (int callop, rtx *operands, bool sibcall_p)
{
rtx call;
rtx_insn *call_insn;
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));
+ }
}
}
void
-xtensa_expand_epilogue (bool sibcall_p)
+xtensa_expand_epilogue (void)
{
if (!TARGET_WINDOWED_ABI)
{
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
(match_operand 1 "" ""))]
""
{
- xtensa_expand_call (0, operands);
+ xtensa_expand_call (0, operands, false);
DONE;
})
(match_operand 2 "" "")))]
""
{
- xtensa_expand_call (1, operands);
+ xtensa_expand_call (1, operands, false);
DONE;
})
(match_operand 1 "" ""))]
"!TARGET_WINDOWED_ABI"
{
- xtensa_expand_call (0, operands);
+ xtensa_expand_call (0, operands, true);
DONE;
})
(match_operand 2 "" "")))]
"!TARGET_WINDOWED_ABI"
{
- xtensa_expand_call (1, operands);
+ xtensa_expand_call (1, operands, true);
DONE;
})
[(return)]
""
{
- xtensa_expand_epilogue (false);
+ xtensa_expand_epilogue ();
+ emit_jump_insn (gen_return ());
DONE;
})
[(return)]
"!TARGET_WINDOWED_ABI"
{
- xtensa_expand_epilogue (true);
+ xtensa_expand_epilogue ();
DONE;
})