From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92369 invoked by alias); 31 Jul 2015 04:00:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 92349 invoked by uid 89); 31 Jul 2015 04:00:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f45.google.com Received: from mail-pa0-f45.google.com (HELO mail-pa0-f45.google.com) (209.85.220.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 31 Jul 2015 04:00:18 +0000 Received: by padck2 with SMTP id ck2so33836719pad.0 for ; Thu, 30 Jul 2015 21:00:16 -0700 (PDT) X-Received: by 10.66.132.81 with SMTP id os17mr1843441pab.153.1438315216730; Thu, 30 Jul 2015 21:00:16 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-155-134.oycza5.sa.bigpond.net.au. [58.160.155.134]) by smtp.gmail.com with ESMTPSA id g10sm4730497pat.35.2015.07.30.21.00.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 21:00:15 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id E0E0BEA0074; Fri, 31 Jul 2015 13:30:10 +0930 (ACST) Date: Fri, 31 Jul 2015 08:11:00 -0000 From: Alan Modra To: "Lynn A. Boger" , David Edelsohn Cc: gcc-patches Subject: Re: [PATCH] Fix PR66870 ppc64le, ppc64 split stack Message-ID: <20150731040010.GU26017@bubble.grove.modra.org> References: <55BA8954.6070101@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55BA8954.6070101@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg02620.txt.bz2 On Thu, Jul 30, 2015 at 03:30:12PM -0500, Lynn A. Boger wrote: > PR66870 > * gcc/config/rs6000/rs6000.c: Add check for no_split_stack > function attribute along with flag_split_stack check to > determine when to generate split stack prologue for > ppc64 and ppc64le. Looks good to me, except that the changelog entry should mention the modified functions, for example: PR target/66870 * gcc/config/rs6000/rs6000.c (rs6000_emit_prologue): Check for no_split_stack function attribute along with flag_split_stack. (rs6000_expand_split_stack_prologue): Likewise. Also, formatting rules for gcc say to not split a line after an operator. > + int using_split_stack = flag_split_stack && > + (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (cfun->decl)) > + == NULL); The "&&" belongs on the next line, with parentheses added so that emacs and indent will line up the continuation nicely. int using_split_stack = (flag_split_stack && (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (cfun->decl)) == NULL)); David, the following is another piece of the PR66870 fixes. This stops shrink-wrap from moving insns around in the first few blocks of a function, in a way that is incorrect given that r12 is live. Bootstrapped and regression tested powerpc64le-linux (and powerpc64-linux by Lynn). PR target/66870 * config/rs6000/rs6000.c (machine_function): Add split_stack_argp_used. (rs6000_emit_prologue): Set it. (rs6000_set_up_by_prologue): Specify r12 when split_stack_argp_used. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5d9ff88..dc2e20c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -166,6 +166,7 @@ typedef struct GTY(()) machine_function rtx sdmode_stack_slot; /* Alternative internal arg pointer for -fsplit-stack. */ rtx split_stack_arg_pointer; + bool split_stack_argp_used; /* Flag if r2 setup is needed with ELFv2 ABI. */ bool r2_setup_needed; } machine_function; @@ -24458,6 +24459,7 @@ rs6000_emit_prologue (void) __morestack was called, it left the arg pointer to the old stack in r29. Otherwise, the arg pointer is the top of the current frame. */ + cfun->machine->split_stack_argp_used = true; if (sp_adjust) { rtx r12 = gen_rtx_REG (Pmode, 12); @@ -33711,6 +33713,8 @@ rs6000_set_up_by_prologue (struct hard_reg_set_container *set) && TARGET_MINIMAL_TOC && get_pool_size () != 0) add_to_hard_reg_set (&set->set, Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM); + if (cfun->machine->split_stack_argp_used) + add_to_hard_reg_set (&set->set, Pmode, 12); } -- Alan Modra Australia Development Lab, IBM