Help with TREE_PUBLIC

Ian Lance Taylor iant@google.com
Wed May 12 22:36:00 GMT 2010


Ajay Kumar <nitk.ajay@gmail.com> writes:

>                    FOR_EACH_BB (bb)
>                   {
>                        for(gsi = gsi_start_bb (bb); !gsi_end_p(gsi);
> gsi_next(&gsi))
>                       {
>                                gimple stmt = gsi_stmt(gsi);
>                                if(is_gimple_assign(stmt))
>                                {
>
> if(TREE_PUBLIC(gimple_assign_lhs(stmt)) ||
> TREE_PUBLIC(gimple_assign_rhs1(stmt)))
>                                        {
>                                        tree temp;
>                                        if(TREE_PUBLIC(gimple_assign_lhs(stmt)))
>                                        temp = gimple_assign_lhs(stmt);
>                                        else
>                                        temp = gimple_assign_rhs1(stmt);
>
> printf("%s\n",IDENTIFIER_POINTER(DECL_NAME(temp)));
>                                        }
>                                }
>                        }
>                    }
>
> This is working fine for normal datatypes but failing for data structures.

You should make sure that you are looking at a VAR_DECL before
checking TREE_PUBLIC.  In particular, it's likely that some of the
gimple_assign_lhs values are actually COMPONENT_REF, so you aren't
looking at the right node.

Ian



More information about the Gcc-help mailing list