From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24911 invoked by alias); 26 Aug 2010 09:49:42 -0000 Received: (qmail 24894 invoked by uid 22791); 26 Aug 2010 09:49:41 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Aug 2010 09:49:35 +0000 Received: by gxk2 with SMTP id 2so678482gxk.20 for ; Thu, 26 Aug 2010 02:49:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.95.6 with SMTP id s6mr10643622anb.200.1282816173795; Thu, 26 Aug 2010 02:49:33 -0700 (PDT) Received: by 10.231.13.77 with HTTP; Thu, 26 Aug 2010 02:49:33 -0700 (PDT) In-Reply-To: <436405.36087.qm@web88105.mail.re2.yahoo.com> References: <436405.36087.qm@web88105.mail.re2.yahoo.com> Date: Thu, 26 Aug 2010 10:16:00 -0000 Message-ID: Subject: Re: Beginner: Declarations do not show up when iterating through Gimple stmts From: Richard Guenther To: Jeff Saremi Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00371.txt.bz2 On Thu, Aug 26, 2010 at 3:18 AM, Jeff Saremi wrote: > I wanted to go through declarations in a function and print them out so a= s to get more familiar with them before being able to manipulate them. > I wrote this function as a plugin; it successfully writes out all stateme= nts but mysteriouslty the declarations are missing. What am I missing? Is t= here a different way to iterate through declarations? There are no declaration statements in gimple. Richard. > thanks > jeff > > static tree my_walk_stmt(gimple_stmt_iterator *gsi, bool *oprnds_handled,= struct walk_stmt_info *stmt_info) > { > =A0 =A0 =A0 =A0int code; > =A0 =A0 =A0 =A0gimple stmt =3D gsi_stmt(*gsi); > =A0 =A0 =A0 =A0code =3D gimple_code(stmt); > =A0 =A0 =A0 =A0switch(code) > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0default: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf("Gimple code =3D %s\n", gimple_code= _name[code]); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0*oprnds_handled =3D true; > =A0 =A0 =A0 =A0return NULL_TREE; > } > static unsigned int execute_var_alias(void) > { > =A0 =A0gimple_stmt_iterator gsi; > =A0 =A0gimple_seq seq; > =A0 =A0seq =3D gimple_body(current_function_decl); > =A0 =A0for (gsi =3D gsi_start(seq); !gsi_end_p(gsi); gsi_next(&gsi)) > =A0 =A0{ > =A0 =A0 =A0 =A0gimple stmt =3D gsi_stmt(gsi); > =A0 =A0 =A0 =A0walk_gimple_stmt(&gsi, my_walk_stmt, NULL, NULL); > =A0 =A0} > } > >