aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>2000-02-24 20:09:30 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2000-02-24 20:09:30 +0000
commitafbc2905362a947be1724eff9e8a26e90b62540a (patch)
tree694f3fe2f71de5bc92bf96d9e4a1b1f76113c13b
parent36c265b175b63f894eb3e2e4ade8eb183a28855d (diff)
downloadgcc-afbc2905362a947be1724eff9e8a26e90b62540a.zip
gcc-afbc2905362a947be1724eff9e8a26e90b62540a.tar.gz
gcc-afbc2905362a947be1724eff9e8a26e90b62540a.tar.bz2
Fix breakage from 6th Feb thread_prologue_and_epilogue_insns change:
* sh-protos.h (sh_need_epilogue): Declare. * sh.c (sh_need_epilogue_known): New static variable. (sh_need_epilogue): New function. (function_epilogue): Clear need_epilogue_known. * sh.md (return): Split into expander / insn pattern. Make the expander conditional on ! sh_need_epilogue (). From-SVN: r32136
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/sh/sh-protos.h1
-rw-r--r--gcc/config/sh/sh.c21
-rw-r--r--gcc/config/sh/sh.md12
4 files changed, 38 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 225b3bc..8194605 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+Thu Feb 24 20:04:11 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ Fix breakage from 6th Feb thread_prologue_and_epilogue_insns change:
+ * sh-protos.h (sh_need_epilogue): Declare.
+ * sh.c (sh_need_epilogue_known): New static variable.
+ (sh_need_epilogue): New function.
+ (function_epilogue): Clear need_epilogue_known.
+ * sh.md (return): Split into expander / insn pattern.
+ Make the expander conditional on ! sh_need_epilogue ().
+
2000-02-24 Nathan Sidwell <nathan@codesourcery.com>
* machmode.h (get_mode_alignment): Declare.
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index 273444b..402bf60 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -107,6 +107,7 @@ extern struct rtx_def *get_fpscr_rtx PARAMS ((void));
extern void output_file_start PARAMS ((FILE *));
extern void sh_expand_prologue PARAMS ((void));
extern void sh_expand_epilogue PARAMS ((void));
+extern int sh_need_epilogue PARAMS ((void));
extern void function_epilogue PARAMS ((FILE *, int));
extern int initial_elimination_offset PARAMS ((int, int));
extern void emit_fpscr_use PARAMS ((void));
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 8c10ca5..c90fdb3 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -3919,6 +3919,26 @@ sh_expand_epilogue ()
emit_insn (gen_sp_switch_2 ());
}
+static int sh_need_epilogue_known = 0;
+
+int
+sh_need_epilogue ()
+{
+ if (! sh_need_epilogue_known)
+ {
+ rtx epilogue;
+
+ start_sequence ();
+ sh_expand_epilogue ();
+ epilogue = gen_sequence ();
+ end_sequence ();
+ sh_need_epilogue_known
+ = (GET_CODE (epilogue) == SEQUENCE && XVECLEN (epilogue, 0) == 0
+ ? -1 : 1);
+ }
+ return sh_need_epilogue_known > 0;
+}
+
/* Clear variables at function end. */
void
@@ -3927,6 +3947,7 @@ function_epilogue (stream, size)
int size ATTRIBUTE_UNUSED;
{
trap_exit = pragma_interrupt = pragma_trapa = pragma_nosave_low_regs = 0;
+ sh_need_epilogue_known = 0;
sp_switch = NULL_RTX;
}
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 903199e..62aac30 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -3484,12 +3484,12 @@
}"
[(set_attr "length" "4")])
-;; ??? This is not the proper place to invoke another compiler pass;
-;; Alas, there is no proper place to put it.
-;; ??? This is also an odd place for the call to emit_fpscr_use. It
-;; would be all right if it were for an define_expand for return, but
-;; that doesn't mix with emitting a prologue.
-(define_insn "return"
+(define_expand "return"
+ [(return)]
+ "reload_completed && ! sh_need_epilogue ()"
+ "")
+
+(define_insn "*return_i"
[(return)]
"reload_completed"
"%@ %#"