From patchwork Sat Oct 20 01:24:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharad Singhai X-Patchwork-Id: 192884 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 BC8AD2C0093 for ; Sat, 20 Oct 2012 12:25:42 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351301144; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:In-Reply-To:References:From:Date: Message-ID:Subject:To:Cc:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=QK/N0jCsW4nUAGcxfyBMCIg69FM=; b=ozPGCqGZkqYxd4q Jnea/qtRtpgUY3VtzcjYM8krmIIZCpjdVpQ95qRYct/M/JD28S/vrKP1mLVELwtF 31d1ibuOcpExH+C8ypAhQ/HNsgdd4UZ5c4KQZeS2x5GWa9/JZv5J/3D8nWUkvcJT +WTHChRBoBK3/CBcGiGI9v6fE9Tg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:MIME-Version:Received:In-Reply-To:References:From:Date:Message-ID:Subject:To:Cc:Content-Type:X-System-Of-Record:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=b4CoRXADVC4kVWKluWWV9vfQ/GOOLrSuaUNzW4xY0B8UGF5u1eb9hjtsWandCc sXzLaNdemTEYOOjLtqWEH2NhYY2xGEwQfbXn58FXaOLXKquKvKbMJLxeXBGoBU/D b5vi9w3uVdZhhXh07z/Q0StUIvde0IpbLnHyjZYOPFhRw=; Received: (qmail 20696 invoked by alias); 20 Oct 2012 01:25:38 -0000 Received: (qmail 20686 invoked by uid 22791); 20 Oct 2012 01:25:37 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vc0-f175.google.com (HELO mail-vc0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 20 Oct 2012 01:25:29 +0000 Received: by mail-vc0-f175.google.com with SMTP id p1so1216338vcq.20 for ; Fri, 19 Oct 2012 18:25:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=Sp+T61pR/uU9UtG65Kcd4FUMTZ4l80gnGzNgiPmhj8A=; b=VLR1ju08AxeowyRBt7akEv0ig9r2PNXbK0WTOkiMDMvD1otqu0scaBGSGwzBpJcp+A ncqW2dzsZQ3c8PIwzLeVTJcKipleTuvbcgRmo7Wqw8Bod8oszwpE38OEE47HtfVBYyoD sDFsfoEU52ns0d4gNj/fMWZUEgeCMCg6LCSACDAWnJvMvuKlOxMZ3vhkz82M1Y67kAxR IDlJH51kabMY11t+bBlYh15JXAtZLX0v4xm6z+WimTLsNfwZh2zClteiHjrv9UDDYl9k pN5KQf5nMIYffs5bS9evLJnhMmtOfsLdbPVUUHMBHk7iC2vHzfCmwOZnuo8FIm3ctk9d jDWQ== Received: by 10.52.96.97 with SMTP id dr1mr1888916vdb.100.1350696328923; Fri, 19 Oct 2012 18:25:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.26.76 with HTTP; Fri, 19 Oct 2012 18:24:48 -0700 (PDT) In-Reply-To: References: From: Sharad Singhai Date: Fri, 19 Oct 2012 18:24:48 -0700 Message-ID: Subject: Re: [PATCH] Fix dumps for IPA passes To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener , Martin Jambor , David Li X-System-Of-Record: true X-Gm-Message-State: ALoCoQltIQlI0wtwdbOHFBTHuJ50AkW89AWxlPMGh2gB5JxzwmBAfwb3eyRnqV9Dsn/eSOnCOgksNPvrbhMpmkVquVj/oP/JdTXfS9qLT5oWBVAVPOimOhyWrJWnc5yXk8o+y5f1zU4tW143EOiKRamHpjhdoQlDP/Sv5b3SESbu7At98pSDn713KxcFEufWk+JrnnZNHxi8 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 As suggested in http://gcc.gnu.org/ml/gcc/2012-10/msg00285.html, I have updated the attached patch to rename 'dump_enabled_phase' to 'dump_enabled_phase_p'. The 'dump_enabled_p ()' doesn't take any argument and can be used as a predicate for the dump calls. Once this patch gets in, the plan is to update the existing calls (in vectorizer passes) of the form if (dump_kind_p (flags)) dump_printf(flags, ...) to if (dump_enabled_p ()) dump_printf(flags, ...) Bootstrapped and tested on x86_64 and didn't observe any new test failures. Okay for trunk? Thanks, Sharad 2012-10-19 Sharad Singhai * dumpfile.c (dump_phase_enabled_p): Renamed dump_enabled_p. Update all callers. (dump_enabled_p): A new function to check if any of the dump files is available. (dump_kind_p): Remove check for current_function_decl. Add check for dumpfile and alt_dump_file. * dumpfile.h: Add declaration of dump_enabled_p. Index: dumpfile.c =================================================================== --- dumpfile.c (revision 192623) +++ dumpfile.c (working copy) @@ -35,7 +35,7 @@ static int alt_flags; /* current op static FILE *alt_dump_file = NULL; static void dump_loc (int, FILE *, source_location); -static int dump_enabled_p (int); +static int dump_phase_enabled_p (int); static FILE *dump_open_alternate_stream (struct dump_file_info *); /* Table of tree dump switches. This must be consistent with the @@ -380,7 +380,7 @@ dump_start (int phase, int *flag_ptr) char *name; struct dump_file_info *dfi; FILE *stream; - if (phase == TDI_none || !dump_enabled_p (phase)) + if (phase == TDI_none || !dump_phase_enabled_p (phase)) return 0; dfi = get_dump_file_info (phase); @@ -461,7 +461,7 @@ dump_begin (int phase, int *flag_ptr) struct dump_file_info *dfi; FILE *stream; - if (phase == TDI_none || !dump_enabled_p (phase)) + if (phase == TDI_none || !dump_phase_enabled_p (phase)) return NULL; name = get_dump_file_name (phase); @@ -493,8 +493,8 @@ dump_begin (int phase, int *flag_ptr) If PHASE is TDI_tree_all, return nonzero if any dump is enabled for any phase. */ -int -dump_enabled_p (int phase) +static int +dump_phase_enabled_p (int phase) { if (phase == TDI_tree_all) { @@ -514,6 +514,14 @@ dump_begin (int phase, int *flag_ptr) } } +/* Return true if any of the dumps are enabled, false otherwise. */ + +inline bool +dump_enabled_p (void) +{ + return (dump_file || alt_dump_file); +} + /* Returns nonzero if tree dump PHASE has been initialized. */ int @@ -834,9 +842,8 @@ opt_info_switch_p (const char *arg) bool dump_kind_p (int msg_type) { - if (!current_function_decl) - return 0; - return ((msg_type & pflags) || (msg_type & alt_flags)); + return (dump_file && (msg_type & pflags)) + || (alt_dump_file && (msg_type & alt_flags)); } /* Print basic block on the dump streams. */ Index: dumpfile.h =================================================================== --- dumpfile.h (revision 192623) +++ dumpfile.h (working copy) @@ -121,6 +121,7 @@ extern int dump_switch_p (const char *); extern int opt_info_switch_p (const char *); extern const char *dump_flag_name (int); extern bool dump_kind_p (int); +extern inline bool dump_enabled_p (void); extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2; extern void dump_printf_loc (int, source_location, const char *, ...) ATTRIBUTE_PRINTF_3;