From patchwork Sat Jul 18 07:37:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 497329 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E399E140D4D for ; Sat, 18 Jul 2015 17:38:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=fwOr8Res; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=pdQv2W8BC0a3FIEA asHLsYqlwH1tMAlupZ9fJV5o8x473axxGC0TME0qtY7hA3eti5PhY5fvvXnEzfRC UD/cy7/td4z8/gfk15onHs9pI3t7PTMS5FA4VTms0itkTSP3E3LkzCzknRSpzIGm C87JS4HMFpgVDgX9MI4Lbkfj4AM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=C6wchpu0jEjpXVRnNdZ39a bj6gI=; b=fwOr8ResyafSdBWahq/N3zwfT/a286ND6F6gamIYdn+pCAjYLCC0O9 J+SwgBSOzPFFxHcAoicSQ6gE4G1YHMIT5AF12rz732ByDQFCbF1oAS0eSWQKSnI+ 9eKQQmz5kFhGtmox+xWbDoIg+dnnHZVjsNLYc7QiL0ai41y4VHJxk= Received: (qmail 34812 invoked by alias); 18 Jul 2015 07:38:43 -0000 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 Received: (qmail 34803 invoked by uid 89); 18 Jul 2015 07:38:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 18 Jul 2015 07:38:40 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 7A65E3DA412; Sat, 18 Jul 2015 07:38:39 +0000 (UTC) Received: from freie.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6I7cUbr019094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 18 Jul 2015 03:38:38 -0400 Received: from livre.home (livre.home [172.31.160.2]) by freie.home (8.14.8/8.14.8) with ESMTP id t6I7bvGa025174; Sat, 18 Jul 2015 04:37:58 -0300 From: Alexandre Oliva To: Richard Biener Cc: Jeff Law , GCC Patches , Christophe Lyon , David Edelsohn , Eric Botcazou Subject: Re: [PR64164] drop copyrename, integrate into expand References: <551A2C7C.8060005@redhat.com> <5522AF73.5000706@redhat.com> Date: Sat, 18 Jul 2015 04:37:57 -0300 In-Reply-To: (Alexandre Oliva's message of "Thu, 16 Jul 2015 18:14:07 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 On Jul 16, 2015, Alexandre Oliva wrote: > So, I decided to run a ppc64le-linux-gnu bootstrap, just in case, and > there are issues with split complex parms that caused go and fortran > libs to fail the build. This incremental patch, along with the previously-posted patches, fix split complex args handling with preassigned args RTL, and enables ppc64le-linux-gnu bootstrap to succeed. I'm not particularly happy with the abuse of DECL_CONTEXT to recognize split complex args and leave their RTL alone, but that was the best that occurred to me. Any other suggestions? Is the combined patch ok, assuming further (re)testing of embedded targets passes? for gcc/ChangeLog (to be integrated with the approved patches) * function.c (split_complex_args): Take assign_parm_data_all argument. Pass it to rtl_for_parm. Set up rtl and context for split args. (assign_parms_augmented_arg_list): Adjust. (maybe_reset_rtl_for_parm): Recognize split complex args. * stor-layout.c (layout_decl): Don't set mem attributes of non-MEMs. --- gcc/function.c | 39 +++++++++++++++++++++++++++++++++++++-- gcc/stor-layout.c | 3 ++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/gcc/function.c b/gcc/function.c index 753d889..6fba001 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -151,6 +151,8 @@ static bool contains (const_rtx, hash_table *); static void prepare_function_start (void); static void do_clobber_return_reg (rtx, void *); static void do_use_return_reg (rtx, void *); +static rtx rtl_for_parm (struct assign_parm_data_all *, tree); + /* Stack of nested functions. */ /* Keep track of the cfun stack. */ @@ -2267,7 +2269,7 @@ assign_parms_initialize_all (struct assign_parm_data_all *all) needed, else the old list. */ static void -split_complex_args (vec *args) +split_complex_args (struct assign_parm_data_all *all, vec *args) { unsigned i; tree p; @@ -2278,6 +2280,7 @@ split_complex_args (vec *args) if (TREE_CODE (type) == COMPLEX_TYPE && targetm.calls.split_complex_arg (type)) { + tree cparm = p; tree decl; tree subtype = TREE_TYPE (type); bool addressable = TREE_ADDRESSABLE (p); @@ -2296,6 +2299,9 @@ split_complex_args (vec *args) DECL_ARTIFICIAL (p) = addressable; DECL_IGNORED_P (p) = addressable; TREE_ADDRESSABLE (p) = 0; + /* Reset the RTL before layout_decl, or it may change the + mode of the RTL of the original argument copied to P. */ + SET_DECL_RTL (p, NULL_RTX); layout_decl (p, 0); (*args)[i] = p; @@ -2307,6 +2313,25 @@ split_complex_args (vec *args) DECL_IGNORED_P (decl) = addressable; layout_decl (decl, 0); args->safe_insert (++i, decl); + + /* If we are assigning parameters for a function, rather + than for a call, propagate the RTL of the complex parm to + the split declarations, and set their contexts so that + maybe_reset_rtl_for_parm can recognize them and refrain + from resetting their RTL. */ + if (cfun->gimple_df) + { + rtx rtl = rtl_for_parm (all, cparm); + gcc_assert (!rtl || GET_CODE (rtl) == CONCAT); + if (rtl) + { + SET_DECL_RTL (p, XEXP (rtl, 0)); + SET_DECL_RTL (decl, XEXP (rtl, 1)); + + DECL_CONTEXT (p) = cparm; + DECL_CONTEXT (decl) = cparm; + } + } } } } @@ -2369,7 +2394,7 @@ assign_parms_augmented_arg_list (struct assign_parm_data_all *all) /* If the target wants to split complex arguments into scalars, do so. */ if (targetm.calls.split_complex_arg) - split_complex_args (&fnargs); + split_complex_args (all, &fnargs); return fnargs; } @@ -2823,6 +2848,16 @@ maybe_reset_rtl_for_parm (tree parm) { gcc_assert (TREE_CODE (parm) == PARM_DECL || TREE_CODE (parm) == RESULT_DECL); + + /* This is a split complex parameter, and its context was set to its + original PARM_DECL in split_complex_args so that we could + recognize it here and not reset its RTL. */ + if (DECL_CONTEXT (parm) && TREE_CODE (DECL_CONTEXT (parm)) == PARM_DECL) + { + DECL_CONTEXT (parm) = DECL_CONTEXT (DECL_CONTEXT (parm)); + return; + } + if ((flag_tree_coalesce_vars || (DECL_RTL_SET_P (parm) && DECL_RTL (parm) == pc_rtx)) && is_gimple_reg (parm)) diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 0d4f4a4..288227a 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -794,7 +794,8 @@ layout_decl (tree decl, unsigned int known_align) { PUT_MODE (rtl, DECL_MODE (decl)); SET_DECL_RTL (decl, 0); - set_mem_attributes (rtl, decl, 1); + if (MEM_P (rtl)) + set_mem_attributes (rtl, decl, 1); SET_DECL_RTL (decl, rtl); } }