public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org,  richard.guenther@gmail.com,
	 segher@kernel.crashing.org,  joseph@codesourcery.com,
	 krebbel@linux.ibm.com,  rdapp@linux.ibm.com
Subject: Re: [PATCH v3 2/9] Introduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_*
Date: Fri, 06 Sep 2019 12:40:00 -0000	[thread overview]
Message-ID: <mpto8zxbntk.fsf@arm.com> (raw)
In-Reply-To: <20190905111019.8951-3-iii@linux.ibm.com> (Ilya Leoshkevich's	message of "Thu, 5 Sep 2019 13:10:12 +0200")

Ilya Leoshkevich <iii@linux.ibm.com> writes:
> One of the next patches in series needs to frequently pass short-lived
> fake rtxes to the back-end in order to test its capabilities.  In order
> to reduce the load on GC, it is beneficial to allocate these rtxes on
> stack.
>
> Provide the macro counterparts of gen_* functions required by the next
> patch in series.
>
> gcc/ChangeLog:
>
> 2019-08-27  Ilya Leoshkevich  <iii@linux.ibm.com>
>
> 	PR target/77918
> 	* emit-rtl.c (gen_raw_REG): Use init_raw_REG.
> 	(init_raw_REG): New function.
> 	* gengenrtl.c (gendef): Emit init_* functions and alloca_*
> 	macros.
> 	* rtl.c (rtx_alloc_stat_v): Use rtx_init.
> 	* rtl.h (rtx_init): New function.
> 	(rtx_alloca): New function.
> 	(init_raw_REG): New function.
> 	(alloca_raw_REG): New macro.
> ---
>  gcc/emit-rtl.c  | 15 +++++++++---
>  gcc/gengenrtl.c | 64 +++++++++++++++++++++++++++++++++++++------------
>  gcc/rtl.c       |  7 +-----
>  gcc/rtl.h       | 12 ++++++++++
>  4 files changed, 74 insertions(+), 24 deletions(-)
>
> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> index a667cdab94e..ecfa3735bba 100644
> --- a/gcc/emit-rtl.c
> +++ b/gcc/emit-rtl.c
> @@ -466,20 +466,29 @@ set_mode_and_regno (rtx x, machine_mode mode, unsigned int regno)
>    set_regno_raw (x, regno, nregs);
>  }
>  
> -/* Generate a new REG rtx.  Make sure ORIGINAL_REGNO is set properly, and
> +/* Initialize a REG rtx.  Make sure ORIGINAL_REGNO is set properly, and
>     don't attempt to share with the various global pieces of rtl (such as
>     frame_pointer_rtx).  */
>  
>  rtx
> -gen_raw_REG (machine_mode mode, unsigned int regno)
> +init_raw_REG (rtx x, machine_mode mode, unsigned int regno)
>  {
> -  rtx x = rtx_alloc (REG MEM_STAT_INFO);
>    set_mode_and_regno (x, mode, regno);
>    REG_ATTRS (x) = NULL;
>    ORIGINAL_REGNO (x) = regno;
>    return x;
>  }
>  
> +/* Generate a new REG rtx.  */
> +
> +rtx
> +gen_raw_REG (machine_mode mode, unsigned int regno)
> +{
> +  rtx x = rtx_alloc (REG MEM_STAT_INFO);
> +  init_raw_REG (x, mode, regno);
> +  return x;
> +}
> +

I think we should keep the gen_raw_REG comment the same (including
the "Make sure..." bit).  The point is to contrast gen_raw_REG with
gen_rtx_REG, which does various bits of sharing.

Maybe the comment above init_raw_REG can instead be just:

/* Initialize a fresh REG rtx with mode MODE and register REGNO.  */

> [...]
> @@ -266,16 +261,55 @@ gendef (const char *format)
>      else
>        printf ("  %s (rt, %d) = arg%d;\n", accessor_from_format (*p), i, j++);
>  
> -  puts ("\n  return rt;\n}\n");
> +  puts ("  return rt;\n}\n");
> +
> +  /* Write the definition of the gen function name and the types
> +     of the arguments.  */
> +
> +  puts ("static inline rtx");
> +  printf ("gen_rtx_fmt_%s_stat (RTX_CODE code, machine_mode mode", format);
> +  for (p = format, i = 0; *p != 0; p++)
> +    if (*p != '0')
> +      printf (",\n\t%sarg%d", type_from_format (*p), i++);
> +  puts (" MEM_STAT_DECL)");
> +
> +  /* Now write out the body of the function itself, which allocates
> +     the memory and initializes it.  */
> +  puts ("{");
> +  puts ("  rtx rt;\n");
> +
> +  puts ("  rt = rtx_alloc (code PASS_MEM_STAT);");
> +  printf ("  init_rtx_fmt_%s (rt, mode", format);
> +  for (p = format, i = 0; *p != 0; p++)
> +    if (*p != '0')
> +      printf (", arg%d", i++);
> +  puts (");\n");
> +
> +  puts ("  return rt;\n}\n");

Might as well make it:

  printf ("  return init_rtx_fmt_%s (rt, mode", format);

and drop the separate return, for consistency with the new
alloca code.

OK with those changes, thanks.

Richard

  parent reply	other threads:[~2019-09-06 12:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 11:10 [PATCH v3 0/9] S/390: Use signaling FP comparison instructions Ilya Leoshkevich
2019-09-05 11:10 ` [PATCH v3 1/9] Allow COND_EXPR and VEC_COND_EXPR condtions to trap Ilya Leoshkevich
2019-09-06 11:07   ` Richard Biener
2019-09-06 15:45     ` Ilya Leoshkevich
2019-09-09  8:43       ` Richard Biener
2019-09-05 11:11 ` [PATCH v3 2/9] Introduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_* Ilya Leoshkevich
2019-09-06 11:09   ` Richard Biener
2019-09-06 12:40   ` Richard Sandiford [this message]
2019-09-30 15:00     ` Ilya Leoshkevich
2019-09-05 11:11 ` [PATCH v3 3/9] Introduce can_vector_compare_p function Ilya Leoshkevich
2019-09-06 12:58   ` Richard Sandiford
2019-09-05 11:11 ` [PATCH v3 4/9] S/390: Do not use signaling vector comparisons on z13 Ilya Leoshkevich
2019-09-06 10:34   ` Segher Boessenkool
2019-09-30 13:36     ` Ilya Leoshkevich
2019-10-01  0:24       ` Segher Boessenkool
2019-09-05 11:11 ` [PATCH v3 6/9] S/390: Remove code duplication in vec_unordered<mode> Ilya Leoshkevich
2019-09-30 14:41   ` Andreas Krebbel
2019-09-05 11:11 ` [PATCH v3 5/9] S/390: Implement vcond expander for V1TI,V1TF Ilya Leoshkevich
2019-09-30 14:51   ` Andreas Krebbel
2019-09-05 11:12 ` [PATCH v3 7/9] S/390: Remove code duplication in vec_* comparison expanders Ilya Leoshkevich
2019-09-30 14:50   ` Andreas Krebbel
2019-09-05 11:12 ` [PATCH v3 9/9] S/390: Test signaling FP comparison instructions Ilya Leoshkevich
2019-09-05 11:12 ` [PATCH v3 8/9] S/390: Use " Ilya Leoshkevich

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=mpto8zxbntk.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iii@linux.ibm.com \
    --cc=joseph@codesourcery.com \
    --cc=krebbel@linux.ibm.com \
    --cc=rdapp@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    /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).