aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/libgccjit.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-08-25 20:25:05 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-08-25 20:25:05 +0000
commit9376dd63e6a2d94823f6faf8212c9f37bef5a656 (patch)
tree2745652bd94e40ef40a21a22e1c88c4429fccab1 /gcc/jit/libgccjit.c
parent25c65938c8794115531d09a37e17d3bc469f6269 (diff)
downloadgcc-9376dd63e6a2d94823f6faf8212c9f37bef5a656.zip
gcc-9376dd63e6a2d94823f6faf8212c9f37bef5a656.tar.gz
gcc-9376dd63e6a2d94823f6faf8212c9f37bef5a656.tar.bz2
Support embedding the driver in-process within libgccjit
gcc/ChangeLog: * gcc-main.c (main): Add params to driver ctor. * gcc.c (class env_manager): New. (env): New global. (env_manager::init): New. (env_manager::get): New. (env_manager::xput): New. (env_manager::restore): New. Poison getenv and putenv. (DEFAULT_TARGET_SYSTEM_ROOT): New. (target_system_root): Update initialization to use DEFAULT_TARGET_SYSTEM_ROOT. (struct spec_list): Add field "default_ptr". (INIT_STATIC_SPEC): Initialize new field "default_ptr". (init_spec): Likewise. (set_spec): Clear field "default_ptr". (read_specs): Free "spec" and "buffer". (xputenv): Reimplement in terms of env_manager. (process_command): Replace ::getenv calls with calls to the env_manager singleton. (process_brace_body): Free string in three places. (driver::driver): New. (driver::~driver): New. (used_arg): Convert from a function to... (class used_arg_t): ...this class, and... (used_arg): ...this new global instance. (used_arg_t::finalize): New function. (getenv_spec_function): Add "const" to local "value". Replace ::getenv call with call to the env_manager singleton. (path_prefix_reset): New function. (driver::finalize): New function. * gcc.h (driver::driver): New. (driver::~driver): New. (driver::finalize): New. gcc/jit/ChangeLog: * docs/cp/topics/contexts.rst (gccjit::context::set_bool_use_external_driver): New. * docs/internals/test-hello-world.exe.log.txt: Update. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_5): New. * docs/topics/contexts.rst (gcc_jit_context_set_bool_use_external_driver): New. * jit-common.h (enum inner_bool_option): Add INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER. * jit-playback.c (gcc_driver_name): New global. (gcc:jit::playback::context::invoke_driver): Split out second half into... (gcc::jit::playback::context::invoke_embedded_driver): ...this new function, and... (gcc::jit::playback::context::invoke_external_driver): ...this new function. * jit-playback.h (gcc::jit::playback::context::get_inner_bool_option): New. (gcc::jit::playback::context::invoke_embedded_driver): New. (gcc::jit::playback::context::invoke_external_driver): New. * jit-recording.c (inner_bool_option_reproducer_strings): Add entry for INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER. * libgccjit++.h (gccjit::context::set_bool_use_external_driver): New. * libgccjit.c (gcc_jit_context_set_bool_use_external_driver): New. * libgccjit.h (gcc_jit_context_set_bool_use_external_driver): New. (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_use_external_driver): New. * libgccjit.map (LIBGCCJIT_ABI_5): New. * notes.txt: Show invocation of embedded copy of driver. * docs/internals/test-hello-world.exe.log.txt: Update gcc/testsuite/ChangeLog: * jit.dg/test-error-pr63969-missing-driver.c: Add call to gcc_jit_context_set_bool_use_external_driver. From-SVN: r227188
Diffstat (limited to 'gcc/jit/libgccjit.c')
-rw-r--r--gcc/jit/libgccjit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
index eb9200c..55cda6b 100644
--- a/gcc/jit/libgccjit.c
+++ b/gcc/jit/libgccjit.c
@@ -2611,6 +2611,23 @@ gcc_jit_context_set_bool_allow_unreachable_blocks (gcc_jit_context *ctxt,
/* Public entrypoint. See description in libgccjit.h.
After error-checking, the real work is done by the
+ gcc::jit::recording::context::set_inner_bool_option method in
+ jit-recording.c. */
+
+extern void
+gcc_jit_context_set_bool_use_external_driver (gcc_jit_context *ctxt,
+ int bool_value)
+{
+ RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+ JIT_LOG_FUNC (ctxt->get_logger ());
+ ctxt->set_inner_bool_option (
+ gcc::jit::INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER,
+ bool_value);
+}
+
+/* Public entrypoint. See description in libgccjit.h.
+
+ After error-checking, the real work is done by the
gcc::jit::recording::context::add_command_line_option method in
jit-recording.c. */