aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/libgccjit.h
diff options
context:
space:
mode:
authorAndrea Corallo <andrea.corallo@arm.com>2020-05-30 10:33:08 +0100
committerAndrea Corallo <andrea.corallo@arm.com>2020-09-11 12:18:59 +0200
commit4ecc0061c400102859dd630cce84d1cc5be0fbf7 (patch)
tree7d5e9b91b960800e48074ba848e723990048acaf /gcc/jit/libgccjit.h
parent15545563128f0240192c263522d4a36b7f86250f (diff)
downloadgcc-4ecc0061c400102859dd630cce84d1cc5be0fbf7.zip
gcc-4ecc0061c400102859dd630cce84d1cc5be0fbf7.tar.gz
gcc-4ecc0061c400102859dd630cce84d1cc5be0fbf7.tar.bz2
libgccjit: Add new gcc_jit_global_set_initializer entry point
gcc/jit/ChangeLog 2020-08-01 Andrea Corallo <andrea.corallo@arm.com> * docs/topics/compatibility.rst (LIBGCCJIT_ABI_14): New ABI tag. * docs/topics/expressions.rst (gcc_jit_global_set_initializer): Document new entry point in section 'Global variables'. * jit-playback.c (global_new_decl, global_finalize_lvalue): New method. (playback::context::new_global): Make use of global_new_decl, global_finalize_lvalue. (load_blob_in_ctor): New template function in use by the following. (playback::context::new_global_initialized): New method. * jit-playback.h (class context): Decl 'new_global_initialized', 'global_new_decl', 'global_finalize_lvalue'. (lvalue::set_initializer): Add implementation. * jit-recording.c (recording::memento_of_get_pointer::get_size) (recording::memento_of_get_type::get_size): Add implementation. (recording::global::write_initializer_reproducer): New function in use by 'recording::global::write_reproducer'. (recording::global::replay_into) (recording::global::write_to_dump) (recording::global::write_reproducer): Handle initialized case. * jit-recording.h (class type): Decl 'get_size' and 'num_elements'. * libgccjit++.h (class lvalue): Declare new 'set_initializer' method. (class lvalue): Decl 'is_global' and 'set_initializer'. (class global) Decl 'write_initializer_reproducer'. Add 'm_initializer', 'm_initializer_num_bytes' fields. Implement 'set_initializer'. Add a destructor to free 'm_initializer'. * libgccjit.c (gcc_jit_global_set_initializer): New function. * libgccjit.h (gcc_jit_global_set_initializer): New function declaration. * libgccjit.map (LIBGCCJIT_ABI_14): New ABI tag. gcc/testsuite/ChangeLog 2020-08-01 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/all-non-failing-tests.h: Add test-blob.c. * jit.dg/test-global-set-initializer.c: New testcase.
Diffstat (limited to 'gcc/jit/libgccjit.h')
-rw-r--r--gcc/jit/libgccjit.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
index 1c5a12e..7134841 100644
--- a/gcc/jit/libgccjit.h
+++ b/gcc/jit/libgccjit.h
@@ -788,6 +788,21 @@ gcc_jit_context_new_global (gcc_jit_context *ctxt,
gcc_jit_type *type,
const char *name);
+#define LIBGCCJIT_HAVE_gcc_jit_global_set_initializer
+
+/* Set an initial value for a global, which must be an array of
+ integral type. Return the global itself.
+
+ This API entrypoint was added in LIBGCCJIT_ABI_14; you can test for its
+ presence using
+ #ifdef LIBGCCJIT_HAVE_gcc_jit_global_set_initializer
+*/
+
+extern gcc_jit_lvalue *
+gcc_jit_global_set_initializer (gcc_jit_lvalue *global,
+ const void *blob,
+ size_t num_bytes);
+
/* Upcasting. */
extern gcc_jit_object *
gcc_jit_lvalue_as_object (gcc_jit_lvalue *lvalue);