LWN.net Logo

MELT

MELT

Posted Jan 23, 2010 6:46 UTC (Sat) by patrick_g (subscriber, #44470)
Parent article: LCA: Static analysis with GCC plugins

For GCC 4.5 there is also the MELT plugin (Middle End Lisp Translator) from Basile Starynkevitch.
With MELT you can implement optimisations or static analysis passes in a LISP dialect and the plugin generate C code at the end.
The tutorial is very interesting and there is also a how-to write a pass in MELT.


(Log in to post comments)

MELT

Posted Jan 23, 2010 17:44 UTC (Sat) by nix (subscriber, #2304) [Link]

MELT is an absolutely awesome tool. If only its memory consumption was
lower... but then Moore's Law (still very much in effect for RAM) will
render that unimportant soon enough.

MELT

Posted Feb 6, 2010 21:19 UTC (Sat) by bstarynk (guest, #63409) [Link]

I am the author of MELT (a GCC plugin infrastructure which provides a
higher-level lisp-like language to code GCC extensions in). See
http://gcc.gnu.org/wiki/MiddleEndLispTranslator and download the MELT
branch.

MELT does indeed need resources. The big bottleneck is not directly MELT
[the translation from MELT to C is quite quick - the entire MELT translator
is 35KLOC of MELT code which translates to nearly 600KLOC of generated C
code; the translation process of MELT is 20 seconds and uses a reasonable
amount of RAM, less than 300Mb), it is the compilation time of the C code
generated by MELT (and since MELT is written in MELT, you need to compile
the generated C code of the MELT translator; that may take more than an
hour if you compile that code with -O2).

MELT data (in particular closures and objects) is initialized by
straighforward but large C code, there is no serialization or reading of
data files for that. So the initialization routine of each MELT module is a
huge sequential C routine (typically 50KLOC) which essentially fills a big
struct-ure (of thousands of fields). And the compilation of that particular
big routine is stressing the GCC compiler (in particular when optimized
with -O2).

However, I made very recently some significant progress on that issue. The
biggest generated C code file was about 6Mbytes a few weeks ago, but is now
only 3Mbytes, notably because I did split its original MELT version in two
files. So if you tried MELT a month ago, you could try again!

I am also working on an alternative, non-lispy, syntax to MELT. I hope that
an infix syntax might attract more people to MELT.

Feel free to ask me more questions about MELT, perhaps on the
gcc@gcc.gnu.org mailing list (with MELT in the subject line) or directly by
email to me.

Regards.

PS. I will probably release MELT [as a gcc 4.5 plugin] as soon as gcc 4.5
is released. But you can get MELT using subversion with
svn co svn://gcc.gnu.org/svn/gcc/branches/melt-branch GCC-MELT
as a GCC branch, or you could get a 4.5 snapshot and a few files from the
MELT branch & compile it as a gcc-4.5 plugin

--
Basile Starynkevitch (the GCC MELT guy).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds