From: Andrea Corallo <acorallo@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Helmut Eller <eller.helmut@gmail.com>,
gerd.moellmann@gmail.com, emacs-devel@gnu.org
Subject: Re: Question about code generation
Date: Fri, 10 May 2024 13:00:51 -0400 [thread overview]
Message-ID: <yp1v83lvby4.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <86h6f54rzw.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 May 2024 18:16:19 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Helmut Eller <eller.helmut@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
>> Date: Fri, 10 May 2024 14:57:17 +0200
>>
>> On Fri, May 10 2024, Gerd Möllmann wrote:
>>
>> >> But I guess I'm misunderstanding what you are asking about.
>> >
>> > I was thinking of (making my life easier and) generating the fix_
>> > functions in igc.c, as an example, from knowledge that a C parser has
>> > which members are in a given struct, what's their type, Lisp_Object,
>> > pointer to something interesting, ...
>> >
>> > Together with meta infos passed to a code generator this could be used
>> > for all sorts of things, I guess.
>>
>> Would be nice to write things like:
>>
>> struct foo {
>> void* bar [[emacs::igc_fix_obj]];
>> }
>>
>> and then run a gcc or clang plugin over it and generate the needed code.
>>
>> Can libgccjit be used to parse C code and could we write the plugin in
>> Emacs Lisp? That would be fun.
>
> AFAIU, libgccjit needs GIMPL, and you drive it by calling the
> respective functions from libgccjit. But Andrea will tell for sure.
I think in this case libgccjit goes the other way of what would be need
here. Libgccjit allowed us to develop an Elisp front-end while here the
frontend we need is already the C one that comes with GCC.
What we want is a GCC plugin, essentially a custom pass that analyses
say lisp.h and output something (in this case some C code).
Not many people know that should be even possible to write it in python
thanks to David Malcolm work
<https://gcc-python-plugin.readthedocs.io/en/latest/>, certanly not
Elisp :/ but probably quicker than doing it in C.
Thanks
Andrea
next prev parent reply other threads:[~2024-05-10 17:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 9:33 Question about code generation Gerd Möllmann
2024-05-10 10:35 ` Eli Zaretskii
2024-05-10 11:38 ` Gerd Möllmann
2024-05-10 12:57 ` Helmut Eller
2024-05-10 12:59 ` Gerd Möllmann
2024-05-10 15:16 ` Eli Zaretskii
2024-05-10 17:00 ` Andrea Corallo [this message]
2024-05-10 17:21 ` tomas
2024-05-10 17:35 ` Andrea Corallo
2024-05-10 17:38 ` Andrea Corallo
2024-05-10 17:38 ` tomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yp1v83lvby4.fsf@fencepost.gnu.org \
--to=acorallo@gnu.org \
--cc=eliz@gnu.org \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=gerd.moellmann@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.