From patchwork Sat Feb 16 09:40:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 220953 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 E83AC2C008D for ; Sat, 16 Feb 2013 20:40:58 +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=1361612460; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=l/6Xly0RUds2V0r/dmm/HMDxnn4=; b=eAxEvbEhQ6SY3zk aqizvi47qG/dYF2Oz2YJky4yLar5mA2HFKnMSNs8kEgHwuG1VblQUO7vPEaE74j6 CkDevqmohkHWssFLV1nywhSydykEmZkRlvtk8Sy66/Lzs/4MC3BfaUTuQerubQZd zbrem9eM1KnZeLO/8mxXqOvyJbdo= 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:Received:Received:From:To:Cc:Subject:X-URL:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Wu+OFWwlSaIal7EIgRbyyie4ncgTy0+NIza1WO6N6gKuZgtT2r264rrzhJ+QEr +9IUYD1llDMwkXCRAWflzdbSOIgB78P1QBdWnk4I9Jnl8M8zmpNhrUqww7TLd2Nf iXCmeDNphWpmIBSQWuE5WxLb+CmDi8tUr8OIOux+oV4D8=; Received: (qmail 26249 invoked by alias); 16 Feb 2013 09:40:54 -0000 Received: (qmail 26229 invoked by uid 22791); 16 Feb 2013 09:40:54 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_CF 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; Sat, 16 Feb 2013 09:40:46 +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 r1G9ekHP022958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 16 Feb 2013 04:40:46 -0500 Received: from localhost (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1G9eiEm026232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 16 Feb 2013 04:40:45 -0500 Received: by localhost (Postfix, from userid 1000) id EF1194064A; Sat, 16 Feb 2013 10:40:43 +0100 (CET) From: Dodji Seketeli To: Jakub Jelinek , Richard Biener Cc: GCC Patches Subject: [PATCH] Add new debug_bb_range debugging function X-URL: http://www.redhat.com Date: Sat, 16 Feb 2013 10:40:43 +0100 Message-ID: <87a9r4a95w.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (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 Hello, In my first foray of debugging gimple stuff, I felt the need for a function function to dump a range of basic block from number N to P to stderr. I find this a bit more handy than calling debug_bb_n on each basic block instead. I understand this is material for 4.9, so if you agree I'll stage it in my queue of patches for when stage1 opens. Is this OK, or is there a function that does this already (or something else :))? Thanks. Tested on x86_64-unknown-linux-gnu against trunk. gcc/ * basic-block.h (debug_bb_range): Declare ... * cfg.c (debug_bb_range): ... new function. --- gcc/basic-block.h | 1 + gcc/cfg.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 90eb57b..8407c4a 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -752,6 +752,7 @@ extern bool predictable_edge_p (edge); extern void init_flow (struct function *); extern void debug_bb (basic_block); extern basic_block debug_bb_n (int); +extern basic_block debug_bb_range (int, int); extern void dump_flow_info (FILE *, int); extern void expunge_block (basic_block); extern void link_block (basic_block, basic_block); diff --git a/gcc/cfg.c b/gcc/cfg.c index 9e4380c..d34f27e 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -663,6 +663,21 @@ debug_bb_n (int n) return bb; } +/* Dumps cfg related information about basic blocks, from number 'S' + to number E, to stderr. */ + +DEBUG_FUNCTION basic_block +debug_bb_range (int s, int e) +{ + basic_block bb = NULL; + for (int i = s; i <= e; ++i) + { + bb = BASIC_BLOCK (i); + debug_bb (bb); + } + return bb; +} + /* Dumps cfg related information about basic block BB to OUTF. If HEADER is true, dump things that appear before the instructions contained in BB. If FOOTER is true, dump things that appear after.