Ann: MELT 1.0 plugin for GCC 4.7 & 4.8

basile@starynkevitch.net
Wed, 30 Oct 2013 11:29:38 -0700 (PDT)

          From comp.compilers

Related articles
Ann: MELT 1.0 plugin for GCC 4.7 & 4.8 basile@starynkevitch.net (2013-10-30)
| List of all articles for this month |
From: basile@starynkevitch.net
Newsgroups: comp.compilers
Date: Wed, 30 Oct 2013 11:29:38 -0700 (PDT)
Organization: Compilers Central
Keywords: tools, available
Posted-Date: 30 Oct 2013 14:59:27 EDT

Original announcement: http://gcc.gnu.org/ml/gcc/2013-10/msg00269.html
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} ***


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.