===================================================================
@@ -9335,7 +9335,7 @@
[(return)]
""
{
- sh_expand_epilogue (1);
+ sh_expand_epilogue (true);
if (TARGET_SHCOMPACT)
{
rtx insn, set;
@@ -10154,9 +10154,12 @@
}
[(set_attr "type" "load_media")])
+(define_expand "simple_return"
+ [(simple_return)])
+
(define_expand "return"
- [(return)]
- "reload_completed && ! sh_need_epilogue ()"
+ [(simple_return)]
+ "reload_completed && epilogue_completed"
{
if (TARGET_SHMEDIA)
{
@@ -10172,8 +10175,8 @@
}
})
-(define_insn "*return_i"
- [(return)]
+(define_insn "*<code>_i"
+ [(RETURN)]
"TARGET_SH1 && ! (TARGET_SHCOMPACT
&& (crtl->args.info.call_cookie
& CALL_COOKIE_RET_TRAMP (1)))
@@ -10299,19 +10302,12 @@
(define_expand "prologue"
[(const_int 0)]
""
-{
- sh_expand_prologue ();
- DONE;
-})
+ "sh_expand_prologue (); DONE;")
(define_expand "epilogue"
[(return)]
""
-{
- sh_expand_epilogue (0);
- emit_jump_insn (gen_return ());
- DONE;
-})
+ "sh_expand_epilogue (false);")
(define_expand "eh_return"
[(use (match_operand 0 "register_operand" ""))]
===================================================================
@@ -34,3 +34,5 @@
(define_mode_attr disp04 [(QI "K04") (HI "K05")])
(define_mode_attr disp12 [(QI "K12") (HI "K13")])
+;; Code iterator for return codes.
+(define_code_iterator RETURN [return simple_return])
===================================================================
@@ -117,7 +117,6 @@
extern int sh_media_register_for_return (void);
extern void sh_expand_prologue (void);
extern void sh_expand_epilogue (bool);
-extern bool sh_need_epilogue (void);
extern void sh_set_return_address (rtx, rtx);
extern int initial_elimination_offset (int, int);
extern bool fldi_ok (void);
===================================================================
@@ -7901,22 +7901,6 @@
static int sh_need_epilogue_known = 0;
-bool
-sh_need_epilogue (void)
-{
- if (! sh_need_epilogue_known)
- {
- rtx epilogue;
-
- start_sequence ();
- sh_expand_epilogue (0);
- epilogue = get_insns ();
- end_sequence ();
- sh_need_epilogue_known = (epilogue == NULL ? -1 : 1);
- }
- return sh_need_epilogue_known > 0;
-}
-
/* Emit code to change the current function's return address to RA.
TEMP is available as a scratch register, if needed. */
@@ -7996,7 +7980,6 @@
sh_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
HOST_WIDE_INT size ATTRIBUTE_UNUSED)
{
- sh_need_epilogue_known = 0;
}
static rtx