[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wish: gcc_jit_type_get_atomic
On 05/20/2016 01:46 PM, Basile Starynkevitch wrote:
My feeling (but I might be wrong) is that GCCJIT should give some way
to retrieve that __ATOMIC_SEQ_CST. Apparently it is a magic
preprocessor symbol (perhaps GCC specific!) implemented in
gcc/cppbuiltin.c (near line 68, defined as MEMMODEL_SEQ_CST); but if I
understand correctly GCCJIT does not give access to the compiler's
magic preprocessor symbols.
I feel that GCCJIT might want to have a function like
int gccjit_atomic_seq_cst_value(); // value of __ATOMIC_SEQ_CST in the
GCC used by GCCJIT
or perhaps a more general function
int gccjit_compiler_magic_int(const char*);
that I would call as gccjit_compiler_magic_int("__ATOMIC_SEQ_CST");
FWIW, there is a dirty hack to get that. On a Debian system with both
libgccjit-6-dev & gcc-6-plugin-dev packages installed the
/usr/lib/gcc/x86_64-linux-gnu/6/plugin/include/coretypes.h header file
(provided by libgccjit-6-dev) defines an enum memmodel with
MEMMODEL_SEQ_CST = 5; So I guess that I could use that MEMMODEL_SEQ_CST
as an argument to gcc_jit_context_new_rvalue_from_int.
But some distributions don't package GCC plugin headers (in particular,
in the past, some GCC versions on some Redhat systems disabled plugins
in GCC; I don't know if that is true today). And at least, it is not
documented that GCCJIT is related to GCC plugins.
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***