From: Hans-Peter Nilsson Date: Thu, 9 Sep 2004 20:36:31 +0000 (+0000) Subject: re PR target/17377 (cris.md bug in "return" pattern trigged by __builtin_return_address) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2416742352d9a2def00e2a63a6c90bdbda910f6;p=gcc.git re PR target/17377 (cris.md bug in "return" pattern trigged by __builtin_return_address) PR target/17377 * config/cris/cris-protos.h (cris_return_address_on_stack): Declare. * config/cris/cris.c (cris_return_address_on_stack): New function. * config/cris/cris.md ("return"): For location of return address, also check cris_return_address_on_stack. From-SVN: r87251 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7df898152fa..8d1f90fd476 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-09 Hans-Peter Nilsson + + PR target/17377 + * config/cris/cris-protos.h (cris_return_address_on_stack): Declare. + * config/cris/cris.c (cris_return_address_on_stack): New function. + * config/cris/cris.md ("return"): For location of return address, + also check cris_return_address_on_stack. + 2004-09-09 Diego Novillo * tree-outof-ssa.c (coalesce_abnormal_edges): Fix typo in diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h index 0e65dc2da8c..15e91df8a59 100644 --- a/gcc/config/cris/cris-protos.h +++ b/gcc/config/cris/cris-protos.h @@ -47,6 +47,8 @@ extern int cris_cfun_uses_pic_table (void); extern void cris_target_asm_named_section (const char *, unsigned int); #endif /* RTX_CODE */ +extern int cris_return_address_on_stack (void); + extern void cris_pragma_expand_mul (struct cpp_reader *); /* Need one that returns an int; usable in expressions. */ diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 25db5ecc34f..468859f9f42 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -1700,6 +1700,15 @@ cris_return_addr_rtx (int count, rtx frameaddr ATTRIBUTE_UNUSED) : NULL_RTX; } +/* Accessor used in cris.md:return because cfun->machine isn't available + there. */ + +int +cris_return_address_on_stack () +{ + return cfun->machine->needs_return_address_on_stack; +} + /* This used to be the INITIAL_FRAME_POINTER_OFFSET worker; now only handles FP -> SP elimination offset. */ diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 4001a2a3b31..be137a58d61 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -3415,7 +3415,8 @@ if (i >= 0) sprintf (rd, \"movem [$sp+],$%s\", reg_names [i]); - if (regs_ever_live[CRIS_SRP_REGNUM]) + if (regs_ever_live[CRIS_SRP_REGNUM] + || cris_return_address_on_stack ()) { if (*rd) output_asm_insn (rd, operands); @@ -3433,7 +3434,10 @@ }" [(set (attr "slottable") (if_then_else - (ne (symbol_ref "regs_ever_live[CRIS_SRP_REGNUM]") (const_int 0)) + (ne (symbol_ref + "(regs_ever_live[CRIS_SRP_REGNUM] + || cris_return_address_on_stack ())") + (const_int 0)) (const_string "no") ; If jump then not slottable. (if_then_else (ne (symbol_ref