SV: [PATCH] jit: Add support for global rvalue initialization and ctors

Petter Tomner tomner@kth.se
Tue Nov 30 17:09:05 GMT 2021


David, please note that this patch was sent before your mail in the other thread:
https://gcc.gnu.org/pipermail/jit/2021q4/001400.html

and that this patch still need fixing for those points discussed in there.

Regards,

Från: Gcc-patches <gcc-patches-bounces+tomner=kth.se@gcc.gnu.org> för Petter Tomner via Gcc-patches <gcc-patches@gcc.gnu.org>
Skickat: den 29 november 2021 21:03
Till: gcc-patches@gcc.gnu.org; jit@gcc.gnu.org
Ämne: [PATCH] jit: Add support for global rvalue initialization and ctors
    
Hi!

I have wrapped up the patch than adds support for initialization of global variables
with rvalues aswell as rvalue constructors for structs, arrays and unions.

New entrypoints are:

gcc_jit_global_set_initializer_rvalue

Which sets the initial value of a global to a rvalue.

And:

gcc_jit_context_new_array_constructor
gcc_jit_context_new_struct_constructor
gcc_jit_context_new_union_constructor

Those three makes a constructor with a rvalue that e.g. can be assigned to a local or returned
from a function, or most importantly used to set the initial value of global variables
with gcc_jit_global_set_initializer_rvalue.

If no fields are specified for a struct or union to the constructors, definition order is assumed.

There can be gaps in the fields specified to the struct constructor, but they need to be in order.

For pointer arithmetic to work with setting DECL_INITIAL, alot of folding is added.

make check-jit runs fine on gnu-linux-x64 Debian.

Regards,    


More information about the Jit mailing list