Add function to set the initial value of a global variable [PR96089]
TODO: fail if global kind is imported
TODO: doc
2021-05-20 Antoni Boucher <bouanto@zoho.com>
gcc/jit/
PR target/96089
* docs/topics/compatibility.rst (LIBGCCJIT_ABI_19): New ABI
tag.
* docs/topics/expressions.rst: Add documentation for the
function gcc_jit_global_set_initializer_value.
* jit-playback.c: New functions (new_global_with_value,
set_global_initial_value, new_rvalue_from_struct, new_rvalue_from_array).
* jit-playback.h: New functions (new_global_with_value,
set_global_initial_value, new_rvalue_from_struct, new_rvalue_from_array).
* jit-recording.c: Add support for setting a value to a
global variable and new methods
(global_initializer::write_reproducer,
global_initializer::make_debug_string,
global_initializer::write_to_dump,
global_initializer::replay_into,
context::new_global_value_initializer,
memento_of_new_rvalue_from_struct::write_reproducer,
memento_of_new_rvalue_from_struct::make_debug_string,
memento_of_new_rvalue_from_struct::visit_children,
memento_of_new_rvalue_from_struct::replay_into,
memento_of_new_rvalue_from_struct::
memento_of_new_rvalue_from_struct,
context::new_rvalue_from_struct,
memento_of_new_rvalue_from_array::write_reproducer,
memento_of_new_rvalue_from_array::make_debug_string,
memento_of_new_rvalue_from_array::visit_children,
memento_of_new_rvalue_from_array::replay_into,
memento_of_new_rvalue_from_array::
memento_of_new_rvalue_from_array,
new_rvalue_from_array).
* jit-recording.h: New functions (set_initializer_value,
new_global_value_initializer, new_rvalue_from_struct, new_rvalue_from_array),
new field m_initializer_value and new classes (global_initializer,
memento_of_new_rvalue_from_struct, memento_of_new_rvalue_from_array).
* libgccjit.c: New macro RETURN_IF_FAIL_PRINTF5 and new
functions (gcc_jit_global_set_initializer_value,
gcc_jit_context_new_rvalue_from_struct,
gcc_jit_context_new_rvalue_from_array).
* libgccjit.h: New functions (gcc_jit_global_set_initializer_value,
gcc_jit_context_new_rvalue_from_struct,
gcc_jit_context_new_rvalue_from_array).
* libgccjit.map (LIBGCCJIT_ABI_19): New ABI tag.
gcc/testsuite/
PR target/96089
* jit.dg/test-global-set-initializer.c: Add test for the new
function (gcc_jit_global_set_initializer_value).
11 files changed