]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
builtins.c (expand_builtin_setjmp_receiver): Emit a use of the hard frame pointer.
authorRichard Sandiford <rdsandiford@googlemail.com>
Fri, 9 May 2014 10:16:14 +0000 (10:16 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 9 May 2014 10:16:14 +0000 (10:16 +0000)
gcc/
* builtins.c (expand_builtin_setjmp_receiver): Emit a use of
the hard frame pointer.  Synchronize commentary with mainline.
* cse.c (cse_insn): Only check for volatile asms.
* cselib.c (cselib_process_insn): Likewise.
* dse.c (scan_insn): Likewise.
* stmt.c (expand_nl_goto_receiver): Emit a use and a clobber of
the hard frame pointer.

From-SVN: r210266

gcc/ChangeLog
gcc/builtins.c
gcc/cse.c
gcc/cselib.c
gcc/dse.c
gcc/stmt.c

index 1de14a0691c7d81a3bb2ce0144b24277ea356f59..c2960259e3b66964c4faf21235b99f6b97bb96ce 100644 (file)
@@ -1,3 +1,13 @@
+2014-05-09  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * builtins.c (expand_builtin_setjmp_receiver): Emit a use of
+       the hard frame pointer.  Synchronize commentary with mainline.
+       * cse.c (cse_insn): Only check for volatile asms.
+       * cselib.c (cselib_process_insn): Likewise.
+       * dse.c (scan_insn): Likewise.
+       * stmt.c (expand_nl_goto_receiver): Emit a use and a clobber of
+       the hard frame pointer.
+
 2014-05-08  Manuel López-Ibáñez  <manu@gcc.gnu.org>
            Matthias Klose  <doko@ubuntu.com>
 
index 8851142a80c19f782d73842609b70d88dbdb0ff2..bb6c664394bc2dfdd7cdcfa502c3567227ced60a 100644 (file)
@@ -905,9 +905,24 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
   if (! HAVE_nonlocal_goto)
 #endif
     {
+      /* First adjust our frame pointer to its actual value.  It was
+        previously set to the start of the virtual area corresponding to
+        the stacked variables when we branched here and now needs to be
+        adjusted to the actual hardware fp value.
+
+        Assignments to virtual registers are converted by
+        instantiate_virtual_regs into the corresponding assignment
+        to the underlying register (fp in this case) that makes
+        the original assignment true.
+        So the following insn will actually be decrementing fp by
+        STARTING_FRAME_OFFSET.  */
       emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);
-      /* This might change the hard frame pointer in ways that aren't
-        apparent to early optimization passes, so force a clobber.  */
+
+      /* Restoring the frame pointer also modifies the hard frame pointer.
+        Mark it used (so that the previous assignment remains live once
+        the frame pointer is eliminated) and clobbered (to represent the
+        implicit update from the assignment).  */
+      emit_use (hard_frame_pointer_rtx);
       emit_clobber (hard_frame_pointer_rtx);
     }
 
@@ -948,8 +963,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
 
   /* We must not allow the code we just generated to be reordered by
      scheduling.  Specifically, the update of the frame pointer must
-     happen immediately, not later.  Similarly, we must block
-     (frame-related) register values to be used across this code.  */
+     happen immediately, not later.  */
   emit_insn (gen_blockage ());
 }
 
index 40105a9b199994221555b81d75e023447114c1a2..eb17f6979f9c0ba36150ffb33cb16ab00496738c 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5659,9 +5659,10 @@ cse_insn (rtx insn)
          invalidate (XEXP (dest, 0), GET_MODE (dest));
       }
 
-  /* A volatile ASM or an UNSPEC_VOLATILE invalidates everything.  */
+  /* A volatile ASM invalidates everything.  */
   if (NONJUMP_INSN_P (insn)
-      && volatile_insn_p (PATTERN (insn)))
+      && GET_CODE (PATTERN (insn)) == ASM_OPERANDS
+      && MEM_VOLATILE_P (PATTERN (insn)))
     flush_hash_table ();
 
   /* Don't cse over a call to setjmp; on some machines (eg VAX)
index 334d9552abf752eb8f301ab94a74fa0aeab38e0a..1e59f3a1b42b816766b27cb6f6100ae825b162b1 100644 (file)
@@ -2623,12 +2623,13 @@ cselib_process_insn (rtx insn)
 
   cselib_current_insn = insn;
 
-  /* Forget everything at a CODE_LABEL, a volatile insn, or a setjmp.  */
+  /* Forget everything at a CODE_LABEL, a volatile asm, or a setjmp.  */
   if ((LABEL_P (insn)
        || (CALL_P (insn)
           && find_reg_note (insn, REG_SETJMP, NULL))
        || (NONJUMP_INSN_P (insn)
-          && volatile_insn_p (PATTERN (insn))))
+          && GET_CODE (PATTERN (insn)) == ASM_OPERANDS
+          && MEM_VOLATILE_P (PATTERN (insn))))
       && !cselib_preserve_constants)
     {
       cselib_reset_table (next_uid);
index 080822292e40c91725961bf8705e40969299b543..e853b411848f55c700ca3a90a81e74a91c404351 100644 (file)
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2518,7 +2518,8 @@ scan_insn (bb_info_t bb_info, rtx insn)
   /* Cselib clears the table for this case, so we have to essentially
      do the same.  */
   if (NONJUMP_INSN_P (insn)
-      && volatile_insn_p (PATTERN (insn)))
+      && GET_CODE (PATTERN (insn)) == ASM_OPERANDS
+      && MEM_VOLATILE_P (PATTERN (insn)))
     {
       add_wild_read (bb_info);
       insn_info->cannot_delete = true;
index 7bdc9329bdf0ce826724daaa678fe09e8a22098b..da9a335b1c7078da4a61f3ec9bdd3502a1eaee09 100644 (file)
@@ -1602,18 +1602,27 @@ expand_nl_goto_receiver (void)
 #ifdef HAVE_nonlocal_goto
   if (! HAVE_nonlocal_goto)
 #endif
-    /* First adjust our frame pointer to its actual value.  It was
-       previously set to the start of the virtual area corresponding to
-       the stacked variables when we branched here and now needs to be
-       adjusted to the actual hardware fp value.
-
-       Assignments are to virtual registers are converted by
-       instantiate_virtual_regs into the corresponding assignment
-       to the underlying register (fp in this case) that makes
-       the original assignment true.
-       So the following insn will actually be
-       decrementing fp by STARTING_FRAME_OFFSET.  */
-    emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);
+    {
+      /* First adjust our frame pointer to its actual value.  It was
+        previously set to the start of the virtual area corresponding to
+        the stacked variables when we branched here and now needs to be
+        adjusted to the actual hardware fp value.
+
+        Assignments to virtual registers are converted by
+        instantiate_virtual_regs into the corresponding assignment
+        to the underlying register (fp in this case) that makes
+        the original assignment true.
+        So the following insn will actually be decrementing fp by
+        STARTING_FRAME_OFFSET.  */
+      emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);
+
+      /* Restoring the frame pointer also modifies the hard frame pointer.
+        Mark it used (so that the previous assignment remains live once
+        the frame pointer is eliminated) and clobbered (to represent the
+        implicit update from the assignment).  */
+      emit_use (hard_frame_pointer_rtx);
+      emit_clobber (hard_frame_pointer_rtx);
+    }
 
 #if !HARD_FRAME_POINTER_IS_ARG_POINTER
   if (fixed_regs[ARG_POINTER_REGNUM])