[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

about header file parsing



Hello all

Sorry, I have sent a private message to Marc which was meant to be on this jit@gcc.gnu.org list. Here is it for all



On 1/8/19 10:30 PM, Marc Nieper-Wißkirchen wrote:
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).

That is one of the problems. Notice that libgccjit don't know about macros, and there is no way to use a macro from libgccjit.
For example, libgccjit does not know that EOF is -1 on my system.

Another problem is inlined functions appearing in headers. They won't be inlined from LIBGCCJIT generated code, unless you use LTO.

LIBGCCJIT code can only call C-like functions - without inlining them (even when GCC would).

Perhaps you are only interested in using nice C headers that don't define any inlined functions and have only very few macro constants. For the macro constants (like EOF) you would handle them by hand (e.g. expanding the EOF of your Scheme dialect into -1 before using libgccjit).

BTW, CLASP (see https://github.com/clasp-developers/clasp ...) might be inspirational for you, but doing the equivalent in your case is a lot of work because what DrMeister did in CLASP is a lot of work; see also https://drmeister.wordpress.com/ and @Inproceedings{Schafmeister:2015:CLASP,
author = {Schafmeister, Christian E.},
booktitle = {Proceedings of the 8\textsuperscript{th} European
Lisp Symposium on European Lisp Symposium},
series = {ELS2015},
year = 2015,
title = {{CLASP} - A {Common Lisp} that Interoperates with
{C++} and Uses the {LLVM} Backend}
}


I don't understand if you want to handle a specific set of a few header files in your Scheme using libgccjit, or if you want a generic solution. If you only want to interace a specific library to your Scheme above LibGccJit, you could use the GCC plugin technique (then hand-tune the few problematic areas). If you want a generic solution, it probably won't be enough.

Cheers.

--
Basile STARYNKEVITCH   == http://starynkevitch.net/Basile
opinions are mine only - les opinions sont seulement miennes
Bourg La Reine, France