From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 08:26:00 -0000 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 Content-Type: text/plain X-SW-Source: 2015-07/txt/msg01596.txt.bz2 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); } } -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer