GCC MELT
starynkevitch.net/Basile/gcc-melt
These [old] web pages are mostly available on starynkevitch.net/Basile/gcc-melt/ which is the prefered URL.

About GCC MELT

GCC MELT is an inactive project in end of 2017. If you want to pay support on it, contact me on basile.starynkevitch@cea.fr or on basile-freelance@starynkevitch.net.
The gcc-melt.org domain has been lost in April 2018.... My bismon github project might later become a successor to GCC MELT

Executive Summary: (printable)
Customizing your GCC compiler with MELT extensions (2 pages / one sheet, PDF, in english).
Votre compilateur GCC sur mesure avec MELT (1 page, PDF, in french - en français)

(Dec.2017) partner search for ICT16

(Mar.2017) Interest in EIT Digital

(Feb.2017) Interest in IoT-03

NEW! (may 11th, 2016) MELT 1.3.0 plugin release candidate 2 for GCC 5 and GCC 6 downloadable, please ugrade.

january, 31st, 2015: talk at FOSDEM2015 (Lisp devroom): slides Customizing GCC with MELT (a Lispy dialect) (PDF)

(july 24th, 2015) MELT 1.2.0 plugin release for GCC 4.9 and 5.* downloadable, please ugrade.

Overview

GCC MELT is a high-level domain specific language for extending or customizing the Gnu Compiler Collection (i.e. gcc, g++, gfortran, gnat, gccgo, gobjc, ...). It is implemented as a GCC plugin (for GNU/Linux systems, with GCC 4.7, 4.8 or later) in a free software (under GPLv3+ license and FSF copyright).
GCC MELT targets advanced GCC users developing, compiling, improving, evaluating, maintaining, or designing important software (coded in C, C++, Fortran, Ada, Go, Objective C or any language supported by a recent straight- or cross- GCC compiler). For such power users, spending a few days or weeks to customize or extend their compiler for their specific needs is worthwhile, and GCC MELT should lower the required effort, because coding in MELT a GCC extension is much easier than manually developping a GCC plugin in C or C++ (these are efficient languages, but not well fit to easily work on compiler's internal representations).

GCC MELT (since MELT 1.0) can also be used to explore the internal representations of the GCC compiler when it is working on your files, see here. For example, you could find all calls to malloc with a constant size greater than 48 bytes, or all assignments to some next fields of struct-ure whose name contains point (and such searches are not possible with textual tools like grep; they have to be made at the Gimple level inside the compiler).

GCC MELT (that is, your daily GCC [cross-] compiler augmented with the MELT [meta-] plugin and your own extensions) could be the foundational block of some Industry Specific Software Development Kit for e.g. embedded, GUI, or low-level software. Please contact us for more information.

GCC MELT uses existing GCC plugin hooks to work on GCC internal middle-end representations, notably GCC Generic Trees and GCC Gimples, and the control flow graph. These powerful internal representations are common to all source languages accepted by GCC, so your extension coded in MELT will be able to handle any source code compiled by GCC.

Probably, GCC MELT won't be very useful to casual GCC users working on tiny programming projects, unless they simply use some existing GCC extensions already developed with GCC MELT.

Why customize or extend GCC?

The GCC compiler can be customized or extended (with plugins or MELT extensions) for:

From the GCC user's point of view, a customization of GCC is easier to use than external tools. He/She needs only to add extra compilation flags (.e.g. CFLAGS += -fplugin=melt -fplugin-arg-melt-extra=extension -fplugin-arg-melt-mode=mode in a Makefile), but don't need to change workflow habits.

How MELT helps to extend GCC?

MELT is a domain-specific language specifically designed to ease the extension (or customization) of GCC because of the following features:

The above powerful features of MELT lower the cost of customizing GCC, hence enabling you to leverage on GCC powerful abilities with GCC MELT. However, even using MELT you need to understand some of GCC internals.

The emitted C or C++ code is carefully generated to fit into what your GCC plugin interface expects (GCC switched from C to C++ in its 4.7 version, and GCC MELT is careful to generate a code acceptable by your version of GCC).

A practical way to understand more on main GCC internal representations is to have a relevant (small) source code (e.g. in C, C++, Fortran, or Ada, etc), then compile it with the -fdump-tree-all.

For instance (assuming you have some example.cc in some playground directory) compile with g++ -fdump-tree-all -O -c example.cc. This produce hundreds of dump files, such as perhaps example.cc.073t.phiopt1 which might contain (like dump files suffixed .phiopt*) a dump of Gimple/SSA (Static Single Assignment) statements, that you can browse using an editor or pager (e.g. less example.cc.073t.phiopt1 or gedit example.cc.073t.phiopt1).


Download and install GCC MELT

GCC MELT is downloadable here (under GPLv3 license, for GNU/Linux systems with a recent GCC), where you can get installation instructions, and also examples of code written in MELT.

Please download and install GCC MELT before reading other material.

Documentation

GCC MELT has some documentation here , where you can get tutorial, and also reference about MELT, with publications and slides of talks given on it.

Contribute to GCC MELT (and related tools)

GCC MELT is an improvement to GCC itself, so follows the same contribution policies as the GCC compiler. In particular, it demands the same legal prerequisites (which take a lot of time). We cannot accept even small patches without your contribution belonging legally to the FSF (as GCC MELT does).

Thanks to (in alphabetical order) Romain Geissler, Emmanuel Haucourt, Alexandre Lissy, Jérémie Salvucci, Pierre Vittet for their contributions to GCC MELT.

French flag   MELT is mostly made in France, because its main contributors happen to be French. Of course we welcome any contributor (from any country).

Contact information

My (=Basile Starynkevitch) work at CEA, LIST on GCC MELT has been partially funded by DGCIS French public agency thru various projects.

Please contact me by email at Basile dot Starynkevitch at cea dot fr for industrial contracts (thru CEA, LIST) or collaborative research projects related to GCC MELT

Reporting bugs and wishes

Please reports bugs and wishes on the gcc-melt@googlegroups.com and also on SourceForge GCC MELT tickets system.

In ChangeLog.MELT entries and in messages, we will refer to these tickets as MELT-SFT (for MELT -Source Forge Ticket).

Participating to projects

I am interested in participating to any projects where extending GCC thru MELT is worthwhile.

Related tools

(non-exhaustive list of references to related tools)

See also archive of the old inactive GCC MELT google-group.


The old page on GCC MELT is available here.