Ann: MELT 1.0 plugin for GCC 4.7 & 4.8

21 views
Skip to first unread message

Basile Starynkevitch

unread,
Oct 29, 2013, 4:29:05 AM10/29/13
to g...@gcc.gnu.org, gcc-...@googlegroups.com
Dear All,

It is my pleasure and honour to announce the MELT 1.0 plugin for GCC 4.7
& 4.8, a GPLv3+ licensed free software and FSF copyrighted plugin for
the GCC compiler http://gcc.gnu.org/

MELT is a Lispy like domain specific language to extend GCC. See
http://gcc-melt.org/ ; you'll be able to extend or customize the GCC
compiler in MELT easier than you would code C++ plugin, thanks to the
high-level features of MELT: pattern matching, functional, reflexive,
object-oriented programming styles with meta-programming facilities.
MELT is translated to C++ code (by a translator itself coded in MELT).
You can mix C++ code inside MELT.

MELT can also be used to explore the GCC (mostly middle-end) internal
representations notably Gimple-s and Tree-s. With MELT you can for
example, with a few arguments to gcc, find all calls to malloc with a
constant size greater than 100 (and you need to do that *inside* the
compiler, because that size could be constant folded and using sizeof
etc....).

Please download the MELT 1.0 plugin source bzipped tarball from
http://gcc-melt.org/melt-1.0-plugin-for-gcc-4.7-or-4.8.tar.bz2
a file of md5sum fe07c9204e31c3a61931181737903d7e; it is extracted from
MELT branch svn 204149 on october 29th 2013.

MELT 1.0 is a major release bringing many improvements over previous
releases of MELT. Detailed news follow:

################################################################
NEWS for 1.0 MELT plugin for GCC 4.7 & 4.8 [and future 4.9?]
[[october 29th, 2013]]

This is a major release (with perhaps some small incompatibilities
with previous MELT plugin releases). A lot of new features are
appearing. Much more ability to mix arbitrary C/C++ & MELT code in any
way, and lots of new features both inside the MELT language and the
MELT plugin, even for newbies. Some modes are now available and could
be useful even without understanding much of the MELT domain specific
language.

MELT 1.0 is usable with GCC 4.7 and 4.8 but not usable with GCC 4.6 or
earlier, because it requires a GCC compiler written in C++ and because
it is generating C++ code.

End-user improvements
=====================

****
* Several MELT modes are usable without real knowledge of the MELT
domain specific language, notably -fplugin-arg-melt-mode=findgimple
(to find all gimples matching some given gimple pattern in all
functions whose declaration matches a given tree pattern) and
-fplugin-arg-melt-mode=justcountipa (to count gimples and basic
blocks at the Inter-Procedural Analysis stage).

Several examples of MELT modes are given in
http://gcc-melt.org/tutousemelt.html

It is notably possible to

+ find all calls to malloc with a constant size greater than 100
that size could have been given thru sizeof and/or some
constant expressions...

+ find all calls to printf with a format string containing the
word current and more than 6 arguments inside functions whose
name start with foo

+ etc....


These exploring modes have to work inside the compiler. A textual
approach won't work. So these exploring modes should interest a
large number of GCC users.

***
* When verbose, all the successful modes are displayed.

Language improvements
=====================

***
* It is possible to define macros with defmacro (taking four
arguments: the s-expression to be macro-expanded, the environment,
the macro-expander function, the module context). Such macros can be
used in the same MELT module defining them, but should expand to a
source AST which you would be able to read...

***
* It is possible to define locally bound macros with the :macro
annotation
in let bindings.

***
* at_macro_expansion macro can be used to define functions (and
instances, etc...) used only at macro-expansion time of further
defmacro-defined macros.

***
* Macros defined by defmacro and definition given inside
at_macro_expansion
are evaluated in a separate environment so don't see the ordinary
bindings
currently defined in the MELT source.

***
* The comma operator, only usefine inside anti-quotations (thru
backquote) is expanded to a sequence of sub-expressions if the
anti-quotation gives a sequence, i.e. a tuple or a list. So no
comma-at operator is needed.

***
* quotes, anti-quotes (with backquote), and comma operators are
possible even on arbitrary s-expressions. But quotations and
antiquotations of s-exprs have their location slightly less precise
(only file name and line number, but not column number, are
preserved)

Runtime improvements
====================

***
* The debug macro accepts debug manipulator which alters the way
the next argument is debug-printed, e.g.
(DEBUG "here smaller debug of x=" DEBUG_LESS x)

***
* The variadic ERROR_AT WARNING_AT and INFORM_AT functions are
available
for diagnostics. They take a format string with occurrences of $1 ...
$9
expanded into variadic arguments. For example
(ERRROR_AT somelocation "this is an error with number $1 and tree
$2"
somenumber sometree)
The location can be null, or be given by some boxed gimple or boxed
tree.

***
* The ASSERT_MSG macro can have more arguments, which are shown
when the assertion fails.

***
* MELT registered passes have a unique number (for GCC 4.9).

***
* The runtime is named melt-runtime.cc since it is C++ code.

***
* MELT generated frames are classy because they are C++ classes.

As usual, many bug fixes... A ticket system is now available on
https://sourceforge.net/p/gcc-melt/tickets/ for bug reports.

################


Respectful regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


Sanel Zukan

unread,
Oct 29, 2013, 6:19:19 AM10/29/13
to gcc-...@googlegroups.com
Awesome news Basile!

I submitted it on Slashdot and Reddit so keep fingers crossed they
get on front page :)

Just to let you know, I'm actively following your changes and work,
but last couple of months I was busy with some side work. I'm eager to
try it as soon as I find some spare time.

Best,
Sanel

Basile Starynkevitch

unread,
Nov 7, 2013, 11:17:34 AM11/7/13
to g...@gcc.gnu.org, gcc-...@googlegroups.com
Dear All,

I am delighted to announce MELT 1.0.1 plugin for GCC 4.7 & 4.8 ( a
bug-fixing release w.r.t MELT 1.0)

Please download it from
http://gcc-melt.org/melt-1.0.1-plugin-for-gcc-4.7-or-4.8.tar.bz2

It is a bzip2-ed tar source file of md5sum
c7c3dbf3edd4e5747ddcf4a30dad41c4 and of 3754405 bytes (3.6 Megabytes)
extracted from MELT branch svn revision 204522.

MELT is a Lispy like domain specific language to extend GCC implemented
as a GPLv3 plugin for GCC. See http://gcc-melt.org/ for more.

This 1.0.1 release provide just a bug fix with respect to MELT 1.0
announced on october 29th 2013 on
http://gcc.gnu.org/ml/gcc/2013-10/msg00269.html

A probable bug in GCC 4.7 gengtype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59028
which does not appear when compiling MELT 1.0 for GCC 4.8
mixed with a corrected bug from MELT 1.0 plugin
http://sourceforge.net/p/gcc-melt/tickets/6/
made necessary this bug-fixing MELT 1.0.1 release which does not bring
any new features w.r.t to MELT 1.0 but just circumvent the gengtype from
GCC 4.7 deficiency.

So you need to upgrade MELT if you have GCC 4.7 (since MELT 1.0 was not
easily installable with GCC 4.7), and you probably want to upgrade MELT
if you have GCC 4.8; you also need to install unifdef from
http://dotat.at/prog/unifdef/ or from your distribution.

################################################################
NEWS for 1.0.1 MELT plugin for GCC 4.7 & 4.8 [and future 4.9?]
[[november 7th, 2013]]

This is just a bug-fix release for MELT-SFT-6 (see
https://sourceforge.net/p/gcc-melt/tickets/6/ for more); it adds a
workaround for GCC 4.7 gengtype inability to process operator
conversion. The unifdef utility is now required to build the MELT
plugin.

################################################################

Regards.

Basile Starynkevitch

unread,
Dec 18, 2013, 2:11:02 AM12/18/13
to g...@gcc.gnu.org, gcc-...@googlegroups.com
Dear All,

MELT is a plugin and a domain specific language to extend and customize
your GCC compiler, see http://gcc-melt.org/ for more.

I am delighted to announce the MELT 1.0.2 plugin for GCC 4.7 and 4.8, a
bug-fixing release w.r.t. MELT 1.0.1

Please download it from
http://gcc-melt.org/melt-1.0.2-plugin-for-gcc-4.7-or-4.8.tar.bz2

It is a bzip2-ed tar source file of md5sum
07926d9d3ee18f7d0db523725fa7d709, and of 3756363 bytes (3.6Megabytes);
this bug-fixing release is obtained from MELT 1.0.1 (which was extracted
from MELT branch svn revision 204522) corrected with the
http://gcc-melt.org/patch-melt-plugin-1.0.1-to-1.0.2.diff
which you could also directly apply to your MELT 1.0.1 plugin source
tree.

With respect to MELT 1.0.1 this bug-fixing release corrects
https://sourceforge.net/p/gcc-melt/tickets/7/ (an annoying bug related
to -fplugin-arg-melt-mode=findgimple). Thanks to my students at Univ.
Pierre et Marie Curie, Paris, France (notably Boris de Finance and
others) for reporting the bug.

Please report bugs and ask questions on the gcc-melt googlegroup:
https://groups.google.com/forum/#!topic/gcc-melt
i.e. gcc-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages