Help Required on Missing GOTO statements in Gimple/SSA/CFG Pass ...

Mohsin Khan
Tue Feb 18 05:47:00 GMT 2014


 I am developing plugins for the GCC-4.8.2. I am a newbie in plugins.
I wrote a plugin and tried to count and see the Goto Statements using
the gimple_stmt_iterator. I get gimple statements printed on my
stdout, but I am not able to find the line which has goto statements.
I only get other lines such as variable declaration and logic
statements, but no goto statements.
  When I open the Gimple/SSA/CFG file seperately using the vim editor
I find the goto statements are actually present.
  So, can anyone help me. How can I actually get the count of Goto
statements or atleast access these goto statements using some
  I have used -fdump-tree-all, -fdump-tree-cfg as flags.

Here is the pseudocode:

struct register_pass_info pass_info = {
&(pass_plugin.pass),                         /* Address of new pass,
here, the 'struct
                                             opt_pass' field of
                                             defined above */
        "ssa",                               /* Name of the reference
pass for hooking up
                                             the new pass.   ??? */
        0,                                   /* Insert the pass at the
specified instance
                                             number of the reference
pass. Do it for
                                             every instance if it is 0. */
        PASS_POS_INSERT_AFTER                /* how to insert the new
pass: before,
                                             after, or replace. Here
we are inserting
                                             a pass names 'plug' after
the pass named
                                             'pta' */


static unsigned int dead_code_elimination (void)

   FOR_EACH_BB_FN (bb, cfun)
          //  gimple_dump_bb(stdout,bb,0,0);
         //    printf("\nIn New BB");

           gsi2= gsi_after_labels (bb);
             /*Iterating over each gimple statement in a basic block*/
                for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
           g = gsi_stmt(gsi);


              if (gimple_code(g)==GIMPLE_GOTO)
                      printf("\nFound GOTO stmt\n");

      //    analyze_gimple_statement (gsi);

More information about the Gcc mailing list