public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc extensibility
@ 2012-03-29 12:34 Niels Möller
  2012-03-29 13:14 ` Richard Guenther
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Niels Möller @ 2012-03-29 12:34 UTC (permalink / raw)
  To: gcc

I originally wrote this email as a reply to Ian Lance Taylor on a
different list, and he suggested that I send it also to the gcc list.
Please cc me on replies, since I'm not subscribed to the list. I hope
I'm not being too off-topic or off-the-mark.

Let me write down some reflections on gcc extensibility, even if I'm not
familiar at all with gcc internals.

1. I imagine the plugin API ought to stay in plain C, right?

2. Then there are at least two ways to think about the plugin API to,
   e.g., the gcc tree abstraction.

   Either one can define a C API one think the plugins will like, and
   then implement that on top of the internal C++ interfaces. These will
   be small wrapper functions, which lets the internal interfaces evolve
   without affecting the plugins.

   Or one sticks to a single "unified" tree API, to be used *both*
   internally and by plugins.

   I suspect the second option is the right one, because it brings some
   equality between plugin authors and gcc developers. It should make it
   easier to adopt a plugin into gcc proper. Together with (1), this
   forces the internal interface to be C rather than C++, which I guess
   you may see as a serious disadvantage.

   Going for a unified API, one gets less independence between plugins
   and gcc internals, but in return, one gets less clutter, and I think
   it may improve quality. Otherwise, it seems likely that one ends up
   with an internal interface which is powerful but somewhat ugly
   (internal use only, right?) and an external interface which may be
   beautiful on the surface, but in practice it's a second class citizen
   and awkward for doing interesting things with.

3. What is the purpose of the plugin API? I can see that it should make
   it easier to prototype new optimization passes. Both for educational
   purposes, and research, as well as by the gcc developers themselves.

   One of the goals you stated was "I think parts of GCC needs to move
   toward being a component of tools other than pure compilation, such
   as refactoring, profile analysis, debugging."

   I think we can all agree that's highly desirable. To be more
   concrete, I think it would be useful have access to information from
   the parse tree, from the symbol table (both for compiler and linker),
   dataflow analysis, etc, when editing C code in emacs. Is a plugin API
   the right tool for that type of integration? Or should one also have
   a gcc library, and have various other specialized tools link to that
   library?

   Maybe the organization of valgrind could provide some inspiration,
   with a couple of different tools on top of the same machinery.

Happy hacking,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2012-03-31  1:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 12:34 gcc extensibility Niels Möller
2012-03-29 13:14 ` Richard Guenther
2012-03-29 18:00   ` Romain Geissler
2012-03-29 14:59 ` Gabriel Dos Reis
2012-03-29 18:31   ` Niels Möller
2012-03-29 19:09     ` Gabriel Dos Reis
2012-03-29 15:35 ` Romain Geissler
2012-03-29 16:06   ` Gabriel Dos Reis
2012-03-29 16:27     ` Basile Starynkevitch
2012-03-29 16:42       ` Gabriel Dos Reis
2012-03-29 16:52         ` Basile Starynkevitch
2012-03-29 17:01           ` Gabriel Dos Reis
2012-03-29 17:04           ` Andrew MacLeod
2012-03-29 18:41           ` Jonathan Wakely
2012-03-29 19:01             ` Basile Starynkevitch
2012-03-29 19:22               ` Diego Novillo
2012-03-29 20:37                 ` Basile Starynkevitch
2012-03-29 19:10           ` Pedro Alves
2012-03-29 17:39     ` Romain Geissler
2012-03-29 19:01       ` Gabriel Dos Reis
2012-03-29 19:29         ` Romain Geissler
2012-03-30  7:15     ` Ludovic Courtès
2012-03-30  8:37       ` Richard Guenther
2012-03-30  9:54         ` Bernd Schmidt
2012-03-31  1:20           ` Miles Bader
2012-03-30 12:05       ` Gabriel Dos Reis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).