OSDN Git Service

* alpha.c (alpha_expand_prologue): Use gen_adddi3 instead of
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 17 Apr 1999 19:03:04 +0000 (19:03 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 17 Apr 1999 19:03:04 +0000 (19:03 +0000)
        emit_move_insn+plus_constant.  For NT, don't use the stack probe
        loop pointer to allocate stack space.
        * alpha.md (adddi3): Always use lda to set the stack pointer.

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

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.md

index 2499ba6..5d81e68 100644 (file)
@@ -1,3 +1,10 @@
+Mon Apr 19 08:12:30 1999  Richard Henderson  <rth@cygnus.com>
+
+       * alpha.c (alpha_expand_prologue): Use gen_adddi3 instead of 
+       emit_move_insn+plus_constant.  For NT, don't use the stack probe
+       loop pointer to allocate stack space.
+       * alpha.md (adddi3): Always use lda to set the stack pointer.
+
 1999-04-17 20:11 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
 
        * c-aux-info.c, emit-rtl.c, explow.c, expmed.c, gcse.c,
index e2a4dff..c910278 100644 (file)
@@ -3405,8 +3405,8 @@ alpha_expand_prologue ()
 
       if (frame_size != 0)
        {
-         FRP (emit_move_insn (stack_pointer_rtx,
-                              plus_constant (stack_pointer_rtx, -frame_size)));
+         FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+                                     GEN_INT (-frame_size))));
        }
     }
   else
@@ -3423,7 +3423,7 @@ alpha_expand_prologue ()
       rtx count = gen_rtx_REG (DImode, 23);
 
       emit_move_insn (count, GEN_INT (blocks));
-      emit_move_insn (ptr, plus_constant (stack_pointer_rtx, 4096));
+      emit_insn (gen_adddi3 (ptr, stack_pointer_rtx, GEN_INT (4096)));
 
       /* Because of the difficulty in emitting a new basic block this
         late in the compilation, generate the loop as a single insn.  */
@@ -3436,18 +3436,38 @@ alpha_expand_prologue ()
          emit_move_insn (last, const0_rtx);
        }
 
-      ptr = emit_move_insn (stack_pointer_rtx, plus_constant (ptr, -leftover));
-
-      /* This alternative is special, because the DWARF code cannot possibly
-        intuit through the loop above.  So we invent this note it looks at
-        instead.  */
-      RTX_FRAME_RELATED_P (ptr) = 1;
-      REG_NOTES (ptr)
-       = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
-                            gen_rtx_SET (VOIDmode, stack_pointer_rtx,
-                              gen_rtx_PLUS (Pmode, stack_pointer_rtx,
-                                            GEN_INT (-frame_size))),
-                            REG_NOTES (ptr));
+      if (TARGET_WINDOWS_NT)
+       {
+         /* For NT stack unwind (done by 'reverse execution'), it's
+            not OK to take the result of a loop, even though the value
+            is already in ptr, so we reload it via a single operation
+            and add it to sp.  */
+
+         HOST_WIDE_INT lo, hi;
+         lo = ((-frame_size & 0xffff) ^ 0x8000) - 0x8000;
+         hi = -frame_size - lo;
+
+         FRP (emit_insn (gen_adddi3 (ptr, stack_pointer_rtx, GEN_INT (hi))));
+         FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, ptr, GEN_INT (lo))));
+       }
+      else
+       {
+         rtx seq;
+
+         seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr,
+                                      GEN_INT (-leftover)));
+
+         /* This alternative is special, because the DWARF code cannot
+            possibly intuit through the loop above.  So we invent this
+            note it looks at instead.  */
+         RTX_FRAME_RELATED_P (seq) = 1;
+         REG_NOTES (seq)
+           = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+                                gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+                                  gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+                                                GEN_INT (-frame_size))),
+                                REG_NOTES (seq));
+       }
     }
 
   /* Cope with very large offsets to the register save area.  */
@@ -3463,7 +3483,7 @@ alpha_expand_prologue ()
        bias = reg_offset, reg_offset = 0;
 
       sa_reg = gen_rtx_REG (DImode, 24);
-      FRP (emit_move_insn (sa_reg, plus_constant (stack_pointer_rtx, bias)));
+      FRP (emit_insn (gen_adddi3 (sa_reg, stack_pointer_rtx, GEN_INT (bias))));
     }
     
   /* Save regs in stack order.  Beginning with VMS PV.  */
index f4943a2..ab56951 100644 (file)
        (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
                 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
   ""
-  "@
-   addq %r1,%2,%0
-   subq %r1,%n2,%0
-   lda %0,%2(%r1)
-   ldah %0,%h2(%r1)")
+  "*
+{
+  const char * const pattern[4] = {
+    \"addq %r1,%2,%0\",
+    \"subq %r1,%n2,%0\",
+    \"lda %0,%2(%r1)\",
+    \"ldah %0,%h2(%r1)\"
+  };
+
+  /* The NT stack unwind code can't handle a subq to adjust the stack
+     (that's a bug, but not one we can do anything about).  As of NT4.0 SP3,
+     the exception handling code will loop if a subq is used and an
+     exception occurs.
+
+     The 19980616 change to emit prologues as RTL also confused some
+     versions of GDB, which also interprets prologues.  This has been
+     fixed as of GDB 4.18, but it does not harm to unconditionally
+     use lda here.  */
+
+  int which = which_alternative;
+
+  if (operands[0] == stack_pointer_rtx
+      && GET_CODE (operands[2]) == CONST_INT
+      && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))
+    which = 2;
+
+  return pattern[which];
+}")
 
 ;; Don't do this if we are adjusting SP since we don't want to do
 ;; it in two steps.