@@ -28,6 +28,7 @@ extern bool cris_reload_address_legitimized (rtx, machine_mode, int, int, int);
extern int cris_side_effect_mode_ok (enum rtx_code, rtx *, int, int,
int, int, int);
extern rtx cris_return_addr_rtx (int, rtx);
+extern rtx cris_eh_return_handler_rtx ();
extern rtx cris_split_movdx (rtx *);
extern bool cris_base_p (const_rtx, bool);
extern bool cris_base_or_autoincr_p (const_rtx, bool);
@@ -1382,6 +1382,22 @@ cris_return_addr_rtx (int count, rtx frameaddr ATTRIBUTE_UNUSED)
: NULL_RTX;
}
+/* Setting the EH return return address is done by a *store* to a memory
+ address expressed as relative to "*incoming* args". That store will
+ be optimized away, unless the MEM is marked as volatile. N.B.: no
+ optimization opportunities are expected to be lost due to this hack;
+ __builtin_eh_return isn't called from elsewhere than the EH machinery
+ in libgcc. */
+
+rtx
+cris_eh_return_handler_rtx ()
+{
+ rtx ret = cris_return_addr_rtx (0, NULL_RTX);
+ gcc_assert (MEM_P (ret));
+ MEM_VOLATILE_P (ret) = true;
+ return ret;
+}
+
/* Accessor used in cris.md:return because cfun->machine isn't available
there. */
@@ -551,8 +551,7 @@ enum reg_class
#define CRIS_STACKADJ_REG CRIS_STRUCT_VALUE_REGNUM
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CRIS_STACKADJ_REG)
-#define EH_RETURN_HANDLER_RTX \
- cris_return_addr_rtx (0, NULL)
+#define EH_RETURN_HANDLER_RTX cris_eh_return_handler_rtx ()
#define INIT_EXPANDERS cris_init_expanders ()