This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hello,
Today is the first anniversary of GNU Guile 2.0 [0]. To celebrate it,
several Guile users took on the challenge to come up in one week with a
neat hack to showcase Guile integration [1].
So Iâm happy to announce that this silly challenge gave birth (among
other things) to Guile-GCC, Guile bindings that allow GCC plug-ins to be
written in Guile:
http://www.fdn.fr/~lcourtes/software/guile/guile-gcc-0.0.tar.gz
http://www.fdn.fr/~lcourtes/software/guile/guile-gcc-0.0.tar.gz.asc
SHA1 sums:
2d46faf75b5ceb62c326f320495aa594479468bf guile-gcc-0.0.tar.gz
7f0817e1b8b4a35f0a99602a8d9c1b080fea1851 guile-gcc-0.0.tar.gz.asc
Repository:
https://gitorious.org/guile-gcc/guile-gcc
The plug-in currently wraps a small subset of the libcpp, tree, and
cgraph APIs, which was enough to create these plug-ins available in the
distribution:
â The âbirthdayâ plug-in defines a âbirthdayâ pragma that emits a
âputsâ call.
â âmetaâ shows an unprecedented way of doing meta-programming from C.
It defines two pragmas: one to define a âmeta-functionâ, and one to
invoke said function at a particular point in the code, with
specific tree objects as its arguments.
The âexamples/meta.câ file defines a meta-function that generates
code to print the value of each field of the structure passed as its
argument.
â âcall-graphâ unimaginatively traverses the call graph of the
compilation unit and emits a âdotâ representation of that graph.
The (gcc) module comes with an embedded domain-specific language (EDSL)
that makes it easy to write code-generating code. For instance:
(tree loc
(printf "value is %d (%p)\n" (foo dot "bar") (& foo)))
â expands to (simplified):
(build-call-expr
loc
printf
(list (build-string-literal "value is %d (%p)\n")
(build-component-ref loc foo "bar")
(build-addr foo)))
The bindings currently lack GIMPLE and basic-blocks. Everyone is
invited to join in and help with this. :-)
Besides, fun work would include augmenting the tree EDSL so it can build
BIND_EXPRs, VAR_DECLs, COND_EXPRs, etc., and extending Guileâs
(ice-9 match) pattern matcher to support tree and GIMPLE objects, which
would probably be handy.
Feedback welcome!
Thanks,
Ludoâ.
[0] http://lists.gnu.org/archive/html/guile-devel/2011-02/msg00173.html
[1] http://lists.gnu.org/archive/html/guile-user/2012-02/msg00019.html
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |