This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Beginner: Declarations do not show up when iterating through Gimple stmts
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Jeff Saremi <jeffsaremi at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 26 Aug 2010 11:49:33 +0200
- Subject: Re: Beginner: Declarations do not show up when iterating through Gimple stmts
- References: <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);
> ? ?}
> }
>
>