OSDN Git Service

* explow.c (emit_stack_save): Remove 'after' parameter.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Mar 2011 21:56:58 +0000 (21:56 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Mar 2011 21:56:58 +0000 (21:56 +0000)
        (emit_stack_restore): Likewise.
        * expr.h: Update to match.
        * builtins.c, calls.c, stmt.c: Likewise.
        * config/alpha/alpha.md, config/avr/avr.md: Likewise.
        * config/mips/mips.md, config/pa/pa.md, config/vax/vax.md: Likewise.
        * function.c (expand_function_end): Insert the emit_stack_save
        sequence before parm_birth_insn instead of after.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170663 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/calls.c
gcc/config/alpha/alpha.md
gcc/config/avr/avr.md
gcc/config/mips/mips.md
gcc/config/pa/pa.md
gcc/config/vax/vax.md
gcc/explow.c
gcc/expr.h
gcc/function.c
gcc/stmt.c

index ee5213b..3086fe0 100644 (file)
@@ -1,3 +1,14 @@
+2011-03-04  Richard Henderson  <rth@redhat.com>
+
+       * explow.c (emit_stack_save): Remove 'after' parameter.
+       (emit_stack_restore): Likewise.
+       * expr.h: Update to match.
+       * builtins.c, calls.c, stmt.c: Likewise.
+       * config/alpha/alpha.md, config/avr/avr.md: Likewise.
+       * config/mips/mips.md, config/pa/pa.md, config/vax/vax.md: Likewise.
+       * function.c (expand_function_end): Insert the emit_stack_save
+       sequence before parm_birth_insn instead of after.
+
 2011-03-03  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/sse.md (*avx_pmaddubsw128): Fix mode of VEC_SELECT RTX.
index 106b2ca..3361264 100644 (file)
@@ -784,7 +784,7 @@ expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label)
                            plus_constant (buf_addr,
                                           2 * GET_MODE_SIZE (Pmode)));
   set_mem_alias_set (stack_save, setjmp_alias_set);
-  emit_stack_save (SAVE_NONLOCAL, &stack_save, NULL_RTX);
+  emit_stack_save (SAVE_NONLOCAL, &stack_save);
 
   /* If there is further processing to do, do it.  */
 #ifdef HAVE_builtin_setjmp_setup
@@ -932,7 +932,7 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
          emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
 
          emit_move_insn (hard_frame_pointer_rtx, fp);
-         emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+         emit_stack_restore (SAVE_NONLOCAL, stack);
 
          emit_use (hard_frame_pointer_rtx);
          emit_use (stack_pointer_rtx);
@@ -1005,7 +1005,7 @@ expand_builtin_nonlocal_goto (tree exp)
         The non-local goto handler will then adjust it to contain the
         proper value and reload the argument pointer, if needed.  */
       emit_move_insn (hard_frame_pointer_rtx, r_fp);
-      emit_stack_restore (SAVE_NONLOCAL, r_sp, NULL_RTX);
+      emit_stack_restore (SAVE_NONLOCAL, r_sp);
 
       /* USE of hard_frame_pointer_rtx added for consistency;
         not clear if really needed.  */
@@ -1075,7 +1075,7 @@ expand_builtin_update_setjmp_buf (rtx buf_addr)
     emit_insn (gen_setjmp ());
 #endif
 
-  emit_stack_save (SAVE_NONLOCAL, &stack_save, NULL_RTX);
+  emit_stack_save (SAVE_NONLOCAL, &stack_save);
 }
 
 /* Expand a call to __builtin_prefetch.  For a target that does not support
@@ -1558,10 +1558,10 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
   /* Save the stack with nonlocal if available.  */
 #ifdef HAVE_save_stack_nonlocal
   if (HAVE_save_stack_nonlocal)
-    emit_stack_save (SAVE_NONLOCAL, &old_stack_level, NULL_RTX);
+    emit_stack_save (SAVE_NONLOCAL, &old_stack_level);
   else
 #endif
-    emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
+    emit_stack_save (SAVE_BLOCK, &old_stack_level);
 
   /* Allocate a block of memory onto the stack and copy the memory
      arguments to the outgoing arguments address.  We can pass TRUE
@@ -1677,10 +1677,10 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
   /* Restore the stack.  */
 #ifdef HAVE_save_stack_nonlocal
   if (HAVE_save_stack_nonlocal)
-    emit_stack_restore (SAVE_NONLOCAL, old_stack_level, NULL_RTX);
+    emit_stack_restore (SAVE_NONLOCAL, old_stack_level);
   else
 #endif
-    emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
+    emit_stack_restore (SAVE_BLOCK, old_stack_level);
 
   OK_DEFER_POP;
 
index 5297763..f539f66 100644 (file)
@@ -1092,7 +1092,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
 
                  if (*old_stack_level == 0)
                    {
-                     emit_stack_save (SAVE_BLOCK, old_stack_level, NULL_RTX);
+                     emit_stack_save (SAVE_BLOCK, old_stack_level);
                      *old_pending_adj = pending_stack_adjust;
                      pending_stack_adjust = 0;
                    }
@@ -2488,7 +2488,7 @@ expand_call (tree exp, rtx target, int ignore)
        {
          if (old_stack_level == 0)
            {
-             emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
+             emit_stack_save (SAVE_BLOCK, &old_stack_level);
              old_stack_pointer_delta = stack_pointer_delta;
              old_pending_adj = pending_stack_adjust;
              pending_stack_adjust = 0;
@@ -2643,8 +2643,7 @@ expand_call (tree exp, rtx target, int ignore)
                              : reg_parm_stack_space));
              if (old_stack_level == 0)
                {
-                 emit_stack_save (SAVE_BLOCK, &old_stack_level,
-                                  NULL_RTX);
+                 emit_stack_save (SAVE_BLOCK, &old_stack_level);
                  old_stack_pointer_delta = stack_pointer_delta;
                  old_pending_adj = pending_stack_adjust;
                  pending_stack_adjust = 0;
@@ -3101,7 +3100,7 @@ expand_call (tree exp, rtx target, int ignore)
 
       if (old_stack_level)
        {
-         emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
+         emit_stack_restore (SAVE_BLOCK, old_stack_level);
          stack_pointer_delta = old_stack_pointer_delta;
          pending_stack_adjust = old_pending_adj;
          old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
index 04f3ff8..d6fba76 100644 (file)
   /* This bit is the same as expand_builtin_longjmp.  */
   emit_move_insn (hard_frame_pointer_rtx, fp);
   emit_move_insn (pv, lab);
-  emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+  emit_stack_restore (SAVE_NONLOCAL, stack);
   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);
 
index 17fd319..b9e92f4 100644 (file)
   emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
 
   emit_move_insn (hard_frame_pointer_rtx, r_fp);
-  emit_stack_restore (SAVE_NONLOCAL, r_sp, NULL_RTX);
+  emit_stack_restore (SAVE_NONLOCAL, r_sp);
 
   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);
index 0883780..bb87103 100644 (file)
      restores $gp as well.  */
   mips_emit_move (hard_frame_pointer_rtx, fp);
   mips_emit_move (pv, lab);
-  emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+  emit_stack_restore (SAVE_NONLOCAL, stack);
   mips_emit_move (gp, gpv);
   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);
index f22692c..24317a5 100644 (file)
     fp = force_reg (Pmode, fp);
   emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8));
 
-  emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+  emit_stack_restore (SAVE_NONLOCAL, stack);
 
   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);
@@ -8310,7 +8310,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
   emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8));
 
   /* This bit is the same as expand_builtin_longjmp.  */
-  emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+  emit_stack_restore (SAVE_NONLOCAL, stack);
   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);
 
index 649f17e..8c3ef00 100644 (file)
   emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
 
   emit_move_insn (hard_frame_pointer_rtx, fp);
-  emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+  emit_stack_restore (SAVE_NONLOCAL, stack);
 
   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);
index 2a18206..34adcb9 100644 (file)
@@ -961,13 +961,10 @@ round_push (rtx size)
 /* Save the stack pointer for the purpose in SAVE_LEVEL.  PSAVE is a pointer
    to a previously-created save area.  If no save area has been allocated,
    this function will allocate one.  If a save area is specified, it
-   must be of the proper mode.
-
-   The insns are emitted after insn AFTER, if nonzero, otherwise the insns
-   are emitted at the current position.  */
+   must be of the proper mode.  */
 
 void
-emit_stack_save (enum save_level save_level, rtx *psave, rtx after)
+emit_stack_save (enum save_level save_level, rtx *psave)
 {
   rtx sa = *psave;
   /* The default is that we use a move insn and save in a Pmode object.  */
@@ -1013,38 +1010,17 @@ emit_stack_save (enum save_level save_level, rtx *psave, rtx after)
        }
     }
 
-  if (after)
-    {
-      rtx seq;
-
-      start_sequence ();
-      do_pending_stack_adjust ();
-      /* We must validize inside the sequence, to ensure that any instructions
-        created by the validize call also get moved to the right place.  */
-      if (sa != 0)
-       sa = validize_mem (sa);
-      emit_insn (fcn (sa, stack_pointer_rtx));
-      seq = get_insns ();
-      end_sequence ();
-      emit_insn_after (seq, after);
-    }
-  else
-    {
-      do_pending_stack_adjust ();
-      if (sa != 0)
-       sa = validize_mem (sa);
-      emit_insn (fcn (sa, stack_pointer_rtx));
-    }
+  do_pending_stack_adjust ();
+  if (sa != 0)
+    sa = validize_mem (sa);
+  emit_insn (fcn (sa, stack_pointer_rtx));
 }
 
 /* Restore the stack pointer for the purpose in SAVE_LEVEL.  SA is the save
-   area made by emit_stack_save.  If it is zero, we have nothing to do.
-
-   Put any emitted insns after insn AFTER, if nonzero, otherwise at
-   current position.  */
+   area made by emit_stack_save.  If it is zero, we have nothing to do.  */
 
 void
-emit_stack_restore (enum save_level save_level, rtx sa, rtx after)
+emit_stack_restore (enum save_level save_level, rtx sa)
 {
   /* The default is that we use a move insn.  */
   rtx (*fcn) (rtx, rtx) = gen_move_insn;
@@ -1086,18 +1062,7 @@ emit_stack_restore (enum save_level save_level, rtx sa, rtx after)
 
   discard_pending_stack_adjust ();
 
-  if (after)
-    {
-      rtx seq;
-
-      start_sequence ();
-      emit_insn (fcn (stack_pointer_rtx, sa));
-      seq = get_insns ();
-      end_sequence ();
-      emit_insn_after (seq, after);
-    }
-  else
-    emit_insn (fcn (stack_pointer_rtx, sa));
+  emit_insn (fcn (stack_pointer_rtx, sa));
 }
 
 /* Invoke emit_stack_save on the nonlocal_goto_save_area for the current
@@ -1118,7 +1083,7 @@ update_nonlocal_goto_save_area (void)
                   integer_one_node, NULL_TREE, NULL_TREE);
   r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE);
 
-  emit_stack_save (SAVE_NONLOCAL, &r_save, NULL_RTX);
+  emit_stack_save (SAVE_NONLOCAL, &r_save);
 }
 \f
 /* Return an rtx representing the address of an area of memory dynamically
index 263f861..b6e6e6b 100644 (file)
@@ -633,10 +633,10 @@ extern void anti_adjust_stack_and_probe (rtx, bool);
 enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL};
 
 /* Save the stack pointer at the specified level.  */
-extern void emit_stack_save (enum save_level, rtx *, rtx);
+extern void emit_stack_save (enum save_level, rtx *);
 
 /* Restore the stack pointer from a save area of the specified level.  */
-extern void emit_stack_restore (enum save_level, rtx, rtx);
+extern void emit_stack_restore (enum save_level, rtx);
 
 /* Invoke emit_stack_save for the nonlocal_goto_save_area.  */
 extern void update_nonlocal_goto_save_area (void);
index 8b80485..19b480d 100644 (file)
@@ -5121,10 +5121,15 @@ expand_function_end (void)
   if (! EXIT_IGNORE_STACK
       && cfun->calls_alloca)
     {
-      rtx tem = 0;
+      rtx tem = 0, seq;
 
-      emit_stack_save (SAVE_FUNCTION, &tem, parm_birth_insn);
-      emit_stack_restore (SAVE_FUNCTION, tem, NULL_RTX);
+      start_sequence ();
+      emit_stack_save (SAVE_FUNCTION, &tem);
+      seq = get_insns ();
+      end_sequence ();
+      emit_insn_before (seq, parm_birth_insn);
+
+      emit_stack_restore (SAVE_FUNCTION, tem);
     }
 
   /* ??? This should no longer be necessary since stupid is no longer with
index 7d4cbb0..b65c6db 100644 (file)
@@ -2006,7 +2006,7 @@ expand_stack_save (void)
   rtx ret = NULL_RTX;
 
   do_pending_stack_adjust ();
-  emit_stack_save (SAVE_BLOCK, &ret, NULL_RTX);
+  emit_stack_save (SAVE_BLOCK, &ret);
   return ret;
 }
 
@@ -2017,7 +2017,7 @@ expand_stack_restore (tree var)
   rtx sa = expand_normal (var);
 
   sa = convert_memory_address (Pmode, sa);
-  emit_stack_restore (SAVE_BLOCK, sa, NULL_RTX);
+  emit_stack_restore (SAVE_BLOCK, sa);
 }
 \f
 /* Do the insertion of a case label into case_list.  The labels are