From patchwork Wed Oct 12 21:04:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 681404 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 3svQYn0jyJz9s36 for ; Thu, 13 Oct 2016 07:33:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BrqbZTmx; 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:date:message-id:in-reply-to:references; q=dns; s= default; b=kKGuFM4jx8xk9hGypQ139yYWZSMHWV0orgRwvGL6mFFJ4MhQrO1s5 BM6fUHeT9XgeiAoTd1ONdph2Hv2t1VfVGDJFSVotSiY0nfZhFKSgWp4836GOhu0C zjtspJGy8P+CIhwzz9ZipKO1y69nveMEzmz+7e5JYUA2b4s1tzX9uc= 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:date:message-id:in-reply-to:references; s= default; bh=kUBd2q4gv2bOkO0Lz4gCb8j86JI=; b=BrqbZTmx9+sBtkfX67YF iMVfFJmVS+kAeCouaqHht51/D5Oxnc/pDHeNF+LD/pF0TyB4+pBtcLq72VdA4bPh 2znUm8ilQV9MmhQzLmPJsf81Kg4HbYeWuvsc8drMFBaClIUvpHG2R4ve4pj7lKo+ OwMAjWPiZKiygzBdK+fOKqc= Received: (qmail 10904 invoked by alias); 12 Oct 2016 20:33:37 -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 10884 invoked by uid 89); 12 Oct 2016 20:33:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=74, 7, omitting, Express, our 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 ESMTP; Wed, 12 Oct 2016 20:33:36 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDFE6E0362 for ; Wed, 12 Oct 2016 20:33:34 +0000 (UTC) Received: from c64.redhat.com (vpn-237-13.phx2.redhat.com [10.3.237.13]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9CKXXLv015780; Wed, 12 Oct 2016 16:33:34 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: Bernd Schmidt , David Malcolm Subject: [PATCH] Tweaks to print_rtx_function Date: Wed, 12 Oct 2016 17:04:30 -0400 Message-Id: <1476306270-32228-1-git-send-email-dmalcolm@redhat.com> In-Reply-To: <43d4ec20-5f84-2533-22e4-e16c779f6162@redhat.com> References: <43d4ec20-5f84-2533-22e4-e16c779f6162@redhat.com> X-IsSubscribed: yes On Wed, 2016-10-12 at 19:31 +0200, Bernd Schmidt wrote: > On 10/12/2016 07:48 PM, David Malcolm wrote: [...snip...] > > I think the only remaining item from our discussion above is what > > to do > > about the numbering of pseudos in the dumps (currently it just > > prints the regno > > unmodified). > > > > Other than that, is the resultant dump format good enough that I > > can start > > rewriting the RTL frontend parser, or are there other changes you'd > > want? > > Give me a day or two to think it over, and for others to chime in. > But I > think this is reasonably close to what it should look like. Maybe > empty > edge flags don't need to be printed, and possibly there could be a > more > compact format for a large number edges like what you have for the > switch? [...snip...] This patch implements: * the renumbering of non-virtual pseudos, using LAST_VIRTUAL_REGISTER + 1 as a base. * omitting the edge "(flags)" directive if there aren't any Bootstrap & regrtest in progress. OK for trunk if they pass? gcc/ChangeLog: * print-rtl-function.c (print_edge): Omit "(flags)" when none are set. * print-rtl.c (print_rtx_operand_code_r): In compact mode, print pseudos offset by (LAST_VIRTUAL_REGISTER + 1), so that the first non-virtual pseudo is 0. --- gcc/print-rtl-function.c | 13 +++++++++---- gcc/print-rtl.c | 8 ++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/print-rtl-function.c b/gcc/print-rtl-function.c index 90a0ff7..770cee3 100644 --- a/gcc/print-rtl-function.c +++ b/gcc/print-rtl-function.c @@ -59,9 +59,11 @@ print_edge (FILE *outfile, edge e, bool from) /* Express edge flags as a string with " | " separator. e.g. (flags "FALLTHRU | DFS_BACK"). */ - fprintf (outfile, " (flags \""); - bool seen_flag = false; -#define DEF_EDGE_FLAG(NAME,IDX) \ + if (e->flags) + { + fprintf (outfile, " (flags \""); + bool seen_flag = false; +#define DEF_EDGE_FLAG(NAME,IDX) \ do { \ if (e->flags & EDGE_##NAME) \ { \ @@ -74,7 +76,10 @@ print_edge (FILE *outfile, edge e, bool from) #include "cfg-flags.def" #undef DEF_EDGE_FLAG - fprintf (outfile, "\"))\n"); + fprintf (outfile, "\")"); + } + + fprintf (outfile, ")\n"); } /* If BB is non-NULL, print the start of a "(block)" directive for it diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index f114cb4..86816b5 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -400,6 +400,14 @@ print_rtx_operand_code_r (const_rtx in_rtx) #endif if (flag_dump_unnumbered && is_insn) fputc ('#', outfile); + else if (flag_compact) + { + /* In compact mode, print pseudos offset by + (LAST_VIRTUAL_REGISTER + 1), so that the first non-virtual pseudo + is dumped as 0. */ + gcc_assert (regno > LAST_VIRTUAL_REGISTER); + fprintf (outfile, " %d", regno - (LAST_VIRTUAL_REGISTER + 1)); + } else fprintf (outfile, " %d", regno);