This is the mail archive of the
mailing list for the GCC project.
Re: gcc project
On Tue, 2006-03-28 at 17:23, Diego Novillo wrote:
> Oh, excellent. Coincidentally, we have been thinking about developing
> some kind of plugin/extension framework to allow these classes of
> analyses. One of the goals is to provide an extensibility mechanism
> that will not require rebuilding GCC nor adding code that may not be
> often used. Some of these checks are only interesting in very specific
> cases, so they may not be something that we want to add to the compiler
> So, the idea is to have a generic .so plugin mechanism with a relatively
> stable API that lets you hook into the compilation pipeline and do your
> analysis/transformation. This would have the double advantage of
> allowing people to write ad-hoc passes and/or analyses that may not be
> suitable for the core compiler. It would also allow users to extend GCC
> without having to get into the source code itself (assuming we get the
> abstractions and exports right, of course).
I see. The plugin approach you're sketching is very general, through
which anyone could write virtually any check, provided that it learns
(1) the AST structure and (2) the API to manipulate it.
I took a quite different approach, much more lightweight, which lets
really anyone write a restricted class of checks without knowing the
AST, nor any API.
Nevertheless, this light approach could be combined with the API-based
approach, by complementing the (declarative) code patterns with
(executable) predicates using the API, and loaded as dynamic libraries.
Thus, the two approaches can complement each other, leaving
unexperienced users to write simple checks, and advanced users to write
more complex checks.
The more general idea is that compiling and (simple) checking can be
fused together with a lot of advantages. I also wrote some papers on the
subject (that I would have loved to submit to the gcc summit but I
didn't learn soon enough about it, that's too bad :(( ).
> I'd be very interested in taking a look at what you've done. Perhaps
> the best approach for you now is to get this code into a branch. We
> already are in a "no new features" stage for 4.2.
Ok, I'll take a few days to install subversion, figure how to use it,
port my stuff to the current 4.2 mainline, etc, and I'll get back. Note
that I'm doing everything on my spare time, so it's not that predictable