This is the mail archive of the
mailing list for the GCC project.
Help with gcc-plugin (Traverse all loops inside function)
- From: Aditya K <hiraditya at msn dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 15 Sep 2015 12:38:25 +0000
- Subject: Help with gcc-plugin (Traverse all loops inside function)
- Authentication-results: sourceware.org; auth=none
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)));
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,
register_callback (plugin_name, PLUGIN_FINISH_PARSE_FUNCTION,