Problem Resolved On Sun, Jul 14, 2013 at 7:43 PM, Deepak Aggrawal <deepakkansal1989@xxxxxxxxx> wrote: > I am trying to add a gimple pass, after "pre"-partial redundancy > elimination pass. But when I execute the code below, it does not > create file "myfile" and so does not write anything in the file. It > seems like the plugin is not executing. > > Please check where I am wrong in this. Thanks in advance. > > > > #include "gcc-plugin.h" > #include "config.h" > #include "system.h" > #include "alloc-pool.h" > #include "params.h" > #include "ggc.h" > #include "coretypes.h" > #include "tm.h" > #include "tree.h" > #include "tree-flow.h" > #include "diagnostic.h" > #include "tree-pass.h" > #include "timevar.h" > #include "cgraph.h" > #include "gimple.h" > > int plugin_is_GPL_compatible = 1; > > static unsigned int execute_TV_plugin(void) > { > FILE *fp; > FILE *cg; > cg = fopen("cgdump","a"); > fp = fopen("myfile","a"); > fprintf(fp,"The plugin is executing !!\n"); > } > > struct gimple_opt_pass pass_TV = > { > { > GIMPLE_PASS, > "TV", /* name */ > NULL, /* gate */ > execute_TV_plugin, /* execute */ > NULL, /* sub */ > NULL, /* next */ > 0, /* static_pass_number */ > TV_INTEGRATION, /*tv_id*/ > 0, /* properties_required */ > 0, /* properties_provided */ > 0, /* properties_destroyed */ > 0, /* todo_flags_start */ > 0 /* todo_flags_finish */ > } > }; > > struct register_pass_info pass_info = > { > &(pass_TV.pass), > "pre", > 0, > PASS_POS_INSERT_AFTER > }; > > int plugin_init(struct plugin_name_args *plugin_info, struct > plugin_gcc_version *version) > { > register_callback( > plugin_info->base_name, > PLUGIN_PASS_MANAGER_SETUP, > NULL, > &pass_info); > > return 0; > > }