From 47d3640028b6647601a18cc8f84f3180c85f045e Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 27 Aug 1997 06:29:59 +0000 Subject: [PATCH] i386.md (pop): pop increments the stack pointer. * 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. Fixes problem with scheduling on the x86. From-SVN: r14956 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 2 +- gcc/config/i386/i386.md | 23 ++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f556ba15e4..c8fc1a9e2c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Wed Aug 27 00:30:00 1997 Bernd Schmidt + + * 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 * reload.c (find_reloads, case '0'): Reject matching a non-offsettable diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 129727f9ea0..35dbc62a81b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 3b2a4eb7cf2..8ae87644505 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -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. ;; 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)))] "" "* { -- 2.30.2