OSDN Git Service

* i386.md (pop): pop increments the stack pointer.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Aug 1997 06:29:59 +0000 (06:29 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Aug 1997 06:29:59 +0000 (06:29 +0000)
        (prologue_set_stack_ptr): New pattern.
        * i386.c (ix86_expand_prologue): Use prologue_set_stack_ptr
        instead of subsi3.
Fixes problem with scheduling on the x86.

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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index 9f556ba..c8fc1a9 100644 (file)
@@ -1,3 +1,10 @@
+Wed Aug 27 00:30:00 1997  Bernd Schmidt  <crux@pool.informatik.rwth-aachen.de>
+
+       * i386.md (pop): pop increments the stack pointer.
+       (prologue_set_stack_ptr): New pattern.
+       * i386.c (ix86_expand_prologue): Use prologue_set_stack_ptr
+       instead of subsi3.
+
 Tue Aug 26 18:50:32 1997  Jim Wilson  <wilson@cygnus.com>
 
        * reload.c (find_reloads, case '0'): Reject matching a non-offsettable
index 129727f..35dbc62 100644 (file)
@@ -1973,7 +1973,7 @@ ix86_expand_prologue ()
     ;
   else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
     {
-      insn = emit_insn (gen_subsi3 (xops[0], xops[0], xops[2]));
+      insn = emit_insn (gen_prologue_set_stack_ptr (xops[2]));
       RTX_FRAME_RELATED_P (insn) = 1;
     }
   else 
index 3b2a4eb..8ae8764 100644 (file)
@@ -60,6 +60,9 @@
 ;;    operand 0 is the argument for `cos'.
 ;; 3  This is part of a `stack probe' operation.  The mode of the UNSPEC is 
 ;;    always SImode.  operand 0 is the size of the stack allocation.
+;; 4  This is the source of a fake SET of the frame pointer which is used to
+;;    prevent insns referencing it being scheduled across the initial
+;;    decrement of the stack pointer.
 \f
 ;; This shadows the processor_type enumeration, so changes must be made
 ;; to i386.h at the same time.
@@ -6492,6 +6495,24 @@ byte_xor_operation:
   DONE;
 }")
 
+;; The use of UNSPEC here is currently not necessary - a simple SET of ebp
+;; to itself would be enough. But this way we are safe even if some optimizer
+;; becomes too clever in the future.
+(define_insn "prologue_set_stack_ptr"
+  [(set (reg:SI 7)
+       (minus:SI (reg:SI 7) (match_operand:SI 0 "immediate_operand" "i")))
+   (set (reg:SI 6) (unspec:SI [(reg:SI 6)] 4))]
+  ""
+  "*
+{
+  rtx xops [2];
+
+  xops[0] = operands[0];
+  xops[1] = stack_pointer_rtx;
+  output_asm_insn (AS2 (sub%L1,%0,%1), xops);
+  RET;
+}")
+
 (define_insn "prologue_set_got"
   [(set (match_operand:SI 0 "" "")
     (plus:SI (match_dup 0)
@@ -6564,7 +6585,7 @@ byte_xor_operation:
 (define_insn "pop"
   [(set (match_operand:SI 0 "register_operand" "r")
        (mem:SI (reg:SI 7)))
-   (set (reg:SI 7) (minus:SI (reg:SI 7) (const_int 4)))]
+   (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))]
   ""
   "*
 {