Hi David,
I tried dumping all the passes. I see goto in goto.c.013t.cfg.
I tried looking at other files I see goto even later on in
oto.c.143t.optimized.
part of the file goto.c.013t.cfg
if (D.1693 != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
goto <bb 6> (out);
<bb 4>:
success:
D.1696 = 0;
goto <bb 7>;
Thank you,
-----
Harie Srinivasa B.R.
On Tue, Jul 16, 2013 at 12:00 AM, Harie Srinivasa B.R.
<harie.br(a)gmail.com>wrote:
Hi David,
I did not get a mail from the mailing list but I checked
manually and saw that you had answered. Thank you for the explanation that
was clear.
Regarding why I am interested in goto statements. I am getting used to the
plugin and I eventually want to do some thing with the Linux kernel (Which
has many Goto statements). This is why I am interested in Goto statements.
Thank you,
Harie Srinivasa
-----
Harie Srinivasa B.R.
On Tue, Jul 9, 2013 at 12:28 AM, Harie Srinivasa B.R. <harie.br(a)gmail.com>wrote:
> Hi All,
> I came across this python based plugin from the dehydra page and
> was really excited to learn about this I feel this will be really powerful
> and quick way of writing plugins into GCC to do various things. I was
> trying to play around with GCC python plugin. I noticed something weird. I
> just tried to dump gimple I see that I am missing goto statements,
>
> E.g.
> I am created a call back and the callback only proceeds when the pass is
> *free_lang_data
>
> At this stage I get the CFG and in each basic block I try to print the
> Gimple statements in the basic blocks.
>
>
>
> I am doing something similar to the following.
>
> *def print_gimple_pass_execution_callback(p, fn):
> if p.name == '*free_lang_data':
> for cgn in gcc.get_callgraph_nodes():
> if isinstance(cfn, gcc.Function):
> contfg = cfn.cfg
> for block in cfg.basic_blocks:
> prev = fname + str(block.index) + "$start"
> if isinstance(block.gimple, list) and block.gimple !=
> []:
> for gimple in block.gimple:
> print gimple*
>
> I see gimple statements like
> *D.1689 = i & 1;*
>
> I also see labels but I do not see the goto.
>
> I was looking deeper into the plugin source code and I see that the
> python plugin creates a gimple statement iterator then gets the basic block
> from that and processes each statement to wrap them in the python objects.
>
>
> I wrote my own code to perform the equivalent.
>
> *static unsigned print_exec(void)
> {
> unsigned i;
> const_tree str, op;
> basic_block bb;
> gimple stmt;
> gimple_stmt_iterator gsi;
>
> FOR_EACH_BB(bb)
> for (gsi=gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi))
> {
> stmt = gsi_stmt(gsi);
> print_stmt(stmt);
> }
>
> return 0;
> }*
>
>
> I still see gimple statements but do not see the goto gimple statement
>
> *i = 0;
> D.1689_2 = (const char * restrict) &"Enter number : "[0];
> printf (D.1689_2);
> D.1690_3 = (const char * restrict) &"%d"[0];
> scanf (D.1690_3, &i);
> i.0_4 = i;
> D.1692_5 = i.0_4 & 1;
> D.1693_6 = (_Bool) D.1692_5;
> if (D.1693_6 != 0)
> success:
> D.1696_8 = 0;
> out:
> D.1696_7 = -1;
> return D.1696_1;*
>
>
>
> My program is
> *#include<stdio.h>
>
> int main()
> {
> int i=0;
> printf("Enter number : ");
> scanf("%d",&i);
> if(i%2)
> goto out;
> goto success;
> success :
> return 0;
>
> out :
> return -1;
> }
> *
> But if I dump the gimple statements with
> *gcc -fdump-tree-gimple goto.c *
>
> I see all the Gimple Goto statements.
>
> Given this and the fact that the program does what it is supposed to be
> doing I believe I may be using the wrong pass or I may be doing something
> wrong inside my plugin. I was hoping someone in this list can help me with
> this issue.
>
> I am really excited to play around with this tool. I know that the
> GimpleGoto is not fully wrapped but I would be able to wrap it once I can
> get the Goto statement from GCC.
>
> I am using *gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5*)
>
>
> Does anyone have any insight into why I am not getting the GimpleGoto
> statements? Any help would be really helpful.
> -----
> Harie Srinivasa B.R.
>