Obsolete page

(this page is old and obsolete, present for historical reasons only. Please refer to gcc-melt.org instead)

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)

.

A two-page GCC MELT sheet (leaflet, PDF, may 2012)

Slides of a tool presentation at Tapas2012 workshop on GCC MELT (a high-level domain specific language to extend the GCC compiler) (PDF, september 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, or on FreeCode's GCC-MELT project.

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.7 release (for GCC 4.6, 4.7 and future 4.8) is available from melt-0.9.7-plugin-for-gcc-4.6-or-4.7-or-4.8.tar.gz a gnu-zipped source tar file of 5193713 bytes of md5sum 9873b7cb1363c3638457fe775a402aa9 extracted from the MELT branch of GCC svn rev. 192291 on october 10th 2012. This brings a read-eval-print loop and an evaluator to MELT and many new things. See this message for more. (the version number 0.9.7 of the MELT plugin is not related to the version 4.6, 4.7 of the GCC compiler able to use it)

The MELT plugin 0.9.6-d release is available from melt-0.9.6-d-plugin-for-gcc-4.6-or-4.7.tar.gz, a gnu zipped source tar file of 5580021 bytes & md5sum 83ac70197a57968ed732d0f5442a3c2b extracted from the MELT branch of GCC svn revision 190124 on August 03rd 2012.
(several tentative 0.9.6 releases were buggy; see this discussion for more).
This release brings a lot of new features, notably a probe which shows the internal representations of GCC, see this message. See also latest message on gcc-melt@googlegroups.com list. Here is a reduced screenshot (august 3, 2012) of the probe when compiling the gcc/tree-ssanames.c file of GCC (click on the picture to get the full view)
reduced image of probe
We used make CC='gcc -fplugin=melt -fplugin-arg-melt-mode=probe' tree-ssanames.o to get that after installation of MELT 0.9.6-d for GCC 4.7(be sure that ccache don't get used). On the left, there are information windows about some specific source code location. On the right the main window show tabs with various source files. Underneath, the trace window of the textual protocol exchanged between the probe and the MELT plugin of GCC.

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.

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:

Debian or Ubuntu packages.

Thanks to Alexandre Lissy, .deb packages of the GCC MELT plugin are available on launchpad.net/~lissyx/+archive/gcc-plugin-melt

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.


Contact

Please contact Basile Starynkevitch basile dot starynkevitch at cea dot fr for projects, developments (thru contracts with CEA LIST) about GCC MELT

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.