I started with one of the test cases in the plugin testsuite "def_plugin.c". 
Pasted the code for convenience.
I want to traverse all the loops in a function.

Maybe use, loops_for_fn (DECL_STRUCT_FUNCTION (fndef)), but this does not seem 
to work.


/* Callback function to invoke after GCC finishes a function definition. */

void plugin_finish_parse_function (void *event_data, void *data)
{
  tree fndef = (tree) event_data;
  //struct loops *l  = loops_for_fn (DECL_STRUCT_FUNCTION (fndef));
  warning (0, G_("Finish fndef %s"),
           IDENTIFIER_POINTER (DECL_NAME (fndef)));
}

int
plugin_init (struct plugin_name_args *plugin_info,
             struct plugin_gcc_version *version)
{
  const char *plugin_name = plugin_info->base_name;

  register_callback (plugin_name, PLUGIN_START_PARSE_FUNCTION,
                     plugin_start_parse_function, NULL);

  register_callback (plugin_name, PLUGIN_FINISH_PARSE_FUNCTION,
                     plugin_finish_parse_function, NULL);
  return 0;
}

Thanks,
-Aditya


                                          

Reply via email to