Re: GCC 14 jit API in C++ for creating union types?

2024-12-13 Thread Jonathan Wakely

On 13/12/24 11:24 +0100, Basile Starynkevitch wrote:

On Fri, 2024-12-13 at 11:03 +0100, Basile Starynkevitch wrote:

Hello all,

On GNU Linux/Ubuntu/x86_64 I am using libgccjit++ (in
https://github.com/RefPerSys/RefPerSys/ - a GPLv3+ inference engine
project) but I cannot understand how to create in C++ a union type.


Today (Dec 13, 2024) the file
https://gcc.gnu.org/onlinedocs/jit/cp/topics/types.html
don't explain how to create a GCCJIT union type.

Is there a simple C++ example creating a union for libgccjit 14?

Thanks



It seems that gcc_jit_context_new_union_type exists as a C callable
function in /usr/lib/gcc/x86_64-linux-gnu/14/include/libgccjit.h but
has not yet a C++ wrapping function?

Or did I misunderstood the libgccjit API?



You sent this to the gcc-bugs list, I assume it was meant for a
different list.




GCC 14 jit API in C++ for creating union types?

2024-12-13 Thread Basile Starynkevitch
Hello all,

On GNU Linux/Ubuntu/x86_64 I am using libgccjit++ (in
https://github.com/RefPerSys/RefPerSys/ - a GPLv3+ inference engine
project) but I cannot understand how to create in C++ a union type.


Today (Dec 13, 2024) the file
https://gcc.gnu.org/onlinedocs/jit/cp/topics/types.html
don't explain how to create a GCCJIT union type.

Is there a simple C++ example creating a union for libgccjit 14?

Thanks

-- 
Basile STARYNKEVITCH   
8 rue de la Faïencerie
92340 Bourg-la-Reine,  France
http://starynkevitch.net/Basile & https://github.com/bstarynk 


Re: GCC 14 jit API in C++ for creating union types?

2024-12-13 Thread Basile Starynkevitch
On Fri, 2024-12-13 at 11:03 +0100, Basile Starynkevitch wrote:
> Hello all,
> 
> On GNU Linux/Ubuntu/x86_64 I am using libgccjit++ (in
> https://github.com/RefPerSys/RefPerSys/ - a GPLv3+ inference engine
> project) but I cannot understand how to create in C++ a union type.
> 
> 
> Today (Dec 13, 2024) the file
> https://gcc.gnu.org/onlinedocs/jit/cp/topics/types.html
> don't explain how to create a GCCJIT union type.
> 
> Is there a simple C++ example creating a union for libgccjit 14?
> 
> Thanks
> 

It seems that gcc_jit_context_new_union_type exists as a C callable
function in /usr/lib/gcc/x86_64-linux-gnu/14/include/libgccjit.h but
has not yet a C++ wrapping function?

Or did I misunderstood the libgccjit API?

Thanks

-- 
Basile STARYNKEVITCH   
8 rue de la Faïencerie
92340 Bourg-la-Reine,  France
http://starynkevitch.net/Basile & https://github.com/bstarynk 


Re: GCC 14 jit API in C++ for creating union types?

2024-12-13 Thread David Malcolm
On Fri, 2024-12-13 at 11:24 +0100, Basile Starynkevitch wrote:
> On Fri, 2024-12-13 at 11:03 +0100, Basile Starynkevitch wrote:
> > Hello all,
> > 
> > On GNU Linux/Ubuntu/x86_64 I am using libgccjit++ (in
> > https://github.com/RefPerSys/RefPerSys/ - a GPLv3+ inference engine
> > project) but I cannot understand how to create in C++ a union type.
> > 
> > 
> > Today (Dec 13, 2024) the file
> > https://gcc.gnu.org/onlinedocs/jit/cp/topics/types.html
> > don't explain how to create a GCCJIT union type.
> > 
> > Is there a simple C++ example creating a union for libgccjit 14?
> > 
> > Thanks
> > 
> 
> It seems that gcc_jit_context_new_union_type exists as a C callable
> function in /usr/lib/gcc/x86_64-linux-gnu/14/include/libgccjit.h but
> has not yet a C++ wrapping function?

That's quite likely.  I wrote libgccjit++.h a decade ago for a
particular project that I've abandoned [1], and it's become something
of a second-class part of libgccjit as the C API has moved forward -
sorry.

I don't know of anyone else using libgccjit++.h, so you're likely to
run into gaps like this - but any fixes would (I hope) be relatively
simple, if you don't mind working on patches for libgccjit++.h.

Dave

[1] https://savannah.gnu.org/patch/index.php?8395 (a port of GNU
Octave's JIT compiler to libgccjit)



Re: GCC 14 jit API in C++ for creating union types?

2024-12-13 Thread Basile Starynkevitch
On Fri, 2024-12-13 at 10:48 -0500, David Malcolm wrote:
> On Fri, 2024-12-13 at 11:24 +0100, Basile Starynkevitch wrote:
> > On Fri, 2024-12-13 at 11:03 +0100, Basile Starynkevitch wrote:
> > > Hello all,
> > > 
> > > On GNU Linux/Ubuntu/x86_64 I am using libgccjit++ (in
> > > https://github.com/RefPerSys/RefPerSys/ - a GPLv3+ inference
> > > engine
> > > project) but I cannot understand how to create in C++ a union
> > > type.
> > > 
> > > 
> > > Today (Dec 13, 2024) the file
> > > https://gcc.gnu.org/onlinedocs/jit/cp/topics/types.html
> > > don't explain how to create a GCCJIT union type.
> > > 
> > > Is there a simple C++ example creating a union for libgccjit 14?
> > > 
> > > Thanks
> > > 
> > 
> > It seems that gcc_jit_context_new_union_type exists as a C callable
> > function in /usr/lib/gcc/x86_64-linux-gnu/14/include/libgccjit.h
> > but
> > has not yet a C++ wrapping function?
> 
> That's quite likely.  I wrote libgccjit++.h a decade ago for a
> particular project that I've abandoned [1], and it's become something
> of a second-class part of libgccjit as the C API has moved forward -
> sorry.
> 
> I don't know of anyone else using libgccjit++.h, so you're likely to
> run into gaps like this - but any fixes would (I hope) be relatively
> simple, if you don't mind working on patches for libgccjit++.h.


That is OK for me, I could use the C API. But then I would suggest
adding to the GCCJIT documentation that the C++ API is deprecated.


-- 
Basile STARYNKEVITCH   
8 rue de la Faïencerie
92340 Bourg-la-Reine,  France
http://starynkevitch.net/Basile & https://github.com/bstarynk