From patchwork Tue Aug 3 23:53:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 60803 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D8473B70A8 for ; Wed, 4 Aug 2010 09:54:18 +1000 (EST) Received: (qmail 9870 invoked by alias); 3 Aug 2010 23:53:38 -0000 Received: (qmail 9787 invoked by uid 22791); 3 Aug 2010 23:53:36 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from b.mail.sonic.net (HELO b.mail.sonic.net) (64.142.19.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Aug 2010 23:53:22 +0000 Received: from are.twiddle.net (are.twiddle.net [75.101.38.216]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id o73NrJ5m027933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Aug 2010 16:53:21 -0700 Received: from are.twiddle.net (localhost [127.0.0.1]) by are.twiddle.net (8.14.4/8.14.4) with ESMTP id o73NrJtp001141; Tue, 3 Aug 2010 16:53:19 -0700 Received: (from rth@localhost) by are.twiddle.net (8.14.4/8.14.4/Submit) id o73NrJYe001140; Tue, 3 Aug 2010 16:53:19 -0700 From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: kai.tietz@onevision.com, ubizjak@gmail.com Subject: [PATCH 2/9] Simplify logic saving the int registers in the prologue. Date: Tue, 3 Aug 2010 16:53:09 -0700 Message-Id: <1280879596-1089-3-git-send-email-rth@twiddle.net> In-Reply-To: <1280879596-1089-1-git-send-email-rth@twiddle.net> References: <1280879596-1089-1-git-send-email-rth@twiddle.net> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org --- gcc/config/i386/i386.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) * config/i386/i386.c (ix86_expand_prologue): Simplify logic saving the int registers. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 6d676b2..4be3bfc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9194,6 +9194,7 @@ ix86_expand_prologue (void) struct ix86_frame frame; HOST_WIDE_INT allocate; int gen_frame_pointer = frame_pointer_needed; + bool int_registers_saved = false; ix86_finalize_stack_realign_flags (); @@ -9347,7 +9348,10 @@ ix86_expand_prologue (void) allocate = frame.to_allocate + frame.nsseregs * 16 + frame.padding0; if (!frame.save_regs_using_mov) - ix86_emit_save_regs (); + { + ix86_emit_save_regs (); + int_registers_saved = true; + } else allocate += frame.nregs * UNITS_PER_WORD; @@ -9356,7 +9360,7 @@ ix86_expand_prologue (void) if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK) { /* We expect the registers to be saved when probes are used. */ - gcc_assert (!frame.save_regs_using_mov); + gcc_assert (int_registers_saved); if (STACK_CHECK_MOVING_SP) { @@ -9382,13 +9386,17 @@ ix86_expand_prologue (void) avoid doing this if I am going to have to probe the stack since at least on x86_64 the stack probe can turn into a call that clobbers a red zone location */ - if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE && frame.save_regs_using_mov + if (!int_registers_saved + && (TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI) && (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)) - ix86_emit_save_regs_using_mov ((frame_pointer_needed - && !crtl->stack_realign_needed) - ? hard_frame_pointer_rtx - : stack_pointer_rtx, - -frame.nregs * UNITS_PER_WORD); + { + ix86_emit_save_regs_using_mov ((frame_pointer_needed + && !crtl->stack_realign_needed) + ? hard_frame_pointer_rtx + : stack_pointer_rtx, + -frame.nregs * UNITS_PER_WORD); + int_registers_saved = true; + } if (allocate == 0) ; @@ -9439,9 +9447,7 @@ ix86_expand_prologue (void) } } - if (frame.save_regs_using_mov - && !(!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE - && (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))) + if (!int_registers_saved) { if (!frame_pointer_needed || !(frame.to_allocate + frame.padding0)