An introduction to creating GCC plugins: also GCC MELT or GCC Python
Posted Sep 29, 2011 6:42 UTC (Thu) by
bstarynk (guest, #63409)
Parent article:
An introduction to creating GCC plugins
There are also some simpler way to extend GCC: coding GCC plugins in C is tedious, and there are some alternatives:
- First, use GCC-MELT (disclaimer: I, Basile, am the main author of GCC MELT). MELT is a high-level domain specific language to ease the development of GCC extensions. The MELT language provides some high-level features: ability to do powerful pattern matching on GCC internal data (like Gimple): first-class dynamically typed garbage-collected values; ability to add new GCC passes in MELT; the MELT language is translated to C, and you can even add small C code chunks in your MELT code; MELT has a syntax similar to Lisp or Scheme; your MELT extensions can analyze or modify GCC internal representations, for various tasks like static analysis, coding rules validation, specific warnings, optimization, code refactoring, etc. MELT is available as a GCC [meta-] plugin.
- There is also a Gcc Python Plugin which enables you to code your GCC plugin-like extensions in Python. However, Python don't give you pattern matching on GCC internal representations (like MELT does), and the GCC Python plugin is less mature than MELT so gives you access to less internal GCC data.
The main point is that people should consider extending GCC for their own needs and this is now possible with GCC plugin machinery, either in C, or in MELT or Python.
--
Basile Starynkevitch
(
Log in to post comments)