]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/32406 (MIPS: FAIL in nestfunc-6.c at -O3)
authorRichard Sandiford <rsandifo@nildram.co.uk>
Wed, 28 Nov 2007 19:46:03 +0000 (19:46 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 28 Nov 2007 19:46:03 +0000 (19:46 +0000)
gcc/
PR target/32406
* builtins.c (expand_builtin_nonlocal_goto): Also emit a use
of GP register, if valid and fixed.

Revert:
2007-06-21  David Daney  <ddaney@avtrex.com>

PR target/32406
* config/mips/mips.md (define_constants): Rename UNSPEC_EH_RECEIVER
to UNSPEC_NONLOCAL_GOTO_RECEIVER globally.
(exception_receiver): Renamed to ...
(nonlocal_goto_receiver): ... this.

From-SVN: r130493

gcc/ChangeLog
gcc/builtins.c
gcc/config/mips/mips.md

index 9262b26e7293a5a9c708b326df3c4a5d01d3ae06..34f345377c5841ff4c1d895759696cf48e95831e 100644 (file)
@@ -1,3 +1,18 @@
+2007-11-28  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR target/32406
+       * builtins.c (expand_builtin_nonlocal_goto): Also emit a use
+       of GP register, if valid and fixed.
+
+       Revert:
+       2007-06-21  David Daney  <ddaney@avtrex.com>
+
+       PR target/32406
+       * config/mips/mips.md (define_constants): Rename UNSPEC_EH_RECEIVER
+       to UNSPEC_NONLOCAL_GOTO_RECEIVER globally.
+       (exception_receiver): Renamed to ...
+       (nonlocal_goto_receiver): ... this.
+
 2007-11-27  H.J. Lu  <hongjiu.lu@intel.com>
            Joey Ye <joey.ye@intel.com>
 
index 5befd422bb0b931299fd601c1edc50f3fffa5afb..630cd2506ecb6f6a3ad8e27ce0c030f7d1b6b29a 100644 (file)
@@ -909,6 +909,20 @@ expand_builtin_nonlocal_goto (tree exp)
         not clear if really needed.  */
       emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
       emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
+
+      /* If the architecture is using a GP register, we must
+        conservatively assume that the target function makes use of it.
+        The prologue of functions with nonlocal gotos must therefore
+        initialize the GP register to the appropriate value, and we
+        must then make sure that this value is live at the point
+        of the jump.  (Note that this doesn't necessarily apply
+        to targets with a nonlocal_goto pattern; they are free
+        to implement it in their own way.  Note also that this is
+        a no-op if the GP register is a global invariant.)  */
+      if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
+         && fixed_regs[PIC_OFFSET_TABLE_REGNUM])
+       emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
+
       emit_indirect_jump (r_label);
     }
 
index 18879ec2e5564cdfb88bc002794d59dfaa675860..f1225f61386c4d306905cadfc6096ef493bbeee3 100644 (file)
@@ -30,7 +30,7 @@
    (UNSPEC_GET_FNADDR           3)
    (UNSPEC_BLOCKAGE             4)
    (UNSPEC_CPRESTORE            5)
-   (UNSPEC_NONLOCAL_GOTO_RECEIVER 6)
+   (UNSPEC_EH_RECEIVER          6)
    (UNSPEC_EH_RETURN            7)
    (UNSPEC_CONSTTABLE_INT       8)
    (UNSPEC_CONSTTABLE_FLOAT     9)
   DONE;
 })
 
-(define_insn_and_split "nonlocal_goto_receiver"
+(define_insn_and_split "exception_receiver"
   [(set (reg:SI 28)
-       (unspec_volatile:SI [(const_int 0)] UNSPEC_NONLOCAL_GOTO_RECEIVER))]
+       (unspec_volatile:SI [(const_int 0)] UNSPEC_EH_RECEIVER))]
   "TARGET_CALL_CLOBBERED_GP"
   "#"
   "&& reload_completed"