public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Nieper-Wißkirchen" <marc.nieper@gmail.com>
To: Basile Starynkevitch <basile@starynkevitch.net>,
	akrl@sdf.org, jit@gcc.gnu.org
Subject: Re: about header file parsing
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <adcf1927-5330-39b8-3f63-f2be0dad77df@gmail.com> (raw)
In-Reply-To: <df14e86c-824f-0564-d70a-d6055a904c19@starynkevitch.net>

Am 08.01.19 um 22:15 schrieb Basile Starynkevitch:
> 
> On 1/8/19 11:50 AM, akrl@sdf.org wrote:
>> Hi all,
>> I have a basic question.
>> Is there a way to ask libgccjit to parse a conventional .h file?
> 
> I have asked a very similar question in 
> https://gcc.gnu.org/ml/jit/2015-q2/msg00093.html
> 
>> Or alternatively is there a way to have an header file parsed and
>> converted in the equivalent libgccjit api calls?
>> 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.
>> Alternatively what's the suggested work flow?
> 
> I am not sure there is one yet, in practice.
> 
> A possible work-around (not entirely trivial) might be to do the 
> "opposite": use GCC itself to parse the header file, and write your GCC 
> plugin extracting all the relevant information for your particular usage 
> of libgccjit. I have no idea how easy that can be for you.
> 
> I am not even sure if all the features of C (including some common 
> extensions accepted by GCC) are usable from libgccjit. Perhaps bit 
> fields and computed gotos like `goto *ptr` and statement expressions 
> like `({int x=0; while (y>0) x+=f(y--); x;})` are not easily achievable 
> in libgccjit.
> 
> 
> Still another thing could be to use LTO: you'll compile your C file with 
> GCC using -flto, you'll do LIBGCCJIT things, and the final executable 
> sould be compiled and linked with -flto.

What would you do with macros defined in the header file that form part 
of the API? They won't be visible after compiling (already after 
preprocessing).

-- Marc

> 
> Cheers.
> 

  reply	other threads:[~2019-01-08 21:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 akrl
2019-01-01  0:00 ` David Malcolm
2019-01-01  0:00   ` akrl
2019-01-01  0:00     ` Basile Starynkevitch
2019-01-01  0:00       ` akrl
2019-01-01  0:00         ` Basile Starynkevitch
2019-01-01  0:00           ` David Malcolm
2019-01-01  0:00             ` Marc Nieper-Wißkirchen
2019-01-01  0:00               ` akrl
2019-01-01  0:00                 ` Marc Nieper-Wißkirchen
2019-01-01  0:00               ` Basile Starynkevitch
2019-01-01  0:00       ` David Malcolm
2019-01-01  0:00     ` David Malcolm
2019-01-01  0:00       ` akrl
2019-01-01  0:00         ` David Malcolm
2019-01-01  0:00 ` Basile Starynkevitch
2019-01-01  0:00   ` Marc Nieper-Wißkirchen [this message]
2019-01-01  0:00   ` Marc Nieper-Wißkirchen
2019-01-01  0:00     ` Marc Nieper-Wißkirchen
2019-01-01  0:00       ` David Malcolm
2019-01-01  0:00         ` Marc Nieper-Wißkirchen
2019-01-01  0:00           ` akrl
2019-01-01  0:00             ` David Malcolm
2019-01-01  0:00               ` akrl
2019-01-01  0:00                 ` Marc Nieper-Wißkirchen
2019-01-01  0:00                   ` akrl
2019-01-01  0:00                     ` Marc Nieper-Wißkirchen
2019-01-01  0:00                       ` akrl
2019-01-01  0:00                         ` Marc Nieper-Wißkirchen
2019-01-01  0:00                           ` akrl
2019-01-01  0:00           ` David Malcolm
     [not found] <df8944b7-1fbe-b56f-cc48-ab926d0cb5ad@starynkevitch.net>
2019-01-01  0:00 ` Basile Starynkevitch
2019-01-01  0:00   ` Marc Nieper-Wißkirchen

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=adcf1927-5330-39b8-3f63-f2be0dad77df@gmail.com \
    --to=marc.nieper@gmail.com \
    --cc=akrl@sdf.org \
    --cc=basile@starynkevitch.net \
    --cc=jit@gcc.gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).