From patchwork Fri Jun 3 14:17:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 98587 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]) by ozlabs.org (Postfix) with SMTP id 79CA3B6FAC for ; Sat, 4 Jun 2011 00:22:16 +1000 (EST) Received: (qmail 12387 invoked by alias); 3 Jun 2011 14:22:14 -0000 Received: (qmail 12378 invoked by uid 22791); 3 Jun 2011 14:22:13 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Jun 2011 14:21:56 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p53ELtGI024030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 3 Jun 2011 10:21:56 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p53ELoAY015459 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Jun 2011 10:21:54 -0400 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p53ELkNu021206; Fri, 3 Jun 2011 11:21:46 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p53EHjPw021075; Fri, 3 Jun 2011 11:17:46 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p53EHiqN021074; Fri, 3 Jun 2011 11:17:44 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: David Li Subject: don't dump decl_uid with TDF_NOUID Date: Fri, 03 Jun 2011 11:17:43 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 A recent change introduced decl_uid in the “;; Function ” header in dump files. This breaks -fcompare-debug (and bootstrap-debug-lean), because decl uids aren't kept in sync between -g and non-g compilations. This patch rearranges the header so that decl_uid is omitted when dumping with NOUID, and it prints the header for the -fcompare-debug final dump with NOUID. Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok? for gcc/ChangeLog from Alexandre Oliva * tree-pretty-print.c (dump_function_header): Add flags. Don't dump decl_uid with nouid. * tree-pretty-print.h (dump_function_header): Adjust. * final.c (rest_of_clean_state): Pass dump_flags on, with nouid. * passes.c (pass_init_dump_file): Pass dump_flags on. * tree-cfg.c (gimple_dump_cfg): Pass flags on. Index: gcc/tree-pretty-print.c =================================================================== --- gcc/tree-pretty-print.c.orig 2011-06-03 00:11:42.155149610 -0300 +++ gcc/tree-pretty-print.c 2011-06-03 00:23:42.369499744 -0300 @@ -3018,7 +3018,7 @@ pp_base_tree_identifier (pretty_printer function dump. */ void -dump_function_header (FILE *dump_file, tree fdecl) +dump_function_header (FILE *dump_file, tree fdecl, int flags) { const char *dname, *aname; struct cgraph_node *node = cgraph_get_node (fdecl); @@ -3032,11 +3032,13 @@ dump_function_header (FILE *dump_file, t else aname = ""; + fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d", + dname, aname, fun->funcdef_no); + if (!(flags & TDF_NOUID)) + fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl)); if (node) { - fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d, decl_uid=%d, cgraph_uid=%d)", - dname, aname, fun->funcdef_no, DECL_UID(fdecl), node->uid); - fprintf (dump_file, "%s\n\n", + fprintf (dump_file, ", cgraph_uid=%d)%s\n\n", node->uid, node->frequency == NODE_FREQUENCY_HOT ? " (hot)" : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED @@ -3046,6 +3048,5 @@ dump_function_header (FILE *dump_file, t : ""); } else - fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d, decl_uid = %d)", - dname, aname, fun->funcdef_no, DECL_UID(fdecl)); + fprintf (dump_file, ")\n\n"); } Index: gcc/tree-pretty-print.h =================================================================== --- gcc/tree-pretty-print.h.orig 2011-06-03 00:23:22.350625260 -0300 +++ gcc/tree-pretty-print.h 2011-06-03 00:26:25.826492765 -0300 @@ -50,7 +50,7 @@ extern void debug_generic_expr (tree); extern void debug_generic_stmt (tree); extern void debug_tree_chain (tree); extern void percent_K_format (text_info *); -extern void dump_function_header (FILE *, tree); +extern void dump_function_header (FILE *, tree, int); /* In toplev.c */ extern bool default_tree_printer (pretty_printer *, text_info *, const char *, Index: gcc/final.c =================================================================== --- gcc/final.c.orig 2011-06-03 00:23:22.615623595 -0300 +++ gcc/final.c 2011-06-03 00:23:33.156557448 -0300 @@ -4361,10 +4361,11 @@ rest_of_clean_state (void) } else { - dump_function_header (final_output, current_function_decl); flag_dump_noaddr = flag_dump_unnumbered = 1; if (flag_compare_debug_opt || flag_compare_debug) dump_flags |= TDF_NOUID; + dump_function_header (final_output, current_function_decl, + dump_flags); final_insns_dump_p = true; for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) Index: gcc/passes.c =================================================================== --- gcc/passes.c.orig 2011-06-03 00:23:22.875621962 -0300 +++ gcc/passes.c 2011-06-03 00:52:59.536068338 -0300 @@ -1638,7 +1638,7 @@ pass_init_dump_file (struct opt_pass *pa dump_file_name = get_dump_file_name (pass->static_pass_number); dump_file = dump_begin (pass->static_pass_number, &dump_flags); if (dump_file && current_function_decl) - dump_function_header (dump_file, current_function_decl); + dump_function_header (dump_file, current_function_decl, dump_flags); return initializing_dump; } else Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c.orig 2011-06-03 00:23:23.161620166 -0300 +++ gcc/tree-cfg.c 2011-06-03 00:57:20.777549758 -0300 @@ -2052,7 +2052,7 @@ gimple_dump_cfg (FILE *file, int flags) { if (flags & TDF_DETAILS) { - dump_function_header (file, current_function_decl); + dump_function_header (file, current_function_decl, flags); fprintf (file, ";; \n%d basic blocks, %d edges, last basic block %d.\n\n", n_basic_blocks, n_edges, last_basic_block);