From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115823 invoked by alias); 30 Sep 2019 15:00:36 -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 115681 invoked by uid 89); 30 Sep 2019 15:00:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=pieces, capabilities, counterparts X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2019 15:00:14 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8UEvW3O076448 for ; Mon, 30 Sep 2019 11:00:11 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vbk5p2n8a-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Sep 2019 11:00:10 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Sep 2019 16:00:08 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 30 Sep 2019 16:00:05 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8UF04nk41877852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Sep 2019 15:00:04 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 122755205F; Mon, 30 Sep 2019 15:00:04 +0000 (GMT) Received: from dyn-9-152-96-81.boeblingen.de.ibm.com (unknown [9.152.96.81]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id B9C7852054; Mon, 30 Sep 2019 15:00:03 +0000 (GMT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: [PATCH v3 2/9] Introduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_* From: Ilya Leoshkevich In-Reply-To: Date: Mon, 30 Sep 2019 15:00:00 -0000 Cc: GCC Patches , Richard Biener , segher@kernel.crashing.org, joseph@codesourcery.com, krebbel@linux.ibm.com, rdapp@linux.ibm.com Content-Transfer-Encoding: quoted-printable References: <20190905111019.8951-1-iii@linux.ibm.com> <20190905111019.8951-3-iii@linux.ibm.com> To: Richard Sandiford x-cbid: 19093015-0028-0000-0000-000003A40513 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19093015-0029-0000-0000-000024662EF7 Message-Id: <27E5FB94-589D-4D5E-83FF-468CDC538D3C@linux.ibm.com> X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg01771.txt.bz2 > Am 06.09.2019 um 14:40 schrieb Richard Sandiford : >=20 > Ilya Leoshkevich 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. >>=20 >> Provide the macro counterparts of gen_* functions required by the next >> patch in series. >>=20 >> gcc/ChangeLog: >>=20 >> 2019-08-27 Ilya Leoshkevich >>=20 >> 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(-) >>=20 >> 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, unsi= gned int regno) >> set_regno_raw (x, regno, nregs); >> } >>=20 >> -/* Generate a new REG rtx. Make sure ORIGINAL_REGNO is set properly, a= nd >> +/* 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). */ >>=20 >> rtx >> -gen_raw_REG (machine_mode mode, unsigned int regno) >> +init_raw_REG (rtx x, machine_mode mode, unsigned int regno) >> { >> - rtx x =3D rtx_alloc (REG MEM_STAT_INFO); >> set_mode_and_regno (x, mode, regno); >> REG_ATTRS (x) =3D NULL; >> ORIGINAL_REGNO (x) =3D regno; >> return x; >> } >>=20 >> +/* Generate a new REG rtx. */ >> + >> +rtx >> +gen_raw_REG (machine_mode mode, unsigned int regno) >> +{ >> + rtx x =3D rtx_alloc (REG MEM_STAT_INFO); >> + init_raw_REG (x, mode, regno); >> + return x; >> +} >> + >=20 > 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. >=20 > Maybe the comment above init_raw_REG can instead be just: >=20 > /* Initialize a fresh REG rtx with mode MODE and register REGNO. */ >=20 >> [...] >> @@ -266,16 +261,55 @@ gendef (const char *format) >> else >> printf (" %s (rt, %d) =3D arg%d;\n", accessor_from_format (*p), i= , j++); >>=20 >> - 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", form= at); >> + for (p =3D format, i =3D 0; *p !=3D 0; p++) >> + if (*p !=3D '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 =3D rtx_alloc (code PASS_MEM_STAT);"); >> + printf (" init_rtx_fmt_%s (rt, mode", format); >> + for (p =3D format, i =3D 0; *p !=3D 0; p++) >> + if (*p !=3D '0') >> + printf (", arg%d", i++); >> + puts (");\n"); >> + >> + puts (" return rt;\n}\n"); >=20 > Might as well make it: >=20 > printf (" return init_rtx_fmt_%s (rt, mode", format); >=20 > and drop the separate return, for consistency with the new > alloca code. >=20 > OK with those changes, thanks. I've made the changes and committed the patch: https://gcc.gnu.org/viewcvs/gcc?view=3Drevision&revision=3D276303 Thanks for the review!