2016-08-22 Release Manager * GCC 6.2.0 released. 2016-04-27 Release Manager * GCC 6.1.0 released. 2016-02-08 David Malcolm * dummy-frontend.c (jit_langhook_init): Remove second argument to build_common_tree_nodes to track r233218. 2016-01-23 Iain Buclaw * jit-playback.c: Include pthread.h. 2016-01-19 David Malcolm PR jit/69144 * jit-playback.c (gcc::jit::playback::compile_to_file::postprocess): Potentially add the temporary artifact to the tempdir's list of tempfiles needing additional cleanup. (gcc::jit::playback::context::extract_any_requested_dumps): Likewise for the dumpfile. * jit-tempdir.c (gcc::jit::tempdir::~tempdir): Clean up additional tempfiles. * jit-tempdir.h (gcc::jit::tempdir::add_temp_file): New method. (gcc::jit::tempdir::m_tempfiles): New field. * docs/cp/intro/tutorial04.rst: Update for changes to toyvm.cc. * docs/examples/tut04-toyvm/toyvm.cc (class compilation_result): New. (toyvm_function::compile): Change return type from function ptr to a compilation_result. (toyvm_function::get_function_name): New accessor. (toyvm_function::m_funcname): New field. (get_function_name): Convert to... (toyvm_function::make_function_name): ...this new method. (toyvm_function::parse): Call make_function_name. (toyvm_function::compile): Convert return type from function ptr to a compilation_result. Use get_function_name. (compilation_state::compile): Convert return type from gcc_jit_result * to a compilation_result. (test_script): Update for above changes, extracting the code from the compilation_result. (main): Likewise. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2016-01-04 Jakub Jelinek Update copyright years. 2015-11-11 Andrew MacLeod * dummy-frontend.c: Remove unused header files. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * jit-spec.c: Likewise. * libgccjit.c: Likewise. 2015-11-07 Richard Sandiford * jit-builtins.c: Don't undef DEF_BUILTIN. 2015-10-29 Andrew MacLeod * dummy-frontend.c: Reorder #include's and remove duplicates. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * libgccjit.c: Likewise. 2015-10-13 Jakub Jelinek * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, DEF_FUNCTION_TYPE_11): Define. 2015-09-30 Thomas Schwinge Ulrich Drepper * jit-builtins.h: Undefine DEF_FUNCTION_TYPE_VAR_6 after use. 2015-09-30 Matthias Klose * jit-builtins.h Define DEF_FUNCTION_TYPE_VAR_6, remove DEF_FUNCTION_TYPE_VAR_11. * jit-builtins.c (builtins_manager::make_type): Define and handle DEF_FUNCTION_TYPE_VAR_6, remove DEF_FUNCTION_TYPE_VAR_11. 2015-08-25 David Malcolm * 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 2015-08-13 David Malcolm * jit-playback.c (invoke_driver): On OS X, add "-Wl,-undefined,dynamic_lookup" to the driver arguments. 2015-08-03 David Malcolm * docs/topics/compatibility.rst (LIBGCCJIT_ABI_4): New. * docs/topics/contexts.rst (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY): We no longer show a profile. * docs/topics/index.rst (Topic Reference): Add performance.rst. * docs/topics/performance.rst: New file. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c (gcc::jit::playback::context::compile): Add timer param when constructing the "toplev" instance. (gcc::jit::playback::context::acquire_mutex): Add timer param when constructing auto_timevar instance. (gcc::jit::playback::context::make_fake_args): If we have a timer, add "-ftime-report". (gcc::jit::playback::context::invoke_driver): Add timer param when constructing auto_timevar instance. (gcc::jit::playback::context::dlopen_built_dso): Likewise. * jit-playback.h (gcc::jit::playback::context::get_timer): New accessor. * jit-recording.c: Include timevar.h. (gcc::jit::recording::context::context): Initialize field "m_timer". * jit-recording.h: Add forward declaration of class timer. (gcc::jit::recording::context::set_timer): New method. (gcc::jit::recording::context::get_timer): New method. (gcc::jit::recording::context::m_timer): New field. * libgccjit++.h (gccjit::timer): New class. (gccjit::auto_time): New class. (gccjit::context::set_timer): New method. (gccjit::context::get_timer): New. (gccjit::timer::timer): New. (gccjit::timer::push): New. (gccjit::timer::pop): New. (timer::print): New. (timer::get_inner_timer): New. (timer::release): New. (auto_time::auto_time): New. (auto_time::~auto_time): New. * libgccjit.c: Include timevar.h. (struct gcc_jit_timer): New. (gcc_jit_timer_new): New function. (gcc_jit_timer_release): New function. (gcc_jit_context_set_timer): New function. (gcc_jit_context_get_timer): New function. (gcc_jit_timer_push): New function. (gcc_jit_timer_pop): New function. (gcc_jit_timer_print): New function. * libgccjit.h (LIBGCCJIT_HAVE_TIMING_API): New macro. (gcc_jit_timer): New typedef. (gcc_jit_timer_new): New function. (gcc_jit_timer_release): New function. (gcc_jit_context_set_timer): New function. (gcc_jit_context_get_timer): New function. (gcc_jit_timer_push): New function. (gcc_jit_timer_pop): New function. (gcc_jit_timer_print): New function. * libgccjit.map (LIBGCCJIT_ABI_4): New. (gcc_jit_timer_new): New function. (gcc_jit_timer_release): New function. (gcc_jit_context_set_timer): New function. (gcc_jit_context_get_timer): New function. (gcc_jit_timer_push): New function. (gcc_jit_timer_pop): New function. (gcc_jit_timer_print): New function. 2015-07-23 David Malcolm * jit-playback.c (invoke_driver): Convert local "argvec" to an auto_argvec, so that it owns copies of the strings, rather than borrows them, updating ADD_ARG to use xstrdup and special-casing the NULL terminator to avoid xstrdup (NULL). Call add_multilib_driver_arguments at the front of the arguments. (MULTILIB_DEFAULTS): Provide a default definition. (multilib_defaults_raw): New constant array. (gcc::jit::playback::context::add_multilib_driver_arguments): New method. * jit-playback.h (gcc::jit::playback::context::add_multilib_driver_arguments): New method. * docs/internals/test-hello-world.exe.log.txt: Update. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-07-16 David Malcolm * docs/internals/index.rst (Overview of code structure): Add note that the implementation is in C++, despite the .c extension. (Submitting patches): New subsection. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-07-09 Andrew MacLeod * dummy-frontend.c: Adjust includes for flags.h changes. * jit-common.h: Likewise. * jit-playback.c: Likewise. 2015-07-08 David Malcolm PR jit/66783 * libgccjit.c (gcc_jit_context_new_field): Show name of field in "unknown size" error message. (gcc_jit_struct_set_fields): Show name of struct in error message. (gcc_jit_context_new_global): Show name of global in "unknown size" error message. (gcc_jit_function_new_local): Likewise for local. 2015-07-07 Andrew MacLeod * dummy-frontend.c: Adjust includes. * jit-common.h: Likewise. * jit-playback.c: Likewise. 2015-07-07 David Malcolm PR jit/66783 * jit-recording.h: Within namespace gcc:jit::recording... (type::has_known_size): New virtual function. (struct_has_known_size): New function. * libgccjit.c (gcc_jit_context_new_field): Verify that the type has a known size. (gcc_jit_context_new_global): Likewise. (gcc_jit_function_new_local): Likewise. 2015-07-07 David Malcolm PR jit/66779 * dummy-frontend.c (jit_langhook_type_for_mode): Ensure that we handle modes QI, HI, SI, DI, TI. 2015-07-01 David Malcolm PR jit/66700 * jit-playback.c (jit_mark_addressable): New function. (gcc::jit::playback::lvalue::get_address): Call jit_mark_addressable on the underlying tree. 2015-07-01 David Malcolm * docs/topics/types.rst (gcc_jit_context_new_union_type): Add documentation. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-07-01 David Malcolm * docs/topics/contexts.rst (gcc_jit_context_set_bool_option): Clarify lack of lifetime requirements on (const char *) parameter. * docs/topics/expressions.rst (gcc_jit_context_new_string_literal): Likewise. (gcc_jit_context_new_global): Likewise. * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_new_block): Likewise. (gcc_jit_block_add_comment): Likewise. * docs/topics/locations.rst (gcc_jit_context_new_location): Likewise. * docs/topics/types.rst (gcc_jit_context_new_field): Likewise. (gcc_jit_context_new_struct_type): Likewise. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-06-30 David Malcolm * docs/cp/topics/functions.rst (Blocks): Add switch statements to list of ways to terminate a block. (gccjit::block::end_with_switch): Add function description. (gccjit::case_): Add class. (gccjit::context::new_case): Add function description. * docs/cp/topics/objects.rst: Add "case_" to class hierarchy. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New. * docs/topics/functions.rst (Blocks): Add switch statements to list of ways to terminate a block. (gcc_jit_block_end_with_switch): Add function description. (gcc_jit_case): Add type. (gcc_jit_context_new_case): Add function description. (gcc_jit_case_as_object): Add function description. * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::recording::case_): Add forward decl. (gcc::jit::playback::case_): Add forward decl. * jit-playback.c (add_case): New function. (gcc::jit::playback::block::add_switch): New function. * jit-playback.h (gcc::jit::playback::case_): New struct. (gcc::jit::playback::block::get_function): New method. (gcc::jit::playback::block::add_switch): New method. * jit-recording.c: Within namespace gcc::jit... (recording::context::new_case): New method. (recording::function::validate): Update for change to get_successor_blocks. (recording::block::end_with_switch): New method. (recording::block::get_successor_blocks): Update to support an arbitrary number of successor blocks. (recording::block::dump_edges_to_dot): Likewise. (memento_of_new_rvalue_from_const ::get_wide_int): New. (memento_of_new_rvalue_from_const ::get_wide_int): New. (memento_of_new_rvalue_from_const ::get_wide_int): New. (memento_of_new_rvalue_from_const ::get_wide_int): New. (recording::statement::get_successor_blocks): Update to support an arbitrary number of successor blocks. (recording::conditional::get_successor_blocks): Likewise. (recording::jump::get_successor_blocks): Likewise. (recording::return_::get_successor_blocks): Likewise. (recording::case_::write_reproducer): New. (recording::case_::make_debug_string): New. (recording::switch_::switch_): New. (recording::switch_::replay_into): New. (recording::switch_::get_successor_blocks): New. (recording::switch_::make_debug_string): New. (recording::switch_::write_reproducer): New. * jit-recording.h: Within namespace gcc::jit::recording... (context::new_case): New. (rvalue::is_constant): New. (rvalue::get_wide_int): New. (block::end_with_switch): New. (block::get_successor_blocks): Update to support an arbitrary number of successor blocks. (memento_of_new_rvalue_from_const::is_constant): New. (memento_of_new_rvalue_from_const::get_wide_int): New. (statement::get_successor_blocks): Update to support an arbitrary number of successor blocks. (conditional::get_successor_blocks): Likewise. (jump::get_successor_blocks): Likewise. (return_::get_successor_blocks): Likewise. (case_): New subclass of memento. (switch_): New subclass of statement. * libgccjit++.h (gccjit::case_): New subclass of gccjit::object. (gccjit::context::new_case): New method. (gccjit::block::end_with_switch): New method. (gccjit::case_::case): New ctors. (gccjit::case_::get_inner_case): New method. * libgccjit.c: Include "typed-splay-tree.h" (struct gcc_jit_case): New. (gcc_jit_context_new_case): New function. (gcc_jit_case_as_object): New function. (valid_dest_for_switch): New function. (valid_case_for_switch): New function. (class api_call_validator): New class. (class case_range_validator): New class. (case_range_validator::case_range_validator): New. (case_range_validator::validate): New. (case_range_validator::case_compare): New. (case_range_validator::get_wide_int): new. (gcc_jit_block_end_with_switch): New. * libgccjit.h: Add gcc_jit_case to class hierarchy comment. (gcc_jit_case): New typedef. (gcc_jit_context_new_case): New function. (gcc_jit_case_as_object): New function. (gcc_jit_block_end_with_switch): New function. (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New. * libgccjit.map: Add gcc_jit_block_end_with_switch, gcc_jit_case_as_object and gcc_jit_context_new_case. 2015-06-30 David Malcolm PR jit/66546 * docs/cp/topics/contexts.rst (gccjit::context::set_bool_allow_unreachable_blocks): New. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New. * docs/topics/contexts.rst (Options): Add notes discussing the transition from enums to entrypoints for new options. (gcc_jit_context_set_bool_allow_unreachable_blocks): New. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::inner_bool_option): New enum. * jit-recording.c: Within namespace gcc::jit... (recording::context::context): Handle m_inner_bool_options. (recording::context::set_inner_bool_option): New. (inner_bool_option_reproducer_strings): New. (recording::context::log_all_options): Log the "inner" bool options. (recording::context::log_inner_bool_option): New. (recording::context::dump_reproducer_to_file): Write initializers for "inner" bool options. (recording::function::validate): Don't check for block reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set. * jit-recording.h: Within namespace gcc::jit... (recording::context::set_inner_bool_option): New. (recording::context::get_inner_bool_option): New. (recording::context::log_inner_bool_option): New. (recording::context::m_inner_bool_options): New. * libgccjit++.h (gccjit::context::set_bool_allow_unreachable_blocks): New. * libgccjit.c (gcc_jit_context_set_bool_allow_unreachable_blocks): New. * libgccjit.h: Add note about options present in the initial release of libgccjit. (gcc_jit_context_set_bool_allow_unreachable_blocks): New API entrypoint. (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks): New macro. * libgccjit.map (LIBGCCJIT_ABI_2): New, containing... (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new entrypoint. 2015-06-30 David Malcolm PR jit/66628 * docs/cp/topics/contexts.rst (Additional command-line options): New section. * docs/topics/compatibility.rst: New file. * docs/topics/contexts.rst (Additional command-line options): New section. * docs/topics/index.rst: Add compatibility.rst. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c (make_fake_args): Add call to append_command_line_options. * jit-recording.c: Within namespace gcc::jit... (recording::context::~context): Free the optnames within m_command_line_options. (recording::context::set_bool_option): Likewise. (recording::context::add_command_line_option): New method. (recording::context::append_command_line_options): New method. (recording::context::dump_reproducer_to_file): Add command-line options. * jit-recording.h: Within namespace gcc::jit... (recording::context::add_command_line_option): New method. (recording::context::append_command_line_options): New method. (recording::context::m_command_line_options): New field. * libgccjit++.h (gccjit::context::add_command_line_option): New method. * libgccjit.c (gcc_jit_context_add_command_line_option): New API entrypoint. * libgccjit.h (gcc_jit_context_add_command_line_option): New API entrypoint. (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New macro. * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option. 2015-06-30 David Malcolm * jit-recording.c (gcc::jit::recording::context::dump_reproducer_to_file): Add pragma to generated reproducers to disable -Wunused-variable. Fix handling of NULL string options. 2015-06-30 David Malcolm * docs/cp/topics/expressions.rst: Remove stray semicolon. * docs/cp/topics/functions.rst: Remove stray backslash. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-06-25 Andrew MacLeod * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list. * jit-playback.c: Likewise. 2015-06-25 Andrew Macleod * jit-common.h: Don't include alias.h. 2015-06-17 David Malcolm * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field is for the correct struct. (gcc_jit_rvalue_access_field): Likewise. 2015-06-17 Andrew MacLeod * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h. * jit-common.h: Likewise. * jit-playback.c: Likewise. 2015-06-16 David Malcolm PR jit/66539 * jit-recording.c: Within namespace gcc::jit::recording:: (rvalue::get_debug_string_parens): New function. (binary_op::make_debug_string): Update to mimic C precedence rules. (binary_op_precedence): New array. (binary_op::get_precedence): New function. (comparison::make_debug_string): Update to mimic C precedence rules. (comparison_precedence): New array. (comparison::get_precedence): New function. (cast::make_debug_string): Update to mimic C precedence rules. (call::make_debug_string): Likewise. (call_through_ptr::make_debug_string): Likewise. (array_access::make_debug_string): Likewise. (access_field_of_lvalue::make_debug_string): Likewise. (access_field_rvalue::make_debug_string): Likewise. (dereference_field_rvalue::make_debug_string): Likewise. (dereference_rvalue::make_debug_string): Likewise. (get_address_of_lvalue::make_debug_string): Likewise. * jit-recording.h: Within namespace gcc::jit::recording:: (precedence): New enum. (rvalue::rvalue): Initialize field "m_parenthesized_string". (rvalue::get_debug_string_parens): New method. (rvalue::get_precedence): New pure virtual function. (rvalue::m_parenthesized_string): New field. (param::get_precedence): New function. (global::get_precedence): New function. (memento_of_new_rvalue_from_const::get_precedence): New function. (memento_of_new_string_literal::get_precedence): New function. (unary_op::get_precedence): New function. (binary_op::get_precedence): New function. (comparison::get_precedence): New function. (cast::get_precedence): New function. (call::get_precedence): New function. (call_through_ptr::get_precedence): New function. (array_access::get_precedence): New function. (access_field_of_lvalue::get_precedence): New function. (access_field_rvalue::get_precedence): New function. (dereference_field_rvalue::get_precedence): New function. (dereference_rvalue::get_precedence): New function. (get_address_of_lvalue::get_precedence): New function. (local::get_precedence): New function. 2015-06-09 Matthias Klose * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA. 2015-06-08 Andrew MacLeod * dummy-frontend.c : Adjust include files. * jit-common.h : Likewise. * jit-playback.c : Likewise. 2015-06-05 David Malcolm * dummy-frontend.c (jit_langhook_post_compilation_parsing_cleanups): Remove. (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove * jit-playback.c (gcc::jit::playback::context::new_global): Add call to varpool_node::finalize_decl. (gcc::jit::playback::context::finalize_global_decls): Remove. * jit-playback.h (gcc::jit::playback::context::finalize_global_decls): Remove. 2015-06-05 David Malcolm * dummy-frontend.c (jit_langhook_write_globals): Rename to... (jit_langhook_post_compilation_parsing_cleanups): ...this, and eliminate calls to finalize_compilation_unit and write_global_decls_2. (LANG_HOOKS_WRITE_GLOBALS): Rename to... (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and redirect from jit_langhook_write_globals to jit_langhook_post_compilation_parsing_cleanups. * jit-playback.c (gcc::jit::playback::context::write_global_decls_1): Rename to... (gcc::jit::playback::context::finalize_global_decls): ...this. (gcc::jit::playback::context::write_global_decls_1): Delete. * jit-playback.h (gcc::jit::playback::context::write_global_decls_1): Rename to... (gcc::jit::playback::context::finalize_global_decls): ...this. (gcc::jit::playback::context::write_global_decls_1): Delete. 2015-06-04 Andrew MacLeod * dummy-frontend.c: Adjust includes for restructured coretypes.h. * jit-common.h: Likewise. * jit-playback.c: Likewise. 2015-05-12 David Malcolm * jit-builtins.c: Include vec.h before target.h. 2015-04-27 Jim Wilson * Make-lang.in (jit.mostlyclean): Remove shared libraries and object files. 2015-04-09 David Malcolm PR jit/65691 * docs/cp/topics/expressions.rst (Simple expressions): Fix copy and paste error in description of gccjit::context::one. * docs/topics/expressions.rst (Simple expressions): Likewise in description of gcc_jit_context_one. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-03-13 Uros Bizjak * jit-recording.c (dump::write): Also check vasprintf return value. (recording::context::add_error_va): Ditto. (recording::string::from_printf): Ditto. 2015-03-13 David Malcolm * docs/internals/index.rst (Packaging notes): New section. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-03-05 David Malcolm * docs/cp/intro/tutorial03.rst: Add missing arguments to gccjit::block::end_with_conditional call. Add on_true/on_false comments. Tweak the wording. * docs/intro/tutorial03.rst: Add missing arguments to gcc_jit_block_end_with_conditional call. Add some clarifying comments. * docs/topics/compilation.rst: Tweak the wording to avoid an ambiguous use of "this". * docs/topics/contexts.rst: Fix a typo. * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove a stray backtick. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-02-24 Thomas Schwinge PR libgomp/64625 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): Remove macros. (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros. * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): Remove macros. (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros. 2015-02-04 David Malcolm PR jit/64257 * docs/conf.py (html_theme): Change from 'pyramid' to 'sphinxdoc'. 2015-02-04 David Malcolm * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix typo. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-02-03 David Malcolm * jit-logging.h (gcc::jit::log_user::log): Make const. * jit-recording.c (gcc::jit::recording::context::set_str_option): Log the new value of the option. (gcc::jit::recording::context::set_int_option): Likewise. (gcc::jit::recording::context::set_bool_option): Likewise. (gcc::jit::recording::context::compile): Log the value of all options. (gcc::jit::recording::context::compile_to_file): Likewise. (gcc::jit::recording::context::log_all_options): New function. (gcc::jit::recording::context::log_str_option): New function. (gcc::jit::recording::context::log_int_option): New function. (gcc::jit::recording::context::log_bool_option): New function. * jit-recording.h (gcc::jit::recording::context::log_all_options): New function. (gcc::jit::recording::context::log_str_option): New function. (gcc::jit::recording::context::log_int_option): New function. (gcc::jit::recording::context::log_bool_option): New function. * docs/internals/test-hello-world.exe.log.txt: Update for above changes. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-02-03 David Malcolm PR jit/64810 * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o. (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS. * jit-playback.c: Include gcc.h. (gcc::jit::playback::context::compile): Move mutex acquisition to before the call to make_fake_args. (append_arg_from_driver): New function. (gcc::jit::playback::context::make_fake_args): On the first call, call into driver_get_configure_time_options to get configure-time default options and cache them. Add them to the args for toplev::main. * jit-spec.c: New source file. * docs/internals/test-hello-world.exe.log.txt: Update to reflect above changes. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-02-02 David Malcolm PR jit/64810 * dummy-frontend.c (jit_langhook_type_for_mode): Support TYPE_MODE (long_long_integer_type_node). 2015-01-27 David Malcolm * docs/internals/test-hello-world.exe.log.txt: Add example version lines. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::dump::get_file): New accessor. * jit-logging.c: Include toplev.h. (gcc::jit::logger::logger): Log the GCC version. * jit-recording.c: Include toplev.h. (gcc:jit::recording::context::dump_reproducer_to_file): Log the GCC version. 2015-01-26 David Malcolm * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo. * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The error buffer is only valid until the next call to the context. * docs/_build/texinfo/libgccjit.texi: Regenerate. * libgccjit.h (gcc_jit_context_get_first_error): Reword the comment to omit mention of compiling. (gcc_jit_context_get_last_error): The error buffer is only valid until the next call to the context. 2015-01-26 David Malcolm PR jit/64708 * config-lang.in (compilers): Drop "libgccjit.so". 2015-01-23 David Malcolm PR jit/64721 * jit-playback.c (gcc::jit::playback::context::compile): Construct toplev instances with init_signals=false. 2015-01-19 David Malcolm * docs/cp/topics/results.rst: Rename to... * docs/cp/topics/compilation.rst: ...this, and add section on ahead-of-time compilation. * docs/cp/topics/index.rst: Update for renaming of results.rst to compilation.rst. * docs/examples/emit-alphabet.bf: New file, a sample "brainf" script. * docs/examples/tut05-bf.c: New file, implementing a compiler for "brainf". * docs/internals/test-hello-world.exe.log.txt: Update to reflect changes to logger output. * docs/intro/index.rst: Add tutorial05.rst * docs/intro/tutorial05.rst: New file. * docs/topics/results.rst: Rename to... * docs/topics/compilation.rst: ...this, and add section on ahead-of-time compilation. * docs/topics/index.rst: Update for renaming of results.rst to compilation.rst. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c (gcc::jit::playback::context::compile): Convert return type from result * to void. Move the code to convert to dso and dlopen the result to a new pure virtual "postprocess" method. (gcc::jit::playback::compile_to_memory::compile_to_memory): New function. (gcc::jit::playback::compile_to_memory::postprocess): New function, based on playback::context::compile. (gcc::jit::playback::compile_to_file::compile_to_file): New function. (gcc::jit::playback::compile_to_file::postprocess): New function. (gcc::jit::playback::compile_to_file::copy_file): New function. (gcc::jit::playback::context::convert_to_dso): Move internals to... (gcc::jit::playback::context::invoke_driver): New method. Add "-shared" and "-c" options to driver's argv as needed. * jit-playback.h: Include "timevar.h". (gcc::jit::playback::context::compile): Convert return type from result * to void. (gcc::jit::playback::context::postprocess): New pure virtual function, making this an abstract base class. (gcc::jit::playback::context::get_tempdir): New accessor. (gcc::jit::playback::context::invoke_driver): New function. (class gcc::jit::playback::compile_to_memory): New subclass of playback::context. (class gcc::jit::playback::compile_to_file): Likewise. * jit-recording.c (gcc::jit::recording::context::compile): Use a playback::compile_to_memory, and extract its result. (gcc::jit::recording::context::compile_to_file): New function. * jit-recording.h (gcc::jit::recording::context::compile_to_file): New function. * libgccjit++.h (gccjit::context::compile_to_file): New method. * libgccjit.c (gcc_jit_context_compile): Update log message to clarify that this is an in-memory compile. (gcc_jit_context_compile_to_file): New function. * libgccjit.h (gcc_jit_context): Clarify that you can compile a context more than once, and that you can compile to a file as well as to memory. (gcc_jit_result): Clarify that this is the result of an in-memory compilation. (gcc_jit_context_compile): Clarify that you can compile, and that this is an in-memory compilation. (enum gcc_jit_output_kind): New enum. (gcc_jit_context_compile_to_file): New function. (gcc_jit_context_enable_dump): Clarify comment to cover both forms of compilation. * libgccjit.map (gcc_jit_context_compile_to_file): New API entrypoint. * notes.txt: Update to show the playback::context::postprocess virtual function. 2015-01-19 David Malcolm * jit-recording.c (gcc::jit::recording::memento_of_new_string_literal::make_debug_string): Add missing format string. 2015-01-16 David Malcolm * Make-lang.in (lang_checks_parallelized): Add "check-jit". (check_jit_parallelize): Set this to an arbitrary value (10). 2015-01-16 Jakub Jelinek * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of last argument. (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and undef afterwards. * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Likewise. 2015-01-15 Richard Sandiford Update copyright years in docs/. 2015-01-15 David Malcolm * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the lvalue and the rvalue are of compatible type. 2015-01-13 David Malcolm * docs/cp/topics/contexts.rst (Debugging): Add gccjit::context::dump_reproducer_to_file. * docs/internals/index.rst (Design notes): New section, discussing input validation and gcc_jit_context_dump_reproducer_to_file. * docs/topics/contexts.rst (Debugging): Add gcc_jit_context_dump_reproducer_to_file. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::dump::get_context): New accessor. * jit-recording.c: Include "hash-map.h". Within namespace ::gcc::jit... (dump::write): Flush each line. (dump::make_location): Pass false for new param "created_by_user". (class allocator): New class. (allocator::~allocator): New function. (allocator::xstrdup_printf): New function. (allocator::xstrdup_printf_va): New function. (class reproducer): New subclass of dump. (reproducer::reproducer): New function. (reproducer::write_params): New function. (reproducer::write_args): New function. (reproducer::make_identifier): New function. (reproducer::make_tmp_identifier): New function. (reproducer::get_identifier): New pair of functions. (reproducer::get_identifier_as_rvalue): New function. (reproducer::get_identifier_as_lvalue): New function. (reproducer::get_identifier_as_type): New function. (reproducer::xstrdup_printf): New function. (recording::context::context): Initialize m_toplevel_ctxt. (recording::context::new_location): Add param created_by_user. (str_option_reproducer_strings): New table of strings. (int_option_reproducer_strings): Likewise. (bool_option_reproducer_strings): Likewise. (get_type_enum_strings): Likewise. (names_of_function_kinds): Likewise. (global_kind_reproducer_strings): Likewise. (unary_op_reproducer_strings): Likewise. (binary_op_reproducer_strings): Likewise. (comparison_reproducer_strings): Likewise. Within namespace ::gcc::jit::recording::... (context::dump_reproducer_to_file): New function. (string::write_reproducer): Likewise. (location::write_reproducer): Likewise. (type::access_as_type): Likewise. (memento_of_get_type::write_reproducer): Likewise. (memento_of_get_pointer::write_reproducer): Likewise. (memento_of_get_const::write_reproducer): Likewise. (memento_of_get_volatile::write_reproducer): Likewise. (array_type::write_reproducer): Likewise. (function_type::write_reproducer): Likewise. (function_type::write_deferred_reproducer): Likewise. (field::write_reproducer): Likewise. (struct_::access_as_type): Likewise. (struct_::write_reproducer): Likewise. (union_::write_reproducer): Likewise. (fields::write_reproducer): Likewise. (rvalue::access_as_rvalue): Likewise. (lvalue::access_as_rvalue): Likewise. (lvalue::access_as_lvalue): Likewise. (param::access_as_rvalue): Likewise. (param::access_as_lvalue): Likewise. (param::write_reproducer): Likewise. (function::write_reproducer): Likewise. (block::write_reproducer): Likewise. (global::write_reproducer): Likewise. (memento_of_new_rvalue_from_const ::write_reproducer): Likewise. (memento_of_new_rvalue_from_const ::write_reproducer): Likewise. (memento_of_new_rvalue_from_const ::write_reproducer): Likewise. (memento_of_new_rvalue_from_const ::write_reproducer): Likewise. (memento_of_new_string_literal::write_reproducer): Likewise. (unary_op::write_reproducer): Likewise. (binary_op::write_reproducer): Likewise. (comparison::write_reproducer): Likewise. (cast::write_reproducer): Likewise. (call::write_reproducer): Likewise. (call_through_ptr::write_reproducer): Likewise. (array_access::write_reproducer): Likewise. (access_field_of_lvalue::write_reproducer): Likewise. (access_field_rvalue::write_reproducer): Likewise. (dereference_field_rvalue::write_reproducer): Likewise. (dereference_rvalue::write_reproducer): Likewise. (get_address_of_lvalue::write_reproducer): Likewise. (local::write_reproducer): Likewise. (eval::write_reproducer): Likewise. (assignment::write_reproducer): Likewise. (assignment_op::write_reproducer): Likewise. (comment::write_reproducer): Likewise. (conditional::write_reproducer): Likewise. (jump::write_reproducer): Likewise. (return_::write_reproducer): Likewise. * jit-recording.h (gcc::jit::reproducer): New forward declararion. Within namespace ::gcc::jit::recording::... (context::new_location): Add "created_by_user" param. (context::dump_reproducer_to_file): New method. (context::m_toplevel_ctxt): New field. (memento::write_reproducer): New pure virtual function. (memento::dyn_cast_location): New virtual function. (string::write_reproducer): (location::location): Add "created_by_user" param. (location::dyn_cast_location): New function. (location::created_by_user): New accessor. (location::write_reproducer): New function. (location::m_created_by_user): New field. (type::access_as_type): New virtual function. (location::write_reproducer): Likewise. (type::access_as_type): Likewise. (memento_of_get_type::write_reproducer): Likewise. (memento_of_get_pointer::write_reproducer): Likewise. (memento_of_get_const::write_reproducer): Likewise. (memento_of_get_volatile::write_reproducer): Likewise. (array_type::write_reproducer): Likewise. (function_type::write_reproducer): Likewise. (function_type::write_deferred_reproducer): Likewise. (field::write_reproducer): Likewise. (struct_::access_as_type): Likewise. (struct_::write_reproducer): Likewise. (union_::write_reproducer): Likewise. (union_::m_fields): Remove stray unused field. (fields::length): New accessor. (fields::get_field): New accessor. (fields::write_reproducer): New function. (rvalue::access_as_rvalue): Likewise. (lvalue::access_as_rvalue): Likewise. (lvalue::access_as_lvalue): Likewise. (param::access_as_rvalue): Likewise. (param::access_as_lvalue): Likewise. (param::write_reproducer): Likewise. (function::write_reproducer): Likewise. (block::write_reproducer): Likewise. (global::write_reproducer): Likewise. (memento_of_new_rvalue_from_const ::write_reproducer): Likewise. (memento_of_new_string_literal::write_reproducer): Likewise. (unary_op::write_reproducer): Likewise. (binary_op::write_reproducer): Likewise. (comparison::write_reproducer): Likewise. (cast::write_reproducer): Likewise. (call::write_reproducer): Likewise. (call_through_ptr::write_reproducer): Likewise. (array_access::write_reproducer): Likewise. (access_field_of_lvalue::write_reproducer): Likewise. (access_field_rvalue::write_reproducer): Likewise. (dereference_field_rvalue::write_reproducer): Likewise. (dereference_rvalue::write_reproducer): Likewise. (get_address_of_lvalue::write_reproducer): Likewise. (local::write_reproducer): Likewise. (eval::write_reproducer): Likewise. (assignment::write_reproducer): Likewise. (assignment_op::write_reproducer): Likewise. (comment::write_reproducer): Likewise. (conditional::write_reproducer): Likewise. (jump::write_reproducer): Likewise. (return_::write_reproducer): Likewise. * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New. * libgccjit.c (gcc_jit_context_new_location): Pass "true" as param "created_by_user". (gcc_jit_context_dump_reproducer_to_file): New API entrypoint. * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API entrypoint. * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API entrypoint. 2015-01-12 David Malcolm * jit-recording.c (class gcc::jit::rvalue_usage_validator): New. (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New ctor. (gcc::jit::rvalue_usage_validator::visit): New function. (gcc::jit::recording::rvalue::verify_valid_within_stmt): New function. (gcc::jit::recording::rvalue::set_scope): New function. (gcc::jit::recording::function::function): Call set_scope on each param, issuing errors for any params that already have a function. (gcc::jit::recording::block::add_eval): Return the new statement; update the comment given that some error-checking now happens after this returns. (gcc::jit::recording::block::add_assignment): Likewise. (gcc::jit::recording::block::add_assignment_op): Likewise. (gcc::jit::recording::block::add_comment): Likewise. (gcc::jit::recording::block::end_with_conditional): Likewise. (gcc::jit::recording::block::end_with_jump): Likewise. (gcc::jit::recording::block::end_with_return): Likewise. (gcc::jit::recording::block::validate): Add a comment. (gcc::jit::recording::unary_op::visit_children): New function. (gcc::jit::recording::binary_op::visit_children): New function. (gcc::jit::recording::comparison::visit_children): New function. (gcc::jit::recording::cast::visit_children): New function. (gcc::jit::recording::call::visit_children): New function. (gcc::jit::recording::call_through_ptr::visit_children): New function. (gcc::jit::recording::array_access::visit_children): New function. (gcc::jit::recording::access_field_of_lvalue::visit_children): New function. (gcc::jit::recording::access_field_rvalue::visit_children): New function. (gcc::jit::recording::dereference_field_rvalue::visit_children): New function. (gcc::jit::recording::dereference_rvalue::visit_children): New function. (gcc::jit::recording::get_address_of_lvalue::visit_children): New function. * jit-recording.h: Within namespace gcc::jit::recording... (class rvalue_visitor): New. (rvalue::rvalue): Initialize m_scope. (rvalue::get_loc): New accessor. (rvalue::verify_valid_within_stmt): New function. (rvalue::visit_children): New pure virtual function. (rvalue::set_scope): New function. (rvalue::get_scope): New function. (rvalue::dyn_cast_param): New function. (rvalue::m_scope): New field. (param::visit_children): New empty function. (param::dyn_cast_param): New function. (function::get_loc): New function. (block::add_eval): Return the new statement. (block::add_assignment): Likewise. (block::add_assignment_op): Likewise. (block::add_comment): Likewise. (block::end_with_conditional): Likewise. (block::end_with_jump): Likewise. (block::end_with_return): Likewise. (global::visit_children): New function. (memento_of_new_rvalue_from_const::visit_children): New function. (memento_of_new_string_literal::visit_children): New function. (unary_op::visit_children): New function. (binary_op::visit_children): New function. (comparison::visit_children): New function. (cast::visit_children): New function. (call::visit_children): New function. (call_through_ptr::visit_children): New function. (array_access::visit_children): New function. (access_field_of_lvalue::visit_children): New function. (access_field_rvalue::visit_children): New function. (dereference_field_rvalue::visit_children): New function. (dereference_rvalue::visit_children): New function. (get_address_of_lvalue::visit_children): New function. (local::local): Call set_scope. (local::visit_children): New function. (statement::get_block): Make public. * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro. (RETURN_NULL_IF_FAIL_PRINTF5): New macro. (gcc_jit_context_new_function): Verify that each param has not yet been used for creating another function. (gcc_jit_block_add_eval): After creating the stmt, verify that the rvalue expression tree is valid to use within it. (gcc_jit_block_add_assignment): Likewise for the lvalue and rvalue expression trees. (gcc_jit_block_add_assignment_op): Likewise. (gcc_jit_block_end_with_conditional): Likewise for the boolval expression tree. (gcc_jit_block_end_with_return): Likewise for the rvalue expression tree. (gcc_jit_block_end_with_void_return): Remove return of "void", now that block::end_with_return is now non-void. 2015-01-12 David Malcolm * jit-playback.c (gcc::jit::playback::context::read_dump_file): Add missing fclose on error-handling path. 2015-01-12 David Malcolm * 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. * docs/_build/texinfo/libgccjit.texi: Regenerate. * 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. 2015-01-09 David Malcolm * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h", "symtab.h", "inchash.h". Move include of "hash-set.h" much earlier. * jit-builtins.c: Remove redundant includes of "opts.h" and "tree.h". * jit-common.h: Include "hash-set.h", "input.h", "vec.h", "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h". * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h", "statistics.h", "vec.h", "double-int.h", "real.h", "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h", "inchash.h", "fold-const.h". Move include of "hash-set.h" to earlier. * jit-recording.c: Remove redundant includes of "opts.h" and "tree.h". 2015-01-09 David Malcolm * docs/cp/topics/expressions.rst (Simple expressions): Use ":c:type:" for C types. Document new overload of gcc::jit::context::new_rvalue. * docs/topics/expressions.rst (Simple expressions): Use ":c:type:" for C types. Document new entrypoint gcc_jit_context_new_rvalue_from_long. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c: Within namespace gcc::jit::playback... (context::new_rvalue_from_int): Eliminate in favor of... (context::new_rvalue_from_const ): ...this. (context::new_rvalue_from_double): Eliminate in favor of... (context::new_rvalue_from_const ): ...this. (context::new_rvalue_from_const ): New. (context::new_rvalue_from_ptr): Eliminate in favor of... (context::new_rvalue_from_const ): ...this. * jit-playback.h: Within namespace gcc::jit::playback... (context::new_rvalue_from_int): Eliminate in favor of... (context::new_rvalue_from_const ): ...this. (context::new_rvalue_from_double): Likewise. (context::new_rvalue_from_ptr): Likewise. * jit-recording.c: Within namespace gcc::jit::recording... (context::new_rvalue_from_int): Eliminate. (context::new_rvalue_from_double): Likewise. (context::new_rvalue_from_ptr): Likewise. (class memento_of_new_rvalue_from_const ): Add explicit specialization. (class memento_of_new_rvalue_from_const ): Likewise. (class memento_of_new_rvalue_from_const ): Likewise. (class memento_of_new_rvalue_from_const ): Likewise. (memento_of_new_rvalue_from_int::replay_into): Generalize into... (memento_of_new_rvalue_from_const ::replay_into): ...this... (memento_of_new_rvalue_from_double::replay_into): ...allowing this... (memento_of_new_rvalue_from_ptr::replay_into): ...and this to be deleted. (memento_of_new_rvalue_from_int::make_debug_string): Convert to... (memento_of_new_rvalue_from_const ::make_debug_string): ...this. (memento_of_new_rvalue_from_double::make_debug_string): Convert to... (memento_of_new_rvalue_from_const ::make_debug_string): ...this. (memento_of_new_rvalue_from_ptr::make_debug_string) Convert to... (memento_of_new_rvalue_from_const ::make_debug_string): ...this. (memento_of_new_rvalue_from_const ::make_debug_string): New function. * jit-recording.h: Within namespace gcc::jit::recording... (context::new_rvalue_from_int): Eliminate. (context::new_rvalue_from_double): Likewise. (context::new_rvalue_from_ptr): Likewise, all in favor of... (context::new_rvalue_from_const ): New family of methods. (class memento_of_new_rvalue_from_int): Eliminate. (class memento_of_new_rvalue_from_double): Likewise. (class memento_of_new_rvalue_from_ptr): Likewise. (class memento_of_new_rvalue_from_const ): New family of rvalue subclasses. * libgccjit++.h (gccjit::context::new_rvalue): New overload, for "long". * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for rewriting of recording::context::new_rvalue_from_int to recording::context::new_rvalue_from_const . (gcc_jit_context_new_rvalue_from_long): New API entrypoint. (gcc_jit_context_new_rvalue_from_double): Update for rewriting of recording::context::new_rvalue_from_double to recording::context::new_rvalue_from_const . (gcc_jit_context_new_rvalue_from_ptr): Update for rewriting of recording::context::new_rvalue_from_ptr to recording::context::new_rvalue_from_const . * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API entrypoint. * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise. 2015-01-09 David Malcolm PR jit/64206 * docs/internals/test-hello-world.exe.log.txt: Update, the log now shows tempdir creation/cleanup. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir to the list of subclasses in the comment. * jit-playback.c (gcc::jit::playback::context::context): Add a comment clarifying when the tempdir gets cleaned up. (gcc::jit::playback::context::compile): Pass the context's logger, if any, to the tempdir. (gcc::jit::playback::context::dlopen_built_dso): When creating the gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand over ownership of the tempdir to it. * jit-result.c: Include "jit-tempdir.h". (gcc::jit::result::result): Add tempdir param, saving it as m_tempdir. (gcc::jit::result::~result): Delete m_tempdir. * jit-result.h (gcc::jit::result::result): Add tempdir param. (gcc::jit::result::m_tempdir): New field. * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param; add JIT_LOG_SCOPE. (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit, and log m_path_template and m_path_tempdir. (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log entry/exit, and log the unlink and rmdir calls. * jit-tempdir.h: Include "jit-logging.h". (class gcc::jit::tempdir): Make this be a subclass of log_user. (gcc::jit::tempdir::tempdir): Add logger param. * notes.txt: Update to show the two possible places where the tempdir can be cleaned up. 2015-01-08 David Malcolm * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive comment. 2015-01-08 David Malcolm * docs/topics/contexts.rst (Error-handling): Document new entrypoint gcc_jit_context_get_last_error. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-recording.c (gcc::jit::recording::context::context): Initialize new fields "m_last_error_str" and "m_owns_last_error_str". (gcc::jit::recording::context::~context): Clean up m_last_error_str, if needed. (gcc::jit::recording::context::add_error_va): Update m_last_error_str and m_owns_last_error_str, freeing the old value if appropriate. (gcc::jit::recording::context::get_last_error): New function. * jit-recording.h (gcc::jit::recording::context::get_last_error): New function. (gcc::jit::recording::context): New fields m_last_error_str and m_owns_last_error_str. * libgccjit.c (gcc_jit_context_get_last_error): New function. * libgccjit.h (gcc_jit_context_get_last_error): New declaration. * libgccjit.map (gcc_jit_context_get_last_error): New function. 2015-01-08 David Malcolm * Make-lang.in (jit_OBJS): Add jit/jit-logging.o. * docs/internals/index.rst (Overview of code structure): Mention gcc_jit_context_set_logfile, and embed the example logfile. * docs/internals/test-hello-world.exe.log.txt: New file: example of a logfile. * docs/topics/contexts.rst (Debugging): Add documentation for gcc_jit_context_set_logfile. * docs/_build/texinfo/libgccjit.texi: Regenerate. * dummy-frontend.c: Include "jit-logging.h". (jit_langhook_init): Assert that there is an active playback context. If it has a logger, log entry/exit to this function. (jit_langhook_write_globals): Likewise. * jit-common.h (gcc::jit::logger): New forward declaration. * jit-logging.c: New file. * jit-logging.h: New file. * jit-playback.c: Include "jit-logging.h". (gcc::jit::playback::context::context): Initialize the log_user base class from the recording context's logger (if any). Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::playback::build_stmt_list): Likewise. (gcc::jit::playback::function::postprocess): Likewise. (gcc::jit::playback::context::compile): Likewise. Log the entry/exit to toplev::main and toplev::finalize. Log the fake argv passed to toplev::main. (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::playback::context::release_mutex): Likewise. (gcc::jit::playback::context::make_fake_args): Likewise. (gcc::jit::playback::context::extract_any_requested_dumps): Likewise. (gcc::jit::playback::context::convert_to_dso): Likewise. Also, log the arguments that the driver is invoked with. (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass the logger to the result object. (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::playback::context::dump_generated_code): Likewise. (gcc::jit::playback::context::handle_locations): Likewise. * jit-playback.h (gcc::jit::playback::context): Make this be a subclass of gcc::jit::log_user. * jit-recording.c: Include "jit-logging.h". (gcc::jit::recording::context::context: Initialize the logger to NULL for root contexts, or to the parent's logger for child contexts. (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::recording::context::replay_into): Likewise. (gcc::jit::recording::context::disassociate_from_playback): Likewise. (gcc::jit::recording::context::compile): Likewise. (recording::context::add_error_va): Likewise. Also, log the error. (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to log entry/exit from the function body. * jit-recording.h: Include "jit-logging.h". (gcc::jit::recording::context): Make this be a subclass of gcc::jit::log_user. * jit-result.c: Include "jit-common.h" and "jit-logging.h". (gcc::jit::result::result): Add logger param, recording it. Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to log entry/exit from the function body. (gcc::jit::result::get_code): Likewise. * jit-result.h (gcc::jit::result): Make this be a subclass of gcc::jit::log_user. (gcc::jit::result::result): Add logger parameter. * libgccjit++.h (gccjit::context::set_logfile): New function. * libgccjit.c: Include "jit-logging.h". (gcc_jit_context_acquire): Log the context. (gcc_jit_context_release): Use JIT_LOG_FUNC to log entry/exit from the function body, and log the context. (gcc_jit_context_new_child_context): Likewise, logging both contexts. (gcc_jit_context_new_location): Use JIT_LOG_FUNC to log entry/exit from the function body. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_context_new_opaque_struct): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_context_new_param): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_context_get_builtin_function): Likewise. (gcc_jit_function_get_param): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_function_new_block): Likewise. (gcc_jit_context_new_global): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_zero): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_new_rvalue_from_ptr): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (gcc_jit_context_new_unary_op): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (gcc_jit_context_new_call_through_ptr): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_context_new_array_access): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (gcc_jit_block_add_assignment_op): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. Also log the context, and the result. (gcc_jit_context_dump_to_file): Likewise. (gcc_jit_context_set_logfile): New function. (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to log entry/exit from the function body. (gcc_jit_result_get_code): Likewise. Also log the fnname) and the ptr to be returned. (gcc_jit_result_release): Likewise. Also log the result. * libgccjit.h: Include , since we need FILE *. (gcc_jit_context_set_logfile): New declaration. * libgccjit.map (gcc_jit_context_set_logfile): New. 2015-01-07 David Malcolm * jit-recording.h (gcc::jit::recording::type::is_void): New virtual function. (gcc::jit::recording::memento_of_get_type::is_void): New function, overriding default implementation. * libgccjit.c (gcc_jit_rvalue_dereference): Verify that the underlying type is not "void". 2015-01-07 David Malcolm * docs/topics/expressions.rst (Unary Operations): Add GCC_JIT_UNARY_OP_ABS. * jit-playback.c (gcc::jit::playback::context::new_unary_op): Likewise. * jit-recording.c (unary_op_strings): Likewise. * libgccjit.c (gcc_jit_context_new_unary_op): Update checking of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS. * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-01-07 David Malcolm * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix typo in comment. 2015-01-07 David Malcolm * TODO.rst (Test suite): Remove item about running C++ testcases. * docs/internals/index.rst (Working on the JIT library): Add "c++" to the enabled languages in the suggested "configure" invocation, and add a description of why this is necessary. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-01-07 David Malcolm * docs/internals/index.rst: Update to reflect that built testcases are now test-foo.c.exe, rather than test-foo.exe. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2015-01-05 Jakub Jelinek Update copyright years. 2014-12-19 David Malcolm * jit-playback.c (gcc::jit::playback::context::build_cast): In case BOOLEAN_TYPE, don't assume that the source expression is of type "int". 2014-12-19 David Malcolm * jit-recording.c (gcc::jit::recording::context::context): When copying string options from a parent context, take a copy of the underlying buffers, rather than simply copying the pointer. 2014-12-19 David Malcolm * jit-recording.c (gcc::jit::recording::context::set_str_option): Handle NULL. 2014-12-11 David Malcolm * docs/cp/topics/contexts.rst (gccjit::context::set_str_option): Document new function. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2014-12-10 Ulrich Drepper Minor interface cleanups of libgccjit * jit-playback.c (convert_to_dso): Use auto_vec instead of automatic array to build up command line. * jit-recording.c (recording::context::set_str_option): Make copy of the string. (recording::context::~context): Free string options. * jit-recording.h (recording::context): Adjust type of m_str_options member. * libgccjit.h: Adjust comment about gcc_jit_context_set_str_option parameter being used after the call. Update comment now that all interfaces are copy strings if necessary. * libgccjit++.h (gccjit::context): Add set_str_option member function. 2014-12-10 David Malcolm * docs/cp/index.rst: New file. * docs/cp/intro/index.rst: New file. * docs/cp/intro/tutorial01.rst: New file. * docs/cp/intro/tutorial02.rst: New file. * docs/cp/intro/tutorial03.rst: New file. * docs/cp/intro/tutorial04.rst: New file. * docs/cp/topics/contexts.rst: New file. * docs/cp/topics/expressions.rst: New file. * docs/cp/topics/functions.rst: New file. * docs/cp/topics/index.rst: New file. * docs/cp/topics/locations.rst: New file. * docs/cp/topics/objects.rst: New file. * docs/cp/topics/results.rst: New file. * docs/cp/topics/types.rst: New file. * docs/examples/tut01-hello-world.cc: New file. * docs/examples/tut02-square.c: Fix missing newline in output. * docs/examples/tut02-square.cc: New file. * docs/examples/tut03-sum-of-squares.cc: New file. * docs/examples/tut04-toyvm/toyvm.cc: New file. * docs/index.rst: Move summary to above the table of contents. Add text about the C vs C++ APIs. * docs/topics/contexts.rst: Fix a typo. * docs/_build/texinfo/libgccjit.texi: Regenerate. * docs/_build/texinfo/factorial1.png: New file. * docs/_build/texinfo/sum-of-squares1.png: New file. 2014-12-09 David Malcolm * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move logic for determine "funcname" to new function... (get_function_name): ...here, adding logic to skip any leading path from the filename. (toyvm_function_parse): Use the filename for fn_filename, rather than "name", so that the debugger can locate the source .toy file. (toyvm_function_parse): Don't fclose a NULL FILE *. 2014-12-09 David Malcolm PR jit/63854 * docs/internals/index.rst (Running under valgrind): New subsection. (docs/_build/texinfo/libgccjit.texi): Regenerate. 2014-12-09 David Malcolm PR jit/64206 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o. * jit-common.h (gcc::jit::tempdir): New forward decl. * jit-playback.c: Include jit-tempdir.h. (gcc::jit::playback::context::context): Initialize m_tempdir. (gcc::jit::playback::context::~context): Move tempdir cleanup to new file jit-tempdir.c (make_tempdir_path_template): Move to new file jit-tempdir.c. (gcc::jit::playback::context::compile): Move tempdir creation to new tempdir object in new file jit-tempdir.c. (gcc::jit::playback::context::make_fake_args): Get path from tempdir object rather than from member data. (gcc::jit::playback::context::convert_to_dso): Likewise. (gcc::jit::playback::context::dlopen_built_dso): Likewise. (gcc::jit::playback::context::dump_generated_code): Likewise. (gcc::jit::playback::context::get_path_c_file): New function. (gcc::jit::playback::context::get_path_s_file): New function. (gcc::jit::playback::context::get_path_so_file): New function. * jit-playback.h (gcc::jit::playback::context::get_path_c_file): New function. (gcc::jit::playback::context::get_path_s_file): New function. (gcc::jit::playback::context::get_path_so_file): New function. (gcc::jit::playback::context): Move fields "m_path_template", "m_path_tempdir", "m_path_c_file", "m_path_s_file", "m_path_so_file" to new jit::tempdir class; add field "m_tempdir". * jit-tempdir.c: New file. * jit-tempdir.h: New file. 2014-12-09 David Malcolm * jit-playback.c (gcc::jit::playback::context::compile): Acquire the mutex here, immediately before using toplev, and release it here, on each exit path after acquisition. (jit_mutex): Move this variable here, from jit-recording.c. (gcc::jit::playback::context::acquire_mutex): New function, based on code in jit-recording.c. (gcc::jit::playback::context::release_mutex): Likewise. * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New function. (gcc::jit::playback::context::release_mutex): New function. * jit-recording.c (jit_mutex): Move this variable to jit-playback.c. (gcc::jit::recording::context::compile): Move mutex-handling from here into jit-playback.c's gcc::jit::playback::context::compile. * notes.txt: Update to show the new locations of ACQUIRE_MUTEX and RELEASE_MUTEX. 2014-12-09 David Malcolm * jit-playback.c (gcc::jit::playback::context::compile): Move the dlopen code into... (gcc::jit::playback::context::dlopen_built_dso): ...this new function. * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso): New function. 2014-12-09 David Malcolm PR jit/64166 * docs/topics/contexts.rst (Debugging): Add description of gcc_jit_context_enable_dump. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c: Include context.h. (class auto_argvec): New class. (auto_argvec::~auto_argvec): New function. (gcc::jit::playback::context::compile): Convert fake_args to be an auto_argvec, so that it can contain dynamically-allocated strings. Construct a vec of all requested dumps, and pass it to make_fake_args. Extract requested dumps between the calls to toplev::main and toplev::finalize. (gcc::jit::playback::context::make_fake_args): Convert param "argvec" to be a vec , and gain a "requested_dumps" param. Convert to dynamically-allocated arg strings by converting ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP for args that are already a copy. Add args for all requested dumps. (gcc::jit::playback::context::extract_any_requested_dumps): New function. (gcc::jit::playback::context::read_dump_file): New function. * jit-playback.h (gcc::jit::playback::context::make_fake_args): Convert param "argvec" to be a vec , and gain a "requested_dumps" param. (gcc::jit::playback::context::extract_any_requested_dumps): New function. (gcc::jit::playback::context::read_dump_file): New function. * jit-recording.c (gcc::jit::recording::context::enable_dump): New function. (gcc::jit::recording::context::get_all_requested_dumps): New function. * jit-recording.h (gcc::jit::recording::requested_dump): New struct. (gcc::jit::recording::context::enable_dump): New function. (gcc::jit::recording::context::get_all_requested_dumps): New function. (gcc::jit::recording::context::m_requested_dumps): New field. * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint. * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint. * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint. 2014-12-08 David Malcolm * libgccjit++.h: Indent the forward declarations of the classes to show the inheritance hierarchy. 2014-12-08 David Malcolm * notes.txt: Show the beginning and ending of recording::context::compile vs playback::context::compile. Show the creation and unlinking of the tempdir. Show toplev::finalize. Move "RELEASE MUTEX" to the correct location. Show gcc_jit_result_release, and indicate where the dlopen/dlsym/dlclose occur. 2014-12-01 David Malcolm * docs/examples/tut02-square.c (main): Release the context earlier, to show that this is possible. Update error-handling to avoid a double-release of the context, and to avoid releasing a NULL result. * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release. * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize * docs/topics/results.rst (gcc_jit_result): Mention that this controls the lifetimes of machine code functions. (gcc_jit_result_get_code): Spell out the requirements for this to succeed, and the lifetime of the result. (gcc_jit_result_release): Mention that this invalidates any code that was obtained from the result. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2014-12-01 David Malcolm PR jit/64018 * docs/intro/tutorial02.rst: Spell out lifetime of generated code. Add description of error-handling, taken in part from... * docs/topics/contexts.rst (Error-handling): Expand, and move some content to tutorial02.rst. * docs/_build/texinfo/libgccjit.texi: Regenerate. 2014-12-01 David Malcolm PR jit/64020 * docs/topics/types.rst (Standard types) Add new enum values to the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE. Widen the left-hand column so that GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-builtins.c: Include stringpool.h and jit-playback.h. Move everything out of the gcc::jit::recording namespace into just gcc::jit. (struct builtin_data): Add fields "fnclass", "attr", and "implicit_p". (DEF_BUILTIN): Update macro so populate the new fields. (builtins_manager::builtins_manager): Update for move out of recording namespace. Initialize the m_attributes array. (builtins_manager::get_builtin_function): Likewise. (builtins_manager::get_builtin_function_by_id): New function. (builtins_manager::make_builtin_function): Update for move out of recording namespace. Add fix for PR jit/64020 by detecting specific builtin ids and having them ensure that builtins for other ids are created as necessary. (builtins_manager::get_type): Update for move out of recording namespace. (builtins_manager::make_type): Likewise. Add some missing #undefs. (builtins_manager::make_primitive_type): Update for move out of recording namespace. Implement the three BT_COMPLEX_ cases and BT_DOUBLE_PTR. (builtins_manager::make_fn_type): Update for move out of recording namespace. (builtins_manager::make_ptr_type): Likewise. (builtins_manager::finish_playback): New function. (builtins_manager::get_class): New function. (builtins_manager::implicit_p): New function. (builtins_manager::get_attrs_tree): Two new functions. (builtins_manager::make_attrs_tree): New function. * jit-builtins.h: Move everything out of the gcc::jit::recording namespace into just gcc::jit. (enum built_in_attribute): New. (builtins_manager::builtins_manager): Update decl for namespace change. (builtins_manager::get_builtin_function): Likewise. (builtins_manager::get_class): New. (builtins_manager::implicit_p): New. (builtins_manager::get_attrs_tree): Two new functions. (builtins_manager::make_attrs_tree): New function. (builtins_manager::finish_playback): New. (builtins_manager::get_builtin_function_by_id): New. (builtins_manager::make_builtin_function): Update decl for namespace change. (builtins_manager::get_type): Likewise. (builtins_manager::make_type): Likewise. (builtins_manager::make_primitive_type): Likewise. (builtins_manager::make_fn_type): Likewise. (builtins_manager::make_ptr_type): Likewise. (builtins_manager): Likewise for fields. Add new field "m_attributes". * jit-common.h (NUM_GCC_JIT_TYPES): Update. (builtins_manager): Update forward decl to reflect namespace change. * jit-playback.c: Include attribs.h and jit-builtins.h. (gcc::jit::playback::context::get_tree_node_for_type): Add cases for the new COMPLEX_ types. (gcc::jit::playback::context::new_function): If creating a builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl, and call set_builtin_decl. (gcc::jit::playback::context::replay): If we have a builtins_manager, call its finish_playback method when we're done. * jit-playback.h: (gcc::jit::playback::context::get_builtins_manager): New function. * jit-recording.c (gcc::jit::recording::context::get_builtins_manager): New function. (gcc::jit::recording::get_builtin_function): Use get_builtins_manager, in case we're a child context. (gcc::jit::recording::memento_of_get_type::dereference): Add the COMPLEX_ types. (gcc::jit::recording::memento_of_get_type::is_int): Likewise. (gcc::jit::recording::memento_of_get_type::is_float): Likewise. (gcc::jit::recording::memento_of_get_type::is_bool): Likewise. (get_type_strings): Likewise. * jit-recording.h (gcc::jit::recording::context::get_builtins_manager): New. * libgccjit.h (enum gcc_jit_types): Add GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE. 2014-12-01 David Malcolm * jit-builtins.c (gcc::jit::recording::builtins_manager::get_builtin_function): Check for NULL return from make_builtin_function. (gcc::jit::recording::builtins_manager::make_builtin_function): Check for NULL return from get_type. 2014-12-01 David Malcolm * jit-playback.c (gcc::jit::playback::context::compile): Move DSO creation code into... (gcc::jit::playback::context::convert_to_dso): New function. * jit-playback.h (gcc::jit::playback::context::convert_to_dso): New function. 2014-12-01 David Malcolm * jit-playback.c (gcc::jit::playback::context::compile): Use an auto_vec rather than a const char *[20] for the top-level argv, and move the logic to build it to... (gcc::jit::playback::context::make_fake_args): New function. * jit-playback.h (gcc::jit::playback::context::make_fake_args): New function. 2014-12-01 David Malcolm * Make-lang.in (jit_OBJS): Add jit/jit-result.o. * jit-playback.c: Include new header jit-result.h. (gcc::jit::result::result): Move to new file jit-result.c. (gcc::jit::result::~result): Likewise. (gcc::jit::playback::result): Likewise. * jit-recording.h (class gcc::jit::result): Move to new header jit-result.h. * jit-result.c: New file, to contain... (gcc::jit::result::result): Move here from jit-playback.c, removing erroneous "playback" namespace from comment. (gcc::jit::result::~result): Likewise. (gcc::jit::playback::result): Likewise. * jit-result.h: New file, to contain... (class gcc::jit::result): Move from jit-recording.h. * libgccjit.c: Include jit-result.h. (gcc_jit_result_get_code): Update comment to reflect move of implementation. (gcc_jit_result_release): Likewise. 2014-12-01 David Malcolm PR jit/63854 * docs/examples/tut04-toyvm/toyvm.c (toyvm_compiled_function): New typedef. (toyvm_compiled_func) Rename to... (toyvm_compiled_code) ...this. (struct toyvm_compiled_function): New struct. (toyvm_function_compile): Return a toyvm_compiled_function * rather than a toyvm_compiled_func, so that the caller can fully clean things up. Free "funcname". (test_script): Update for change to toyvm_function_compile. Clean up the toyvm_compiled_function. (main): Likewise. (docs/intro/tutorial04.rst): Update to reflect the above changes, and to better spell out the lifetime of the compiled code. 2014-12-01 David Malcolm PR jit/63854 * jit-builtins.c (gcc::jit::recording::builtins_manager::make_fn_type): Call the context's new_function_type method, rather than directly creating a function_type instance. * jit-recording.c (gcc::jit::recording::context::new_function_type): New method, adapted from part of... (gcc::jit::recording::context::new_function_ptr_type): ...this. Update to call new_function_type. * jit-recording.h (gcc::jit::recording::context::new_function_type): New method. 2014-12-01 David Malcolm PR jit/63969 * jit-playback.c: Ensure that ctxt_progname is non-NULL. 2014-11-19 David Malcolm PR jit/63854 * jit-playback.c (gcc::jit::playback::compound_type::set_fields): Convert param from const vec & to const auto_vec *. (gcc::jit::playback::context::new_function_type): Convert param "param_types" from vec * to const auto_vec *. (gcc::jit::playback::context::new_function): Convert param "params" from vec * to const auto_vec *. (gcc::jit::playback::context::build_call): Convert param "args" from vec to const auto_vec *. (gcc::jit::playback::context::new_call): Likewise. (gcc::jit::playback::context::new_call_through_ptr): Likewise. (wrapper_finalizer): New function. (gcc::jit::playback::wrapper::operator new): Call the finalizer variant of ggc_internal_cleared_alloc, supplying wrapper_finalizer. (gcc::jit::playback::function::finalizer): New. (gcc::jit::playback::block::finalizer): New. (gcc::jit::playback::source_file::finalizer): New. (gcc::jit::playback::source_line::finalizer): New. * jit-playback.h (gcc::jit::playback::context::new_function_type): Convert param "param_types" from vec * to const auto_vec *. (gcc::jit::playback::context::new_function): Convert param "params" from vec * to const auto_vec *. (gcc::jit::playback::context::new_call): Convert param "args" from vec to const auto_vec *. (gcc::jit::playback::context::new_call_through_ptr): Likewise. (gcc::jit::playback::context::build_call): Likewise. (gcc::jit::playback::context): Convert fields "m_functions", "m_source_files", "m_cached_locations" from vec to auto_vec. (gcc::jit::playback::wrapper::finalizer): New virtual function. (gcc::jit::playback::compound_type::set_fields): Convert param fro const vec & to const auto_vec *. (gcc::jit::playback::function::finalizer): New. (gcc::jit::playback::block::finalizer): New. (gcc::jit::playback::source_file::finalizer): New. (gcc::jit::playback::source_line::finalizer): New. * jit-recording.c (gcc::jit::recording::function_type::replay_into): Convert local from a vec into an auto_vec. (gcc::jit::recording::fields::replay_into): Likewise. (gcc::jit::recording::function::replay_into): Likewise. (gcc::jit::recording::call::replay_into): Likewise. (gcc::jit::recording::call_through_ptr::replay_into): Likewise. * jit-recording.h (gcc::jit::recording::context): Convert fields "m_mementos", "m_compound_types", "m_functions" from vec<> to auto_vec <>. (gcc::jit::recording::function_type::get_param_types): Convert return type from vec to const vec &. (gcc::jit::recording::function_type): Convert field "m_param_types" from a vec<> to an auto_vec<>. (gcc::jit::recording::fields): Likewise for field "m_fields". (gcc::jit::recording::function::get_params): Convert return type from vec to const vec &. (gcc::jit::recording::function): Convert fields "m_params", "m_locals", "m_blocks" from vec<> to auto_vec<>. (gcc::jit::recording::block): Likewise for field "m_statements". vec<> to auto_vec<>. (gcc::jit::recording::call): Likewise for field "m_args". (gcc::jit::recording::call_through_ptr): Likewise. 2014-11-19 David Malcolm PR jit/63854 * jit-recording.c (recording::function::validate): Convert "worklist" from vec<> to autovec<> to fix a leak. 2014-11-11 David Malcolm * ChangeLog.jit: New. * ChangeLog: New. * Make-lang.in: New. * TODO.rst: New. * config-lang.in: New. * docs/Makefile: New. * docs/_build/texinfo/Makefile: New. * docs/_build/texinfo/factorial.png: New. * docs/_build/texinfo/libgccjit.texi: New. * docs/_build/texinfo/sum-of-squares.png: New. * docs/conf.py: New. * docs/examples/tut01-hello-world.c: New. * docs/examples/tut02-square.c: New. * docs/examples/tut03-sum-of-squares.c: New. * docs/examples/tut04-toyvm/Makefile: New. * docs/examples/tut04-toyvm/factorial.toy: New. * docs/examples/tut04-toyvm/fibonacci.toy: New. * docs/examples/tut04-toyvm/toyvm.c: New. * docs/index.rst: New. * docs/internals/index.rst: New. * docs/intro/factorial.png: New. * docs/intro/index.rst: New. * docs/intro/sum-of-squares.png: New. * docs/intro/tutorial01.rst: New. * docs/intro/tutorial02.rst: New. * docs/intro/tutorial03.rst: New. * docs/intro/tutorial04.rst: New. * docs/topics/contexts.rst: New. * docs/topics/expressions.rst: New. * docs/topics/functions.rst: New. * docs/topics/index.rst: New. * docs/topics/locations.rst: New. * docs/topics/objects.rst: New. * docs/topics/results.rst: New. * docs/topics/types.rst: New. * dummy-frontend.c: New. * jit-builtins.c: New. * jit-builtins.h: New. * jit-common.h: New. * jit-playback.c: New. * jit-playback.h: New. * jit-recording.c: New. * jit-recording.h: New. * libgccjit++.h: New. * libgccjit.c: New. * libgccjit.h: New. * libgccjit.map: New. * notes.txt: New. 2013-07-26 David Malcolm * Initial creation Copyright (C) 2013-2016 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.