aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/jit-playback.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-01-12 17:14:02 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-01-12 17:14:02 +0000
commit791cfef8e7553e4939a1ed095e25414f6dc713d6 (patch)
tree062ae8773efd3200e81a237028025864147648c8 /gcc/jit/jit-playback.h
parent6c0fcb81dad4c8f2f9c687a40627db0442a475f4 (diff)
downloadgcc-791cfef8e7553e4939a1ed095e25414f6dc713d6.zip
gcc-791cfef8e7553e4939a1ed095e25414f6dc713d6.tar.gz
gcc-791cfef8e7553e4939a1ed095e25414f6dc713d6.tar.bz2
jit: API change to gcc_jit_context_new_global
gcc/jit/ChangeLog: * docs/cp/topics/expressions.rst (Global variables): Add enum gcc_jit_global_kind param to gccjit::context::new_global. * docs/topics/expressions.rst (Global variables): Likewise. Document the new enum. * docs/topics/results.rst (Compilation results): Document globals-handling. * dummy-frontend.c (jit_langhook_write_globals): Call into the playback context's write_global_decls_1 and write_global_decls_2 before and after calling symtab->finalize_compilation_unit (). * jit-playback.c: Include "debug.h". (gcc::jit::playback::context::new_global): Add "kind" param and use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the underlying VAR_DECL. Call varpool_node::get_create on the VAR_DECL, and add it to m_globals. (gcc::jit::playback::context::write_global_decls_1): New function. (gcc::jit::playback::context::write_global_decls_2): New function. * jit-playback.h (gcc::jit::playback::context::context): Call create on m_globals. (gcc::jit::playback::context::new_global): Add "kind" param. (gcc::jit::playback::context::write_global_decls_1): New function. (gcc::jit::playback::context::write_global_decls_2): New function. (gcc::jit::playback::context::m_globals): New field. * jit-recording.c (gcc::jit::recording::context::context): Initialize m_globals. (gcc::jit::recording::context::new_global): Add param "kind". Add the new global to m_globals. (gcc::jit::recording::context::dump_to_file): Dump the globals. (gcc::jit::recording::global::replay_into): Add field m_kind. (gcc::jit::recording::global::write_to_dump): New override. * jit-recording.h (gcc::jit::recording::context::new_global): Add param "kind". (gcc::jit::recording::context::m_globals): New field. (gcc::jit::recording::global::global): Add param kind. (gcc::jit::recording::global::write_to_dump): New override. (gcc::jit::recording::global::m_kind): New field. * jit-result.c (gcc::jit::result::get_global): New function. * jit-result.h (gcc::jit::result::get_global): New function. * libgccjit++.h (gccjit::context::new_global): Add "kind" param. * libgccjit.c (gcc_jit_context_new_global): Likewise. (gcc_jit_result_get_global): New API entrypoint. * libgccjit.h (gcc_jit_result_get_global): New API entrypoint. (enum gcc_jit_global_kind): New enum. (gcc_jit_context_new_global): API change: add "kind" param. * libgccjit.map (gcc_jit_result_get_global): New symbol. gcc/testsuite/ChangeLog: * jit.dg/test-array-as-pointer.c (create_code): Update call to gcc_jit_context_new_global by setting "kind" to GCC_JIT_GLOBAL_IMPORTED. * jit.dg/test-error-array-as-pointer.c: Likewise. * jit.dg/test-expressions.c (make_test_of_get_address): Likewise. * jit.dg/test-fuzzer.c (make_random_global): Likewise, but setting kind to GCC_JIT_GLOBAL_EXPORTED. * jit.dg/test-using-global.c (the_global): Rename to... (imported_global): ...this. (create_code): Update to test the three kinds of global. (verify_code): Likewise. From-SVN: r219480
Diffstat (limited to 'gcc/jit/jit-playback.h')
-rw-r--r--gcc/jit/jit-playback.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/jit/jit-playback.h b/gcc/jit/jit-playback.h
index 07d030e..8efd506 100644
--- a/gcc/jit/jit-playback.h
+++ b/gcc/jit/jit-playback.h
@@ -90,6 +90,7 @@ public:
lvalue *
new_global (location *loc,
+ enum gcc_jit_global_kind kind,
type *type,
const char *name);
@@ -206,6 +207,10 @@ public:
return m_recording_ctxt->errors_occurred ();
}
+ /* For use by jit_langhook_write_globals. */
+ void write_global_decls_1 ();
+ void write_global_decls_2 ();
+
private:
void dump_generated_code ();
@@ -259,6 +264,7 @@ private:
tempdir *m_tempdir;
auto_vec<function *> m_functions;
+ auto_vec<tree> m_globals;
tree m_char_array_type_node;
tree m_const_char_ptr;