From patchwork Sun Jul 11 03:47:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis ChengRq X-Patchwork-Id: 58505 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 9A2E4B6F04 for ; Sun, 11 Jul 2010 13:48:05 +1000 (EST) Received: (qmail 21191 invoked by alias); 11 Jul 2010 03:48:03 -0000 Received: (qmail 21178 invoked by uid 22791); 11 Jul 2010 03:48:02 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-px0-f175.google.com (HELO mail-px0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Jul 2010 03:47:56 +0000 Received: by pxi12 with SMTP id 12so547744pxi.20 for ; Sat, 10 Jul 2010 20:47:54 -0700 (PDT) Received: by 10.114.75.7 with SMTP id x7mr13760590waa.171.1278820073171; Sat, 10 Jul 2010 20:47:53 -0700 (PDT) Received: from localhost.localdomain (bb219-74-177-218.singnet.com.sg [219.74.177.218]) by mx.google.com with ESMTPS id k25sm2791266rvb.4.2010.07.10.20.47.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 10 Jul 2010 20:47:52 -0700 (PDT) From: crquan@gmail.com To: gcc-patches@gcc.gnu.org Cc: "Dennis, CHENG Renquan" Subject: [PATCH] passes.c: handle register_pass with a name starting with a star Date: Sun, 11 Jul 2010 11:47:15 +0800 Message-Id: <1278820035-18384-2-git-send-email-crquan@gmail.com> In-Reply-To: <1278820035-18384-1-git-send-email-crquan@gmail.com> References: <1278820035-18384-1-git-send-email-crquan@gmail.com> 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 From: "Dennis, CHENG Renquan" The gcc included passes have the feature that a name starting with a start do not dump anything; so should the plugin registered passes have. And since passes from gcc and from plugin both have been asserted having a name at least; the check for pass->name in any following code is not necessary. Bootstraped on i686-pc-linux-gnu with --enable-checking=all. 2010-07-10 "Dennis, CHENG Renquan" * passes.c (register_pass): handle plugin registered passes with a name starting with a star do not dump anything. * passes.c: remove some cases of pass->name check. --- Git 1.7.1.1 CHENG Renquan 38 St Thomas Walk, Singapore 238118 http://crquan.fedorapeople.org --- gcc-4.5-20100708/gcc/passes.c.orig 2010-05-19 21:14:37.000000000 +0800 +++ gcc-4.5-20100708/gcc/passes.c 2010-07-11 10:10:13.972787670 +0800 @@ -422,7 +422,7 @@ register_dump_files_1 (struct opt_pass * int new_properties = (properties | pass->properties_provided) & ~pass->properties_destroyed; - if (pass->name && pass->name[0] != '*') + if (pass->name[0] != '*') register_one_dump_file (pass); if (pass->sub) @@ -488,7 +488,7 @@ make_pass_instance (struct opt_pass *pas and so it should rename the dump file. The first instance will be -1, and be number of duplicates = -static_pass_number - 1. Subsequent instances will be > 0 and just the duplicate number. */ - if ((pass->name && pass->name[0] != '*') || track_duplicates) + if ((pass->name[0] != '*') || track_duplicates) { pass->static_pass_number -= 1; new_pass->static_pass_number = -pass->static_pass_number; @@ -553,7 +553,6 @@ position_pass (struct register_pass_info /* Check if the current pass is of the same type as the new pass and matches the name and the instance number of the reference pass. */ if (pass->type == new_pass_info->pass->type - && pass->name && !strcmp (pass->name, new_pass_info->reference_pass_name) && ((new_pass_info->ref_pass_instance_number == 0) || (new_pass_info->ref_pass_instance_number == @@ -679,18 +678,22 @@ register_pass (struct register_pass_info { struct pass_list_node *next_node = added_pass_nodes->next; enum tree_dump_index tdi; - register_one_dump_file (added_pass_nodes->pass); - if (added_pass_nodes->pass->type == SIMPLE_IPA_PASS - || added_pass_nodes->pass->type == IPA_PASS) - tdi = TDI_ipa_all; - else if (added_pass_nodes->pass->type == GIMPLE_PASS) - tdi = TDI_tree_all; - else - tdi = TDI_rtl_all; - /* Check if dump-all flag is specified. */ - if (get_dump_file_info (tdi)->state) - get_dump_file_info (added_pass_nodes->pass->static_pass_number) - ->state = get_dump_file_info (tdi)->state; + + if (added_pass_nodes->pass->name[0] != '*') + { + register_one_dump_file (added_pass_nodes->pass); + if (added_pass_nodes->pass->type == SIMPLE_IPA_PASS + || added_pass_nodes->pass->type == IPA_PASS) + tdi = TDI_ipa_all; + else if (added_pass_nodes->pass->type == GIMPLE_PASS) + tdi = TDI_tree_all; + else + tdi = TDI_rtl_all; + /* Check if dump-all flag is specified. */ + if (get_dump_file_info (tdi)->state) + get_dump_file_info (added_pass_nodes->pass->static_pass_number) + ->state = get_dump_file_info (tdi)->state; + } XDELETE (added_pass_nodes); added_pass_nodes = next_node; } @@ -1542,7 +1545,7 @@ execute_one_pass (struct opt_pass *pass) invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass); if (!quiet_flag && !cfun) - fprintf (stderr, " <%s>", pass->name ? pass->name : ""); + fprintf (stderr, " <%s>", pass->name); /* Note that the folders should only create gimple expressions. This is a hack until the new folder is ready. */