Problem with the plugin interface

Grégory Vaumourin gregory.vaumourin@gmail.com
Fri Oct 24 13:16:00 GMT 2014


Hi ,

I'm trying to update my plugins from the gcc4.8.3 to the 4.9.1 version
of GCC, the interface seems to have change abit and I don't understand
a few basic things anymore. I didn't find any examples on GCC
documentation about plugins or internet on how to register a pass with
the new interface.
I just want to install a new pass in my plugin, so I'm filling the
structure register_pass_info and pass it to the register_callback this
way :
        register_callback("my_plugin_
name", PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);

I don't understand how to fill the field "pass" of the structure
register_pass_info. It seems now this field is a opt_pass class and
not a simple structure anymore, same class as the internal pass of
GCC. So I naturally tried to copy what the internals pass are doing to
create a new pass, I did this for my pass :

class pass_greg : public gimple_opt_pass
{
public:
  pass_greg (gcc::context ctxt)
    : gimple_opt_pass (pass_data_greg, gcc::context ctxt)
  {}

  bool gate () { return greg_gate(); }
  unsigned int execute () { return greg_pass (); }

};

but I don't undertand what is this parameter gcc::context that I need
to instantiate my pass. Moreover the opt_pass symbole is defined in
pass_manager which include a "pass-instances.def" that is not in the
plugin API

Maybe some of you have a little example to put me back on track, or
point me to some docs that I missed.

Regards,

Gregory Vaumourin



More information about the Gcc-help mailing list