From patchwork Wed Nov 9 21:13:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 81569 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp408638qge; Wed, 9 Nov 2016 13:14:20 -0800 (PST) X-Received: by 10.99.42.80 with SMTP id q77mr3079620pgq.170.1478726060290; Wed, 09 Nov 2016 13:14:20 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q14si1163330pgn.274.2016.11.09.13.14.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Nov 2016 13:14:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-440894-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-440894-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-440894-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:in-reply-to:references :content-type:mime-version; q=dns; s=default; b=SjtFdi3C7JveRAYG Ylp5ep6D87Ln3DJL8SvGVDr3qbX+/p/oS3jRYEmoJGNtQaP0X19dT3kyO/7M1yDy lKtLdGoNB+xtkKNgvc+Cd/Kmr6qz3XcEnKCCMwlO8fCt9ZU9bi1/LVXRVpr71IDp 2Z1852wsTOYpKmeyrbe9OJllcdg= 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 :message-id:subject:from:to:date:in-reply-to:references :content-type:mime-version; s=default; bh=iEMVEQchbG1BssT1IK5HGz Ktn6A=; b=PX2GBDVJ1y+KXSilq6GJiOau9zndcmKaNuDjogaXddEjmLA1l6BCht cL1yxZP/yBfYv6vvrNvQM51R/ZYdl6/0SLid2myywnWXYIbp7ubyP80nvY7n8nZy w4JZgNLjL9+6dPqIaByg19NV+Q+kmkiJqAHGQ30QufLIQkX20bOxg= Received: (qmail 124037 invoked by alias); 9 Nov 2016 21:14:04 -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 124019 invoked by uid 89); 9 Nov 2016 21:14:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ubizjak@gmail.com, ubizjakgmailcom, U*ubizjak, sk:ubizjak 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, 09 Nov 2016 21:14:02 +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 403384DD53 for ; Wed, 9 Nov 2016 21:14:01 +0000 (UTC) Received: from vpn-224-185.phx2.redhat.com (vpn-224-185.phx2.redhat.com [10.3.224.185]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA9LE0i1026977; Wed, 9 Nov 2016 16:14:00 -0500 Message-ID: <1478726039.7673.21.camel@redhat.com> Subject: Re: [PATCH] (v2) print-rtl-function.c: add (param) directive to dump From: David Malcolm To: Bernd Schmidt , gcc-patches@gcc.gnu.org Date: Wed, 09 Nov 2016 16:13:59 -0500 In-Reply-To: References: <1478709966-17333-1-git-send-email-dmalcolm@redhat.com> Mime-Version: 1.0 X-IsSubscribed: yes On Wed, 2016-11-09 at 17:46 +0100, Bernd Schmidt wrote: > On 11/09/2016 05:46 PM, David Malcolm wrote: > > > OK for trunk if it passes bootstrap and regrtest? > > > > gcc/ChangeLog: > > * print-rtl-function.c (print_any_param_name): New function. > > (print_param): New function. > > (print_rtx_function): Call print_param for each argument. > > * print-rtl.c (rtx_writer::finish_directive): New function. > > * print-rtl.h (rtx_writer::finish_directive): New decl. > > + > > + rtx decl_rtl = DECL_WRTL_CHECK (arg)->decl_with_rtl.rtl; > > Isn't this DECL_RTL_IF_SET? If so, please use that macro. Otherwise > ok. Yes, it is; thanks. Using it required including varasm.h. For reference, here's what I committed, as r242023 (having verified bootstrap and regrtest). Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 242022) +++ gcc/ChangeLog (revision 242023) @@ -1,3 +1,12 @@ +2016-11-09 David Malcolm + + * print-rtl-function.c: Include varasm.h. + (print_any_param_name): New function. + (print_param): New function. + (print_rtx_function): Call print_param for each argument. + * print-rtl.c (rtx_writer::finish_directive): New function. + * print-rtl.h (rtx_writer::finish_directive): New decl. + 2016-11-09 Uros Bizjak PR target/78262 Index: gcc/print-rtl.c =================================================================== --- gcc/print-rtl.c (revision 242022) +++ gcc/print-rtl.c (revision 242023) @@ -804,6 +804,15 @@ m_sawclose = 1; } +/* Emit a closing parenthesis and newline. */ + +void +rtx_writer::finish_directive () +{ + fprintf (m_outfile, ")\n"); + m_sawclose = 0; +} + /* Print an rtx on the current line of FILE. Initially indent IND characters. */ Index: gcc/print-rtl.h =================================================================== --- gcc/print-rtl.h (revision 242022) +++ gcc/print-rtl.h (revision 242023) @@ -31,6 +31,8 @@ void print_rtl (const_rtx rtx_first); int print_rtl_single_with_indent (const_rtx x, int ind); + void finish_directive (); + private: void print_rtx_operand_code_0 (const_rtx in_rtx, int idx); void print_rtx_operand_code_e (const_rtx in_rtx, int idx); Index: gcc/print-rtl-function.c =================================================================== --- gcc/print-rtl-function.c (revision 242022) +++ gcc/print-rtl-function.c (revision 242023) @@ -33,6 +33,7 @@ #include "langhooks.h" #include "memmodel.h" #include "emit-rtl.h" +#include "varasm.h" /* Print an "(edge-from)" or "(edge-to)" directive describing E to OUTFILE. */ @@ -127,6 +128,37 @@ return true; } +/* Subroutine of print_param. Write the name of ARG, if any, to OUTFILE. */ + +static void +print_any_param_name (FILE *outfile, tree arg) +{ + if (DECL_NAME (arg)) + fprintf (outfile, " \"%s\"", IDENTIFIER_POINTER (DECL_NAME (arg))); +} + +/* Print a "(param)" directive for ARG to OUTFILE. */ + +static void +print_param (FILE *outfile, rtx_writer &w, tree arg) +{ + fprintf (outfile, " (param"); + print_any_param_name (outfile, arg); + fprintf (outfile, "\n"); + + /* Print the value of DECL_RTL (without lazy-evaluation). */ + fprintf (outfile, " (DECL_RTL "); + w.print_rtx (DECL_RTL_IF_SET (arg)); + w.finish_directive (); + + /* Print DECL_INCOMING_RTL. */ + fprintf (outfile, " (DECL_RTL_INCOMING "); + w.print_rtx (DECL_INCOMING_RTL (arg)); + fprintf (outfile, ")"); + + w.finish_directive (); +} + /* Write FN to OUTFILE in a form suitable for parsing, with indentation and comments to make the structure easy for a human to grok. Track the basic blocks of insns in the chain, wrapping those that are within @@ -197,6 +229,10 @@ fprintf (outfile, "(function \"%s\"\n", dname); + /* Params. */ + for (tree arg = DECL_ARGUMENTS (fdecl); arg; arg = DECL_CHAIN (arg)) + print_param (outfile, w, arg); + /* The instruction chain. */ fprintf (outfile, " (insn-chain\n"); basic_block curr_bb = NULL;