[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about header file parsing
On 8 January 2019 18:21, David Malcolm <dmalcolm@redhat.com> wrote:
On Tue, 2019-01-08 at 10:50 +0000, akrl@sdf.org wrote:
> Hi all,
> I have a basic question.
> Is there a way to ask libgccjit to parse a conventional .h file?
Sadly, no.
> Or alternatively is there a way to have an header file parsed and
> converted in the equivalent libgccjit api calls?
Having a standard way to do this would be useful.
> I ask this because I noticed that, if you jit some code that have to
> inter-operate with non jitted code, maintaining two duplicated
> definitions
> of all data structures can be quite painful if these are not trivial.
I agree that this is a nuisance.
> Alternatively what's the suggested work flow?
One idea I came up with was to use libabigail:
https://sourceware.org/libabigail/
to generate an ABI description e.g. via abidw:
https://sourceware.org/libabigail/manual/abidw.html
which emits an XML file, and then have a pre-canned way of populating a
gcc_jit_context from such an abigail ABI representation.
This code doesn't exist yet, though (but would just need writing once).
Dave
> Best Regards
> Andrea
>
I think the idea of having something like a gcc plugin that once is parsed
compiles the subset of supported C to the necessary libgccjit code would be
useful to have for this cases but also educative for learning how to use the
library.
Would be this something that is upstreamable in some form?
Bests
Andrea