Re: How to check the type of gimple

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 24 Oct 2018 at 20:19, wang tom via gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
>
> Hello,
> I want to write a function in pass to check basic block is POINTER_TYPE or not.Here is my code:>unsigned int>find_pointer (function *fun)>{> basic_block bb;>  gimple_stmt_iterator gsi;
> >  FOR_EACH_BB_FN(bb,cfun)>  {>    for (gsi = gsi_start_bb(bb); ! gsi_end_p(gsi); gsi_next(&gsi))>    {>      gimple *stmt = gsi_stmt (gsi);>      stmt = gsi_stmt (gsi);>     if (TREE_CODE(stmt)==POINTER_TYPE)>  >     fprintf(stderr, "find pointer\n");                    >    }>  }...
> But it seems that using TREE_CODE with gimple is not correct.Can you give some advice?
You might want to check type of stmt's result.
stmt = gsi_stmt (gsi);
lhs = gimple_get_lhs (stmt);
if (lhs && POINTER_TYPE_P (TREE_TYPE (lhs)))
  fprintf (stderr, "pointer found");

Regards,
Prathamesh
> Thank you




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux