This is the mail archive of the
mailing list for the GCC project.
Plugin API Comments (was Re: GCC Plug-in Framework ready to port)
- From: Sean Callanan <spyffe at cs dot sunysb dot edu>
- To: gcc at gcc dot gnu dot org
- Cc: Justin Seyster <jseyster at cs dot sunysb dot edu>
- Date: Sat, 31 Jan 2009 22:06:45 -0500
- Subject: Plugin API Comments (was Re: GCC Plug-in Framework ready to port)
- References: <email@example.com> <EFC35277-A978-4B6E-9F06-DC56C1409B99@cs.sunysb.edu> <firstname.lastname@example.org>
1- Agree on a common API and document it in
So to get the ball rolling, here are some comments on the API as
(1) register_callback is an unnecessary API. It's already possible to
use dlsym() to get a pointer to a symbol in a plug-in. A plug-in
could export a function symbol corresponding to each hook it is
interested in; that way a plug-in would simply have things like
instead of needing to register that callback. Equivalently, a global
data structure in the plug-in could map hook UIDs to function
pointers, giving the same effect. This latter approach would provide
very elegant hook versioning.
(2) It would be very nice to be able to store trees between passes;
right now, our custom version of GCC has a separate garbage-collection
root for plug-ins so that they can store data between passes.
(3) The -fplugin-arg argument is one way to do arguments. We do it as
We also have a magic argument called FILE that lets you load arguments
from a file.
(4) We strongly support the user () GCC attribute.
As a second note, we have some debugging tools we could contribute as
soon as an API is fixed, including a GIMPLE visualizer with GDB
We also have a file (called parameter.def) which formalizes the macros
that are valid for each type of GIMPLE tree node. We use this .def
file extensively when handling trees in a generic way (such as for