From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17981 invoked by alias); 31 May 2011 05:46:49 -0000 Received: (qmail 17971 invoked by uid 22791); 31 May 2011 05:46:48 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 May 2011 05:46:33 +0000 Received: from kpbe18.cbf.corp.google.com (kpbe18.cbf.corp.google.com [172.25.105.82]) by smtp-out.google.com with ESMTP id p4V5kVZ0005151 for ; Mon, 30 May 2011 22:46:31 -0700 Received: from pvf33 (pvf33.prod.google.com [10.241.210.97]) by kpbe18.cbf.corp.google.com with ESMTP id p4V5kF9x006137 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 30 May 2011 22:46:30 -0700 Received: by pvf33 with SMTP id 33so1931625pvf.10 for ; Mon, 30 May 2011 22:46:29 -0700 (PDT) Received: by 10.68.41.134 with SMTP id f6mr2286346pbl.273.1306820789830; Mon, 30 May 2011 22:46:29 -0700 (PDT) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id i7sm3444688pbj.10.2011.05.30.22.46.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2011 22:46:29 -0700 (PDT) From: Ian Lance Taylor To: Abdul Wahid Memon Cc: gcc-help@gcc.gnu.org Subject: Re: Need info on GIMPLE References: Date: Tue, 31 May 2011 06:37:00 -0000 In-Reply-To: (Abdul Wahid Memon's message of "Sun, 29 May 2011 15:19:04 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg00438.txt.bz2 Abdul Wahid Memon writes: > I need to count the number of labels present in the representation > such as after optimized pass, but > I dont know why I don't encounter label statement in my switch > statement's case clause even though > there are some labels present. I am using iterators over basic blocks > and statement to determine how many > statement are there and which type. > > FOR_EACH_BB(bb) > { > for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) > { > > switch(gimple_code(stmt)) > { > case GIMPLE_NOP: > printf("NOP : "); > break; > case GIMPLE_COND: > printf("COND_STMT / "); > break; > case GIMPLE_LABEL: > printf("LABEL / "); > break; > } > } > } > > Other cases are being matched such as GIMPLE_COND but not > GIMPLE_LABEL. Is there anything I am missing. Case labels are never GIMPLE_LABEL statements. Either the switch is turned into a series of conditionals and the labels are discarded, or you get a GIMPLE_SWITCH which incorporates CASE_LABEL_EXPR tree nodes (see GIMPLE_SWITCH in gimple.def). Ian