This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Ann.: MELT 1.0 [rc2] plugin (release candidate 2) for GCC 4.7 or better
- From: Basile Starynkevitch <basile at starynkevitch dot net>
- To: gcc-melt at googlegroups dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 23 Oct 2013 15:26:53 +0200
- Subject: Ann.: MELT 1.0 [rc2] plugin (release candidate 2) for GCC 4.7 or better
- Authentication-results: sourceware.org; auth=none
Dear All,
It is my pleasure to announce the MELT 1.0 release candidate 2
plugin for GCC 4.7 or newer.
MELT is a high-level domain specific language (with a Lispy look)
- see http://gcc-melt.org/ for more - designed to extend the GCC compiler.
MELT 1.0 is a major release (today a release candidate 2).
You can download the release candidate 2 from
http://gcc-melt.org/melt-1.0-rc2-plugin-for-gcc-4.7-or-4.8.tar.bz2
it is a bzip2-ed source tarball of 3866954 bytes (3.7Mbytes) of md5sum e013c220b73062b23efc3904bace64a4; it is extracted from MELT branch
svn 203972 on october 22nd 2013.
MELT 1.0 rc2 brings a lot of improvements and enhancements w.r.t. to previous
MELT releases. From its README-MELT-PLUGIN file:
################################################################
NEWS for 1.0 MELT plugin for GCC 4.7 & 4.8 [and future 4.9?]
[[end of october, 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).
Some examples of findgimple modes:
+ Find all calls to malloc with a constant size greater than 100:
gcc -fplugin=melt -fplugin-arg-melt-mode=findgimple \
-fplugin-arg-melt-arg='
?(gimple_call_1 ?_
?(tree_function_decl_of_name "malloc" ?_ ?_)
?(tree_integer_cst ?(some_integer_greater_than 100))
)' -O2 -c yourcode.c
The above command is generating some C++ code and slowly compiling
it then dlopen-ing it, every time you run that command. To make it
faster, you may want to generate a MELT module findmallocgt100 once,
and use that module to search mallocs on many files:
gcc -fplugin=melt -fplugin-arg-melt-mode=findgimple \
-fplugin-arg-melt-arg='
?(gimple_call_1 ?_
?(tree_function_decl_of_name "malloc" ?_ ?_)
?(tree_integer_cst ?(some_integer_greater_than 100))
)' -fplugin-arg-melt-output=findmallocgt100 -c empty-file.c
You'll get a bunch of files with name starting with findmallocgt100.
Then you can quickly search that pattern using
gcc -fplugin=melt -fplugin-arg-melt-extra=findmallocgt100 \
-fplugin-arg-melt-mode=gofindgimple -O2 yourfile.cc
and this should run much faster, because no C++ code needs to be
generated and compiled.
***
* 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.
##########
Please download it, test it, and report any bugs or successes
on gcc-melt@googlegroups.com
I hope to release the MELT 1.0 plugin definitive release in a few days.
It hopefully should be very close to this 1.0 rc2.
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 mines, sont seulement les miennes} ***