This pattern is only emitted during function epilogue expansion (obviously
after register allocation), so putting reload_completed in the condition
is redundant.
This patch also changes the declaration of the return register (A0 address
register) required for normal function returns to properly defining the
EPILOGUE_USES macro, as is already done on other targets, rather than
placing '(use (reg:SI A0_REG))' RTX.
gcc/ChangeLog:
* config/xtensa/xtensa.h (EPILOGUE_USES): New macro definition.
* config/xtensa/xtensa.md (return):
Remove '(use (reg:SI A0_REG))' from the template description, and
reload_completed from the condition.
(sibcall_epilogue): Remove emitting '(use (reg:SI A0_REG))'.
/* Stack pointer value doesn't matter at exit. */
#define EXIT_IGNORE_STACK 1
+/* The "return" pattern requires A0 register as return address, and is
+ also required so that restoring A0 in the epilogue is not dead code. */
+#define EPILOGUE_USES(REGNO) ((REGNO) == A0_REG)
+
/* Size in bytes of the trampoline, as an integer. Make sure this is
a multiple of TRAMPOLINE_ALIGNMENT to avoid -Wpadded warnings. */
#define TRAMPOLINE_SIZE (TARGET_WINDOWED_ABI ? \
(set_attr "length" "3")])
(define_insn "return"
- [(return)
- (use (reg:SI A0_REG))]
- "reload_completed
- && (TARGET_WINDOWED_ABI
- || compute_frame_size (get_frame_size ()) == 0
- || epilogue_completed)"
+ [(return)]
+ "TARGET_WINDOWED_ABI
+ || compute_frame_size (get_frame_size ()) == 0
+ || epilogue_completed"
{
return TARGET_WINDOWED_ABI ?
(TARGET_DENSITY ? "retw.n" : "retw") :
"!TARGET_WINDOWED_ABI"
{
xtensa_expand_epilogue ();
- emit_use (gen_rtx_REG (SImode, A0_REG));
DONE;
})