From patchwork Thu Oct 18 08:09:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharad Singhai X-Patchwork-Id: 192228 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 16A7E2C0098 for ; Thu, 18 Oct 2012 19:10:30 +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=1351152631; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received: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=GsHYqQ+ So4fVXaw9+eCrmJswosI=; b=NsaT8kRe2GtmMJyAI7gFFZfFtCrl1rsN+0+XliC 4bXXPSCMu4t41owcPheSovSeUaNhzOJFrbYoBFov116Ktfm6rC5d+1/tPnqO4s3Q nIzet6mr6xyYH9OjlwIaq7vCvHjjDLjeReurIblmSaE4VHu+hv0HHbpGvgvKnJ8u 7flY= 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: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=hYGgqYLFMFUCcXkcr/BUd0wKZrVrPoOSKihUOM8BQuUviGkhPgZF+J8mKV0MVW 7wmz+3z8sGhFbTNzrqebcVwESWtxxXyv3DniPBRTLp6wivzdbjfGb8ebSyCTf46J x02l7ZhwpuwYOu8EotUUxlS3c5ERjTXsOnzT68pny5MCI=; Received: (qmail 21608 invoked by alias); 18 Oct 2012 08:10:23 -0000 Received: (qmail 21587 invoked by uid 22791); 18 Oct 2012 08:10:20 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-la0-f47.google.com (HELO mail-la0-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Oct 2012 08:10:15 +0000 Received: by mail-la0-f47.google.com with SMTP id h5so5739108lam.20 for ; Thu, 18 Oct 2012 01:10:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type :x-system-of-record:x-gm-message-state; bh=/d4vcN2PhnHRansLYhHVBExGaoAAaXDj/TIxrh/I8WU=; b=GkjVMHRFKJIBMnVtm05qFlcOuHxG/Y4nsm9Q9kUP7O7Xf0mzRfRsnhi9l97iQdU3ti 71RUCddzFSV99F3ex/34fCcr/xWUXiMJ8W5RMX1p9QT3ktJND3EL1vP5T1yvFDc8hkUm 3NT94vobqguuRQRuZgYM86N9hFIwS5MabAuzUzhSiO3d2me8+JGfaZBeffbB2hA73qGE moE6Imlq713hxEWsBLiNmmbYrOAGBBud9idI8SVqpFmesTGL83FXGAu33Qe9pyOtWQ+3 yPY1e7AgsYehdmHBZdUDV3yRVIQFWAg1iAq6m03oEW2FpIXWcLJ+DD7dv/9QuXHeDORh vE+w== Received: by 10.112.103.7 with SMTP id fs7mr7634310lbb.25.1350547813868; Thu, 18 Oct 2012 01:10:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.61.69 with HTTP; Thu, 18 Oct 2012 01:09:33 -0700 (PDT) From: Sharad Singhai Date: Thu, 18 Oct 2012 01:09:33 -0700 Message-ID: Subject: [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: ALoCoQmsKDOW5OoMuMI/ckBjE3l6mZBTvuQpxpI4x3PtcOsMgv8DtLsI8r+BKN84O5zHVE1jeFyV4+5rKzk8vIGjyvuVGCDEItF396+cKrwblIKLxASRmZiIThyCVnOCWWb9xXtogKHfNtZtgG55aW8zinbs/lHbzh0YNml1v1vdo/def+nsuqf+mtmQsIps+AqfYpI7hm3a 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 Hi, This patch fixes a problem with the new dump infrastructure as discussed in http://gcc.gnu.org/ml/gcc/2012-10/msg00227.html. It removes a check for current_function_decl so that dumps will work for IPA passes. In addition, this patch also adds a new inline function to check if any dump files are available. I have bootstrapped and tested on x86_64. Okay for trunk? Thanks, Sharad 2012-10-18 Sharad Singhai * dumpfile.c (dump_enabled_phase): New function. (dump_enabled_p): Rename to dump_enabled_phase. Update all callers. A new function with the same name 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 192549) +++ 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_enabled_phase (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_enabled_phase (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_enabled_phase (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_enabled_phase (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 192549) +++ 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;