From patchwork Tue Aug 3 23:53:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 60804 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 D579CB70A8 for ; Wed, 4 Aug 2010 09:54:34 +1000 (EST) Received: (qmail 9926 invoked by alias); 3 Aug 2010 23:53:39 -0000 Received: (qmail 9774 invoked by uid 22791); 3 Aug 2010 23:53:35 -0000 X-SWARE-Spam-Status: No, hits=-1.5 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:23 +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 o73NrKmS027938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Aug 2010 16:53:20 -0700 Received: from are.twiddle.net (localhost [127.0.0.1]) by are.twiddle.net (8.14.4/8.14.4) with ESMTP id o73NrK2k001145; Tue, 3 Aug 2010 16:53:20 -0700 Received: (from rth@localhost) by are.twiddle.net (8.14.4/8.14.4/Submit) id o73NrJAm001144; 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 3/9] Consolidate red-zone logic into ix86_using_red_zone. Date: Tue, 3 Aug 2010 16:53:10 -0700 Message-Id: <1280879596-1089-4-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 | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) * config/i386/i386.c (ix86_using_red_zone): New. (ix86_compute_frame_layout, ix86_add_cfa_restore_note, ix86_expand_prologue, ix86_force_to_memory): Use it. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 4be3bfc..efdb6c4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2201,6 +2201,14 @@ static const char *const cpu_names[TARGET_CPU_DEFAULT_max] = "bdver1" }; +/* Return true if a red-zone is in use. */ + +static inline bool +ix86_using_red_zone (void) +{ + return TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI; +} + /* Implement TARGET_HANDLE_OPTION. */ static bool @@ -8459,7 +8467,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) || (TARGET_64BIT && frame->to_allocate >= (HOST_WIDE_INT) 0x80000000)) frame->save_regs_using_mov = false; - if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE + if (ix86_using_red_zone () && current_function_sp_is_unchanging && current_function_is_leaf && !ix86_current_function_calls_tls_descriptor) @@ -8542,8 +8550,7 @@ static GTY(()) rtx queued_cfa_restores; static void ix86_add_cfa_restore_note (rtx insn, rtx reg, HOST_WIDE_INT red_offset) { - if (TARGET_RED_ZONE - && !TARGET_64BIT_MS_ABI + if (ix86_using_red_zone () && red_offset + RED_ZONE_SIZE >= 0 && crtl->args.pops_args < 65536) return; @@ -9387,7 +9394,7 @@ ix86_expand_prologue (void) at least on x86_64 the stack probe can turn into a call that clobbers a red zone location */ if (!int_registers_saved - && (TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI) + && ix86_using_red_zone () && (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)) { ix86_emit_save_regs_using_mov ((frame_pointer_needed @@ -25774,7 +25781,7 @@ ix86_force_to_memory (enum machine_mode mode, rtx operand) rtx result; gcc_assert (reload_completed); - if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE) + if (ix86_using_red_zone ()) { result = gen_rtx_MEM (mode, gen_rtx_PLUS (Pmode, @@ -25782,7 +25789,7 @@ ix86_force_to_memory (enum machine_mode mode, rtx operand) GEN_INT (-RED_ZONE_SIZE))); emit_move_insn (result, operand); } - else if ((TARGET_64BIT_MS_ABI || !TARGET_RED_ZONE) && TARGET_64BIT) + else if (TARGET_64BIT) { switch (mode) { @@ -25849,7 +25856,7 @@ ix86_force_to_memory (enum machine_mode mode, rtx operand) void ix86_free_from_memory (enum machine_mode mode) { - if (!TARGET_RED_ZONE || TARGET_64BIT_MS_ABI) + if (!ix86_using_red_zone ()) { int size;