I need to write a GCC extension, I am trying to use the GCC Plugins API that is fournished with GCC, but it is poorly documented, and very difficult to use, I can't find any example using the last version of it ...
I read that there are many other ways to create a gcc extension such as GCC Melt, and GCC python plugins, can anyone tell me the benefits/drawbacks of each of them, is there any major difference between the 3 ways of creating plugins ?
I have written plugins using both the C++ API and using the Python plugin. I haven't tried MELT, so I can't speak to that.
My preferred approach is to use Python. It is just a lot simpler to get a plugin up and running this way -- no compilation to worry about, the API is well-documented and simple, and, finally, the plugin is very easy to build from scratch (just make
).
There are two main drawbacks to using the Python plugin.
The drawback I hit most regularly is that it does not expose all of the useful parts of GCC. This has not been a major problem, though, and in the past I've found it simple to just add the needed functionality to the Python plugin.
The other possible drawback is that a Python plugin may be slower than one written in C++. This has never been an issue for me.