GCC MELT

About GCC MELT

GCC MELT is a GCC (Gnu Compiler Collection, a free compiler for many languages -C, C++, Ada, Fortran, ...- and systems) plugin and branch, providing a lispy domain specific language to easily code GCC extensions in. MELT originally meant Middle End Lisp Translator

GCC MELT should interest any important software project (coded in C, C++, Ada, Fortran, ...), compiled with GCC, since it facilitates the development of customized GCC extensions for:

GCC MELT description

A leaflet with a short description of GCC MELT (goals and overall features) is available as a web page or as a PDF (2 sided, one A4 color sheet) document.

There is a wiki page about GCC MELT on the GCC wiki.

Slides of GCC Summit 2010 tutorial on MELT are here (PDF, 87 slides, 1.9Mb)

Slides of a tutorial on GCC plugins and MELT extensions given in june 16th, 2011 at Archi11 summer school (St Louis, by Université of Perpignan, France) are available here (130 slides, PDF format, 2.1Mbytes).

Slides presented at the Gnu Hacker Meeting 2011 (August 25th, 2011) on GCC, MELT and Talpo (Basile Starynkevitch and Pierre Vittet).

Paper accepted at DSL2011 IFIP Working Conference on Domain-Specific Languages (Bordeaux, september 2011) on MELT - a Translated Domain Specific Language Embedded in the GCC Compiler (PDF, 25 pages). slides of the talk.

Slides of a talk given at INRIA, LIG, MOUAIS near Grenoble about MELT on december 9th 2011

Slides of a tutorial (PDF, 135+ slides, extending Archi2011) on Gcc internals and Melt extensions given at HiPEAC 2012 conference (Paris, january 24th 2012), with improvements for a talk at LIP6 (Paris 6 Univ., may 10th 2012)

Draft of a paper submitted to OpenGPU workshop Using MELT to improve or explore your GCC-compiled source code (PDF, 17 pages, april 2012)

.

Disccussion group

An English-speaking technical group (no flamewars, no spam) about GCC MELT is available on

Google Groups
Subscribe to gcc-melt
Email:
Visit this group

Source code

GCC MELT is a GCC plugin and also an experimental GCC branch, a free software GPLv3 licensed and FSF copyrighted. It should also be compilable as a GCC-4.6 (or 4.7, when available) plugin, and most users want the MELT [meta-]plugin. You could get the latest code snapshot of the experimental MELT branch using subversion:
svn co svn://gcc.gnu.org/svn/gcc/branches/melt-branch gcc-melt
To get the source tarball for a MELT plugin, run contrib/make-melt-source-tar.sh $PWD /tmp/meltpluginsource from inside the MELT branch source code.

The MELT plugin has regular source code releases. See below.

Tiny examples of MELT

A bag of small MELT examples is available on melt-examples at GitHub

Prerequisites for building the MELT plugin for GCC 4.6 & 4.7

You need, before building MELT plugin (with Debian/Ubuntu/... package installation commands, assuming a recent Linux distribution; run apt-get as root i.e. thru sudo; replace 4.6 with 4.7 if relevant for you):

  1. The GCC 4.6 (or 4.7, when available) compiler (and GNU make which may be run internally by MELT)
    apt-get install gcc-4.6 g++-4.6 make
    Check with gcc-4.6 -v that it has been configured and built with --enable-plugin
  2. The required dependencies for building that compiler (since MELT generate C code):
    apt-get build-dep gcc-4.6 g++-4.6
    This may pull many packages (in particular autogen, gawk and others), if your system don't have them yet.
  3. In particular, the Parma Polyhedra Library is explicitly needed (version 0.11.2 or 0.12) (PPL is explicitly used by MELT), with its C interface (If you build PPL from source code, don't forget --enable-interfaces=C at its configure time); most installed GCC compilers need it anyway:
    apt-get install libppl-dev libppl-c-dev
  4. The files for GCC plugin development are needed, even to run MELT (since MELT may generate C code on the fly and compile it). This includes GCC plugin header files and others (notably gtype.state useful for gengtype internal GCC utility).
    apt-get install gcc-4.6-plugin-dev
  5. Since MELT generates its documentation in Texinfo format, you need the texi2html utility to translate it to HTML.
    apt-get install texinfo texi2html

Download and build MELT plugin release for gcc 4.6 & 4.7

The MELT plugin 0.9.5 is available from melt-0.9.5-plugin-for-gcc-4.6-or-4.7.tar.gz as a gzipped tar archive of 4502575 bytes and md5sum b5a0ea2a022b4283120c50dbd6eff93d. You could try building it e.g. with make CC=gcc-4.7 CXX=g++-4.7 or perhaps with make MELTGCC=gcc-4.7 GCCMELT_CC=g++-4.7. Please report bugs on gcc-melt list. It is extracted from MELT branch svn revision 186383., april 12th 2012.

The MELT plugin 0.9.4.b for GCC 4.6 and 4.7 is available as a gzipped source tar archive from melt-0.9.4.b-plugin-for-gcc-4.6-or-4.7.tgz of size 4357645 bytes and md5sum a1790ae171f253366254b7b417dd14a4 (march 4th 2012). It is extracted from MELT branch svn revision 184886.
The version number 0.9.4 of the MELT plugin is unrelated to the version of the GCC compiler (4.6 or 4.7) for which it is supposed to work. (It need the GCC 4.7 compiler to be built in C mode, not with a C++ compiler).
Bug reports and patches are welcome (to the gcc-melt list).
(a buggy 0.9.4 was released by mistake on march 2nd 2012, don't use it [documentation was not generatable]. Use the above 0.9.4.b instead.)

Short building instructions of the MELT plugin:

A powerful, recent, Linux system is required to build and to use MELT (see above for prerequisites). You probably need less than 100Mb of disk space to build the MELT plugin (if you dare building the experimental MELT branch, you'll need 2 or 4 gigabytes of disk space). But a 4Gb RAM machine is recommended. (MELT generates a lot of C code, and compiling that generated C code requires significant memory and CPU resources).

Unarchive the tarball and cd into the MELT plugin source directory. First, read the README-MELT-PLUGIN file inside. Then:

Incomplete MELT documentation.

The MELT plugin has some incomplete documentation (but reading before slides or papers about MELT description is strongly advised):

Software written with MELT

Pierre Vittet has developped Talpo (available on Gitorious) using MELT. Talpo is a MELT extension giving some warnings about your code (e.g. find misuse of untested fopen-s). This is a GSOC 2011 project on Customizable warnings with a GCC plugin

Please tell me about other projects using MELT.

Site in construction.


Legal notice

This site is © 2011 - 2012 Basile Starynkevitch. Postal adress: 8, rue de la Faiencerie, 92340 Bourg La Reine, France.

GCC MELT is mostly the work of Basile Starynkevitch (employed at CEA, LIST), with contributions by Alexandre Lissy, Jérémie Salvucci and Pierre Vittet.
Basile Starynkevitch's work is funded by French DGCIS thru GlobalGCC (ITEA) and OpenGPU (FUI) projects.

Opinions are those of the author, not of his employer (or funding agencies) or of the GCC community.