From patchwork Wed Mar 16 13:27:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 598352 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 3qQC3J517Yz9sCk for ; Thu, 17 Mar 2016 00:27:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=qoA2LppF; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=E/tkBXYPfJlFvoPHL b3+8U/pcY348cHFg/ugbRuFy1XPWHtBd9Vm7MSSHuHmjSR2dNhPwYLSSw98UlBri SqIqKzPKI1d+VhH3DnJwjDWkdS+QCyOnPmWe5P8X4bT8GmMTdjKoaWhTZimai0Fy 6um3ED75gEx0BtyWRAjczPPx7A= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=EEIcc0UX9SGshQ49RvpiGn/ 1tAI=; b=qoA2LppF3SwEI5yoVvYr4xBl3jGYkUJsGhpW3Et4bzX/p+MEgpjd3rm ZfO5CdnUJVOLJ1b+wlCyJ5d3WtvjByC/0n91dq7f464V0v4GdM0BFWFSGQXQ1uQd sT7CzRAVKUrUqVUf6h2v6ngtcUO1D90Voo8UQ46uTUBbqdGg7w+I= Received: (qmail 6939 invoked by alias); 16 Mar 2016 13:27:45 -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 5973 invoked by uid 89); 16 Mar 2016 13:27:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=*file, 6826, HX-detected-operating-system:Windows X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 16 Mar 2016 13:27:42 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51197) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1agBUC-0003qK-Gy for gcc-patches@gnu.org; Wed, 16 Mar 2016 09:27:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agBU8-0008CY-Sv for gcc-patches@gnu.org; Wed, 16 Mar 2016 09:27:40 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:35623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agBU8-0008C8-KU for gcc-patches@gnu.org; Wed, 16 Mar 2016 09:27:36 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-03.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1agBU3-00058w-Bv from Tom_deVries@mentor.com ; Wed, 16 Mar 2016 06:27:31 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-03.mgc.mentorg.com (137.202.0.108) with Microsoft SMTP Server id 14.3.224.2; Wed, 16 Mar 2016 13:27:21 +0000 Subject: [PATCH] Add debug_varinfo and debug_varmap To: Richard Biener References: <56E107E0.3090208@mentor.com> CC: "gcc-patches@gnu.org" From: Tom de Vries Message-ID: <56E95F25.8080508@mentor.com> Date: Wed, 16 Mar 2016 14:27:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 [ was: Re: [RFC] dump_varmap in tree-ssa-structalias.c ] On 10/03/16 10:07, Richard Biener wrote: > On Thu, 10 Mar 2016, Tom de Vries wrote: > >> Hi, >> >> I wrote attached patch to print the actual contents of the varmap variable in >> tree-ssa-structalias.c. >> >> Does it make sense to rewrite this into a dump_varmap/debug_varmap patch? > > Yes (but please not dump it by default) Right, that was my intention as well. > and I'd rather have a > split-out dump_varinfo to work with when debugging. Done. OK for stage1 if bootstrap and reg-test succeeds? Thanks, - Tom Add debug_varinfo and debug_varmap 2016-03-16 Tom de Vries * tree-ssa-structalias.c (dump_varinfo, debug_varinfo, dump_varmap) (debug_varmap): New function. --- gcc/tree-ssa-structalias.c | 108 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index bad1ea1..e88869f 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -682,6 +682,8 @@ void debug_constraints (void); void debug_constraint_graph (void); void debug_solution_for_var (unsigned int); void debug_sa_points_to_info (void); +void debug_varinfo (varinfo_t); +void debug_varmap (void); /* Print out constraint C to stderr. */ @@ -7496,6 +7498,112 @@ associate_varinfo_to_alias (struct cgraph_node *node, void *data) return false; } +/* Dump varinfo VI to FILE. */ + +static void +dump_varinfo (FILE *file, varinfo_t vi) +{ + if (vi == NULL) + return; + + fprintf (file, "%u: %s\n", vi->id, vi->name); + + const char *sep = " "; + if (vi->is_artificial_var) + fprintf (file, "%sartificial", sep); + if (vi->is_special_var) + fprintf (file, "%sspecial", sep); + if (vi->is_unknown_size_var) + fprintf (file, "%sunknown-size", sep); + if (vi->is_full_var) + fprintf (file, "%sfull", sep); + if (vi->is_heap_var) + fprintf (file, "%sheap", sep); + if (vi->may_have_pointers) + fprintf (file, "%smay-have-pointers", sep); + if (vi->only_restrict_pointers) + fprintf (file, "%sonly-restrict-pointers", sep); + if (vi->is_restrict_var) + fprintf (file, "%sis-restrict-var", sep); + if (vi->is_global_var) + fprintf (file, "%sglobal", sep); + if (vi->is_ipa_escape_point) + fprintf (file, "%sipa-escape-point", sep); + if (vi->is_fn_info) + fprintf (file, "%sfn-info", sep); + if (vi->ruid) + fprintf (file, "%srestrict-uid:%u", sep, vi->ruid); + if (vi->next) + fprintf (file, "%snext:%u", sep, vi->next); + if (vi->head != vi->id) + fprintf (file, "%shead:%u", sep, vi->head); + if (vi->offset) + fprintf (file, "%soffset:" HOST_WIDE_INT_PRINT_DEC, sep, vi->offset); + if (vi->size != ~(unsigned HOST_WIDE_INT)0) + fprintf (file, "%ssize:" HOST_WIDE_INT_PRINT_DEC, sep, vi->size); + if (vi->fullsize != ~(unsigned HOST_WIDE_INT)0 + && vi->fullsize != vi->size) + fprintf (file, "%sfullsize:" HOST_WIDE_INT_PRINT_DEC, sep, + vi->fullsize); + fprintf (file, "\n"); + + if (vi->solution && !bitmap_empty_p (vi->solution)) + { + bitmap_iterator bi; + unsigned i; + fprintf (file, " solution: {"); + EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi) + fprintf (file, " %u", i); + fprintf (file, " }\n"); + } + + if (vi->oldsolution && !bitmap_empty_p (vi->oldsolution) + && !bitmap_equal_p (vi->solution, vi->oldsolution)) + { + bitmap_iterator bi; + unsigned i; + fprintf (file, " oldsolution: {"); + EXECUTE_IF_SET_IN_BITMAP (vi->oldsolution, 0, i, bi) + fprintf (file, " %u", i); + fprintf (file, " }\n"); + } +} + +/* Dump varinfo VI to stderr. */ + +DEBUG_FUNCTION void +debug_varinfo (varinfo_t vi) +{ + dump_varinfo (stderr, vi); +} + +/* Dump varmap to FILE. */ + +static void +dump_varmap (FILE *file) +{ + if (varmap.length () == 0) + return; + + fprintf (file, "variables:\n"); + + for (unsigned int i = 0; i < varmap.length (); ++i) + { + varinfo_t vi = get_varinfo (i); + dump_varinfo (file, vi); + } + + fprintf (file, "\n"); +} + +/* Dump varmap to stderr. */ + +DEBUG_FUNCTION void +debug_varmap (void) +{ + dump_varmap (stderr); +} + /* Execute the driver for IPA PTA. */ static unsigned int ipa_pta_execute (void)