public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jeff Law <law@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>,
	       Christophe Lyon <christophe.lyon@linaro.org>,
	       David Edelsohn <dje.gcc@gmail.com>,
	       Eric Botcazou <ebotcazou@adacore.com>
Subject: Re: [PR64164] drop copyrename, integrate into expand
Date: Sat, 18 Jul 2015 08:26:00 -0000	[thread overview]
Message-ID: <ora8ut3oh6.fsf@livre.home> (raw)
In-Reply-To: <ory4ifhkkg.fsf@free.home> (Alexandre Oliva's message of "Thu, 16	Jul 2015 18:14:07 -0300")

On Jul 16, 2015, Alexandre Oliva <aoliva@redhat.com> 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<insn_cache_hasher> *);
 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);
+
 \f
 /* 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<tree> *args)
+split_complex_args (struct assign_parm_data_all *all, vec<tree> *args)
 {
   unsigned i;
   tree p;
@@ -2278,6 +2280,7 @@ split_complex_args (vec<tree> *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<tree> *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<tree> *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

  reply	other threads:[~2015-07-18  7:38 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 18:04 Alexandre Oliva
2015-03-27 18:11 ` Alexandre Oliva
2015-03-28 19:22 ` Alexandre Oliva
2015-03-31  5:11   ` Jeff Law
2015-04-03 13:17     ` Alexandre Oliva
2015-04-06 16:08       ` Jeff Law
2015-04-24  1:56         ` Alexandre Oliva
2015-04-27 11:39           ` Richard Biener
2015-06-06  5:12             ` Alexandre Oliva
2015-06-08  8:16               ` Richard Biener
2015-06-09  8:58                 ` Christophe Lyon
2015-06-10  0:28               ` Alexandre Oliva
2015-06-10 13:36                 ` Richard Biener
2015-07-16  7:58                   ` Alexandre Oliva
2015-07-16  8:50                     ` Richard Biener
2015-07-16 21:33                       ` Alexandre Oliva
2015-07-18  8:26                         ` Alexandre Oliva [this message]
2015-07-21 13:25                           ` Richard Biener
2015-07-22 17:13                             ` Alexandre Oliva
2015-07-22 17:43                             ` Alexandre Oliva
2015-07-23 11:04                               ` Richard Biener
2015-07-23 15:42                                 ` Alexandre Oliva
2015-07-23 20:35                                   ` Segher Boessenkool
2015-07-23 21:24                                     ` H.J. Lu
2015-07-23 22:11                                       ` H.J. Lu
2015-07-24  1:31                                         ` David Edelsohn
2015-07-24  5:08                                           ` H.J. Lu
2015-07-24  9:26                                             ` Richard Biener
2015-07-24 12:50                                               ` H.J. Lu
2015-07-24 20:20                                           ` Alexandre Oliva
2015-07-25  2:37                                             ` David Edelsohn
2015-07-27 22:16                                               ` Alexandre Oliva
2015-07-27 22:31                                                 ` H.J. Lu
2015-07-24 18:51                                         ` Alexandre Oliva
2015-07-24 19:12                                           ` H.J. Lu
2015-07-24 19:31                                             ` David Edelsohn
2015-07-24 20:43                                               ` Alexandre Oliva
2015-07-24 20:47                                             ` Alexandre Oliva
2015-07-24 21:53                                               ` H.J. Lu
2015-07-25  7:17                                                 ` Richard Biener
2015-07-29 20:52                                         ` Alexandre Oliva
2015-07-29 21:06                                           ` H.J. Lu
2015-07-30 17:47                                             ` H.J. Lu
2015-08-03 23:46                                               ` Alexandre Oliva
2015-08-04  9:48                                                 ` Richard Biener
2015-08-05  0:39                                                   ` Alexandre Oliva
2015-08-05  9:14                                                     ` Richard Biener
2015-08-05 23:03                                                       ` Alexandre Oliva
2015-08-10  8:24                                                 ` James Greenhalgh
2015-08-10 15:14                                                   ` Jeff Law
2015-08-11  4:53                                                     ` Patrick Marlier
2015-08-14 19:03                                                       ` Alexandre Oliva
2015-08-15  8:57                                                         ` Andreas Schwab
2015-08-16 13:00                                                           ` Alexandre Oliva
     [not found]                                                             ` <m2k2sv8s21.fsf@linux-m68k.org>
2015-08-17  5:05                                                               ` Alexandre Oliva
2015-08-17  9:29                                                                 ` Kyrill Tkachov
2015-08-17 16:23                                                                   ` Andrew Pinski
2015-08-18 16:18                                                                 ` Kyrill Tkachov
2015-08-16 16:42                                                         ` Andreas Schwab
2015-08-17  2:57                                                           ` Alexandre Oliva
2015-08-17  8:23                                                             ` Andreas Schwab
2015-08-17  9:21                                                               ` Andreas Schwab
2015-08-17 11:58                                                               ` Alexandre Oliva
2015-08-17  7:48                                                         ` Christophe Lyon
2015-08-17 12:43                                                           ` Alexandre Oliva
2015-08-17 13:39                                                             ` Christophe Lyon
2015-08-18  6:53                                                               ` Alexandre Oliva
2015-08-19  6:50                                                                 ` Alexandre Oliva
2015-08-19 10:17                                                                   ` Richard Biener
2015-08-19 13:35                                                                   ` Andreas Schwab
2015-08-19 13:45                                                                     ` Andreas Schwab
2015-08-19 17:48                                                                       ` Alexandre Oliva
2015-08-20  1:44                                                                         ` Alexandre Oliva
2015-08-20 17:03                                                                           ` Jeff Law
2015-08-21  7:57                                                                           ` Alexandre Oliva
2015-08-21  8:38                                                                             ` Richard Biener
2015-08-21 12:17                                                                             ` Andreas Schwab
2015-08-21  8:11                                                                           ` Alexandre Oliva
2015-08-21  8:37                                                                             ` Richard Biener
2015-09-02 17:09                                                         ` Alan Lawrence
2015-09-02 22:34                                                           ` Alexandre Oliva
2015-09-03 10:58                                                             ` Alan Lawrence
2015-09-18 15:49                                                             ` Alan Lawrence
2015-09-23 20:44                                                               ` Alexandre Oliva
2015-09-25 11:39                                                                 ` Richard Biener
2015-10-09  5:26                                                                   ` [PR67828] don't unswitch loops on undefined SSA values (was: Re: [PR64164] drop copyrename, integrate into expand) Alexandre Oliva
2015-10-09  9:35                                                                     ` Richard Biener
2015-10-09  5:36                                                                   ` [PR67766] reorder return value copying from PARALLELs and CONCATs " Alexandre Oliva
2015-10-09  7:33                                                                     ` [PR67891] drop is_gimple_reg test from set_parm_rtl (was: [PR67766] reorder return value copying from PARALLELs and CONCATs) Alexandre Oliva
2015-10-09  9:40                                                                       ` Richard Biener
2015-10-10 13:20                                                                         ` [PR67891] drop is_gimple_reg test from set_parm_rtl Alexandre Oliva
2015-10-12 10:22                                                                           ` Richard Biener
2015-10-14  3:25                                                                             ` Alexandre Oliva
2015-10-14  9:28                                                                               ` Richard Biener
2015-11-03  1:11                                                                                 ` Alexandre Oliva
2015-11-03  3:14                                                                                   ` Jeff Law
2015-11-03  4:29                                                                                     ` Alexandre Oliva
2022-10-17 12:08                                                                                       ` Tag 'gcc/gimple-expr.cc:mark_addressable_2' as 'static' (was: [PR67891] drop is_gimple_reg test from set_parm_rtl) Thomas Schwinge
2015-10-09  9:36                                                                     ` [PR67766] reorder return value copying from PARALLELs and CONCATs (was: Re: [PR64164] drop copyrename, integrate into expand) Richard Biener
2015-09-29 11:31                                                                 ` [PR64164] drop copyrename, integrate into expand Szabolcs Nagy
2015-10-07 22:37                                                                   ` Alexandre Oliva
2015-10-08 10:00                                                                     ` Richard Biener
2015-10-09 21:10                                                                     ` Jeff Law
2015-11-05  5:09                                                                 ` Alexandre Oliva
2015-11-05 13:44                                                                   ` Richard Biener
2015-11-10 15:31                                                                   ` Alan Lawrence
2015-11-10 22:59                                                                     ` Alexandre Oliva
2015-11-10 23:43                                                                       ` Jeff Law
2015-11-11 18:10                                                                         ` Alexandre Oliva
2015-11-13  6:33                                                                           ` Jeff Law
2015-11-17  0:07                                                                             ` Alexandre Oliva
2015-11-24  5:41                                                                               ` Jeff Law
2015-07-24 18:21                                     ` Alexandre Oliva
2015-07-29 20:32                                     ` Alexandre Oliva
2015-04-29  3:51           ` Jeff Law
2015-03-31  6:55   ` Steven Bosscher
2015-03-31 13:30     ` Richard Biener
2015-03-31 14:06   ` Richard Biener
2015-04-03 13:30     ` Alexandre Oliva
2015-04-06 15:57       ` Jeff Law
2015-12-04 12:45 ` Dominik Vogt
2015-06-09 16:19 David Edelsohn
2015-06-09 18:36 ` Alexandre Oliva
2015-06-09 20:24   ` Alexandre Oliva
2015-06-09 20:59     ` Jakub Jelinek
2015-06-09 21:36     ` Eric Botcazou
2015-06-09 21:38       ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ora8ut3oh6.fsf@livre.home \
    --to=aoliva@redhat.com \
    --cc=christophe.lyon@linaro.org \
    --cc=dje.gcc@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).