public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Jeff Saremi <jeffsaremi@yahoo.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Beginner: Declarations do not show up when iterating through Gimple stmts
Date: Thu, 26 Aug 2010 10:16:00 -0000	[thread overview]
Message-ID: <AANLkTin3ub52eRHBCQ9p5bEme1fZZj0Ltc7BMcAXF_4m@mail.gmail.com> (raw)
In-Reply-To: <436405.36087.qm@web88105.mail.re2.yahoo.com>

On Thu, Aug 26, 2010 at 3:18 AM, Jeff Saremi <jeffsaremi@yahoo.com> wrote:
> I wanted to go through declarations in a function and print them out so as to get more familiar with them before being able to manipulate them.
> I wrote this function as a plugin; it successfully writes out all statements but mysteriouslty the declarations are missing. What am I missing? Is there 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)
> {
>        int code;
>        gimple stmt = gsi_stmt(*gsi);
>        code = gimple_code(stmt);
>        switch(code)
>        {
>        default:
>                printf("Gimple code = %s\n", gimple_code_name[code]);
>                break;
>        }
>        *oprnds_handled = true;
>        return NULL_TREE;
> }
> static unsigned int execute_var_alias(void)
> {
>    gimple_stmt_iterator gsi;
>    gimple_seq seq;
>    seq = gimple_body(current_function_decl);
>    for (gsi = gsi_start(seq); !gsi_end_p(gsi); gsi_next(&gsi))
>    {
>        gimple stmt = gsi_stmt(gsi);
>        walk_gimple_stmt(&gsi, my_walk_stmt, NULL, NULL);
>    }
> }
>
>

  reply	other threads:[~2010-08-26  9:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26  9:49 Jeff Saremi
2010-08-26 10:16 ` Richard Guenther [this message]
2010-08-27  4:10   ` Jeff Saremi
2010-08-27  8:00   ` Guidance needed: hi-level steps to track an object until its destruction Jeff Saremi
2010-08-28 17:44     ` Basile Starynkevitch
2010-08-28 17:53       ` Jeff Saremi
2010-08-29 13:25       ` Uday P. Khedker
2010-08-29 16:58         ` J Decker
2010-08-29 19:49           ` Uday P. Khedker
2010-08-29 17:50         ` Basile Starynkevitch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTin3ub52eRHBCQ9p5bEme1fZZj0Ltc7BMcAXF_4m@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jeffsaremi@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).