1. 05 Mar, 2015 1 commit
    • jit documentation fixes · 7ef96183
      gcc/jit/ChangeLog:
      	* 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.
      
      From-SVN: r221218
      David Malcolm committed
  2. 24 Feb, 2015 1 commit
    • [PR libgomp/64625] Remove __OFFLOAD_TABLE__ variable/formal parameter. · 56a9f6bc
      Fixup for r219836: adjust builtin function prototypes.
      
      	PR libgomp/64625
      	gcc/
      	* omp-builtins.def (BUILT_IN_GOACC_DATA_START): Specify as
      	BT_FN_VOID_INT_SIZE_PTR_PTR_PTR, not
      	BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR.
      	(BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_UPDATE): Specify as
      	BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_INT_INT_VAR, not
      	BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR.
      	(BUILT_IN_GOACC_PARALLEL): Specify as
      	BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR, not
      	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR.
      	* builtin-types.def
      	(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
      	(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
      	Remove function types.
      	(BT_FN_VOID_INT_SIZE_PTR_PTR_PTR)
      	(BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_INT_INT_VAR)
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
      	New function types.
      	gcc/ada/
      	* gcc-interface/utils.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.
      	gcc/c-family/
      	* c-common.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.
      	gcc/fortran/
      	* f95-lang.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.
      	* types.def (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
      	(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
      	Remove function types.
      	(BT_FN_VOID_INT_SIZE_PTR_PTR_PTR)
      	(BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_INT_INT_VAR)
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
      	New function types.
      	gcc/jit/
      	* 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.
      	gcc/lto/
      	* lto-lang.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.
      
      From-SVN: r220944
      Thomas Schwinge committed
  3. 04 Feb, 2015 2 commits
  4. 03 Feb, 2015 2 commits
    • jit: option-logging · 0ed4f017
      gcc/jit/ChangeLog:
      	* 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.
      
      From-SVN: r220375
      David Malcolm committed
    • PR jit/64810: driver, arm, jit: configure-time default options · 2cb844ce
      gcc/ChangeLog:
      	PR jit/64810
      	* Makefile.in (GCC_OBJS): Add gcc-main.o.
      	* gcc-main.c: New file, containing "main" taken from gcc.c.
      	* gcc.c (do_self_spec): Free decoded_options.
      	(class driver): Move declaration to gcc.h.
      	(main): Move declaration and implementation to new file
      	gcc-main.c.
      	(driver_get_configure_time_options): New function.
      	* gcc.h (class driver): Move this declaration here, from
      	gcc.c.
      	(driver_get_configure_time_options): New declaration.
      
      gcc/jit/ChangeLog:
      	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.
      
      From-SVN: r220373
      David Malcolm committed
  5. 02 Feb, 2015 1 commit
  6. 27 Jan, 2015 2 commits
    • toplev: gcc version information for jit · 53c04ec9
      gcc/ChangeLog:
      	* toplev.c (print_version): Add param "show_global_state", and
      	only print GGC and plugin information if it is true.
      	(init_asm_output): Pass in "true" for the new param when calling
      	print_version.
      	(process_options): Likewise.
      	(toplev::main): Likewise.
      	* toplev.h (print_version): Add new param to decl.
      
      gcc/jit/ChangeLog:
      	* docs/internals/test-hello-world.exe.log.txt: Add example version
      	lines.
      	* 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.
      
      From-SVN: r220190
      David Malcolm committed
    • Fix gcc_jit_context_get_last_error docs · dc44ee3a
      gcc/jit/ChangeLog:
      	* 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.
      	* 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.
      
      From-SVN: r220145
      David Malcolm committed
  7. 26 Jan, 2015 1 commit
  8. 23 Jan, 2015 1 commit
    • PR jit/64721: toplev: don't install signal-handlers when running within libgccjit · 6fc2d0f3
      gcc/ChangeLog:
      	PR jit/64721
      	* main.c (main): Construct toplev instances with init_signals=true.
      	* toplev.c (general_init): Add param "init_signals", and use it to
      	conditionalize the calls to signal and host_hooks.extra_signals.
      	(toplev::toplev): Add param "init_signals".
      	(toplev::main): When invoking general_init, pass m_init_signals
      	to control whether signal-handlers are installed.
      	* toplev.h (toplev::toplev): Add param "init_signals".
      	(toplev::m_init_signals): New field.
      
      gcc/jit/ChangeLog:
      	PR jit/64721
      	* jit-playback.c (gcc::jit::playback::context::compile): Construct
      	toplev instances with init_signals=false.
      
      From-SVN: r220045
      David Malcolm committed
  9. 20 Jan, 2015 1 commit
    • New jit API entrypoint: gcc_jit_context_compile_to_file · fdce7209
      gcc/jit/ChangeLog:
      	* 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.
      	* 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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/harness.h: Include <unistd.h>.
      	(CHECK_NO_ERRORS): New.
      	(verify_code): Wrap prototype in #ifndef TEST_COMPILING_TO_FILE.
      	(test_jit): Support new macro TEST_COMPILING_TO_FILE for exercising
      	gcc_jit_context_compile_to_file.
      	* jit.dg/jit.exp (fixed_host_execute): Fix the code for passing on
      	args to the spawned executable.
      	(jit-expand-vars): New function.
      	(jit-exe-params): New variable.
      	(dg-jit-set-exe-params): New function.
      	(jit-dg-test): Detect testcases that use
      	jit-verify-compile-to-file and call jit-setup-compile-to-file.
      	Set arguments of spawned process to jit-exe-params.
      	(jit-get-output-filename): New function.
      	(jit-setup-compile-to-file): New function.
      	(jit-verify-compile-to-file): New function.
      	(jit-run-executable): New function.
      	(jit-verify-executable): New function.
      	* jit.dg/test-compile-to-assembler.c: New testcase.
      	* jit.dg/test-compile-to-dynamic-library.c: New testcase.
      	* jit.dg/test-compile-to-executable.c: New testcase.
      	* jit.dg/test-compile-to-object.c: New testcase.
      
      From-SVN: r219876
      David Malcolm committed
  10. 19 Jan, 2015 1 commit
  11. 16 Jan, 2015 2 commits
    • Parallelize the jit testsuite · 499de348
      gcc/jit/ChangeLog:
      	* Make-lang.in (lang_checks_parallelized): Add "check-jit".
      	(check_jit_parallelize): Set this to an arbitrary value (10).
      
      From-SVN: r219774
      David Malcolm committed
    • jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of last argument. · e989e68d
      	* 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.
      @@ -334,6 +343,8 @@ builtins_manager::make_type (enum jit_bu
       #undef DEF_FUNCTION_TYPE_VAR_3
       #undef DEF_FUNCTION_TYPE_VAR_4
       #undef DEF_FUNCTION_TYPE_VAR_5
      +#undef DEF_FUNCTION_TYPE_VAR_8
      +#undef DEF_FUNCTION_TYPE_VAR_12
       #undef DEF_POINTER_TYPE
       
           default:
      
      From-SVN: r219744
      Jakub Jelinek committed
  12. 15 Jan, 2015 2 commits
  13. 13 Jan, 2015 1 commit
    • jit: New API entrypoint: gcc_jit_context_dump_reproducer_to_file · 86d0ac88
      gcc/jit/ChangeLog:
      	* 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 <int>::write_reproducer):
      	Likewise.
      	(memento_of_new_rvalue_from_const <long>::write_reproducer):
      	Likewise.
      	(memento_of_new_rvalue_from_const <double>::write_reproducer):
      	Likewise.
      	(memento_of_new_rvalue_from_const <void *>::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 <HOST_TYPE>::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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/harness.h (set_up_logging): Move string concatenation
      	into...
      	(concat_strings): New function.
      	(dump_reproducer): New function.
      	(test_jit): Call dump_reproducer.
      	* jit.dg/jit.exp (is_testcase_meant_to_generate_a_reproducer): New
      	function.
      	(jit-dg-test): Delete any generated reproducer from previous runs.
      	Verify that a generated reproducer was created, and verify that it
      	compiles.
      	* jit.dg/test-nested-contexts.c (main): Call
      	gcc_jit_context_dump_reproducer_to_file.
      
      From-SVN: r219564
      David Malcolm committed
  14. 12 Jan, 2015 3 commits
    • libgccjit: detect various kinds of errors relating to params and locals · f6f2b019
      gcc/jit/ChangeLog:
      	* 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<HOST_TYPE>::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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/test-error-local-used-from-other-function.c: New test
      	case.
      	* jit.dg/test-error-param-reuse.c: New test case.
      	* jit.dg/test-error-param-sharing.c: New test case.
      	* jit.dg/test-error-param-used-from-other-function.c: New test
      	case.
      	* jit.dg/test-error-param-used-without-a-function.c: New test
      	case.
      
      From-SVN: r219498
      David Malcolm committed
    • jit-playback.c: fix missing fclose · 1c35cc2c
      gcc/jit/ChangeLog:
      	* jit-playback.c (gcc::jit::playback::context::read_dump_file):
      	Add missing fclose on error-handling path.
      
      From-SVN: r219487
      David Malcolm committed
    • jit: API change to gcc_jit_context_new_global · 791cfef8
      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
      David Malcolm committed
  15. 09 Jan, 2015 3 commits
    • Fix the jit build after header flattening of r219402 · 860e981c
      gcc/jit/ChangeLog:
      	* 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".
      
      From-SVN: r219411
      David Malcolm committed
    • New jit API entrypoint: gcc_jit_context_new_rvalue_from_long · ccce3b2a
      gcc/jit/ChangeLog:
      	* 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 <int>): ...this.
      	(context::new_rvalue_from_double): Eliminate in favor of...
      	(context::new_rvalue_from_const <double>): ...this.
      	(context::new_rvalue_from_const <long>): New.
      	(context::new_rvalue_from_ptr): Eliminate in favor of...
      	(context::new_rvalue_from_const <void *>): ...this.
      	* jit-playback.h: Within namespace gcc::jit::playback...
      	(context::new_rvalue_from_int): Eliminate in favor of...
      	(context::new_rvalue_from_const <HOST_TYPE>): ...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 <int>):
      	Add explicit specialization.
      	(class memento_of_new_rvalue_from_const <long>):
      	Likewise.
      	(class memento_of_new_rvalue_from_const <double>):
      	Likewise.
      	(class memento_of_new_rvalue_from_const <void *>):
      	Likewise.
      	(memento_of_new_rvalue_from_int::replay_into):
      	Generalize into...
      	(memento_of_new_rvalue_from_const <HOST_TYPE>::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 <int>::make_debug_string):
      	...this.
      	(memento_of_new_rvalue_from_double::make_debug_string):
      	Convert to...
      	(memento_of_new_rvalue_from_const <double>::make_debug_string):
      	...this.
      	(memento_of_new_rvalue_from_ptr::make_debug_string)
      	Convert to...
      	(memento_of_new_rvalue_from_const <void *>::make_debug_string):
      	...this.
      	(memento_of_new_rvalue_from_const <long>::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 <HOST_TYPE>): 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 <HOST_TYPE>): 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 <int>.
      	(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 <double>.
      	(gcc_jit_context_new_rvalue_from_ptr): Update for
      	rewriting of recording::context::new_rvalue_from_ptr to
      	recording::context::new_rvalue_from_const <void *>.
      	* libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
      	entrypoint.
      	* libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/all-non-failing-tests.h: Add test-constants.c.
      	* jit.dg/test-combination.c (create_code): Likewise.
      	(verify_code): Likewise.
      	* jit.dg/test-constants.c: New test case.
      	* jit.dg/test-threads.c: Add test-constants.c.
      
      From-SVN: r219401
      David Malcolm committed
    • PR jit/64206: delay cleanup of tempdir if the user has requested debuginfo · d2286af3
      gcc/jit/ChangeLog:
      	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.
      
      From-SVN: r219395
      David Malcolm committed
  16. 08 Jan, 2015 4 commits
    • libgccjit.h: Fix description of struct gcc_jit_context · 7c8db13e
      gcc/jit/ChangeLog:
      	* libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
      	comment.
      
      From-SVN: r219366
      David Malcolm committed
    • jit: New API entrypoint: gcc_jit_context_get_last_error · 303e1d56
      gcc/jit/ChangeLog:
      	* 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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/test-error-block-in-wrong-function.c (verify_code):
      	Verify the result of gcc_jit_context_get_last_error.
      	* jit.dg/test-error-null-passed-to-api.c (verify_code): Likewise.
      
      From-SVN: r219363
      David Malcolm committed
    • New jit API entrypoint: gcc_jit_context_set_logfile · eb4c16eb
      gcc/jit/ChangeLog:
      	* 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 <stdio.h>, since we need FILE *.
      	(gcc_jit_context_set_logfile): New declaration.
      	* libgccjit.map (gcc_jit_context_set_logfile): New.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/harness.h (set_up_logging): New function.
      	(test_jit): Fail if gcc_jit_context_acquire fails.  Call
      	set_up_logging on the context, so that every testcase is
      	logged to a particular file.
      	* jit.dg/test-nested-contexts.c (main): Open a logfile,
      	and call gcc_jit_context_set_logfile on the top-level context.
      
      From-SVN: r219357
      David Malcolm committed
    • jit: Add checking for dereference of void * · c211cd23
      gcc/jit/ChangeLog:
      	* 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".
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/test-error-dereferencing-void-ptr.c: New test case.
      
      From-SVN: r219333
      David Malcolm committed
  17. 07 Jan, 2015 4 commits
    • API extension: add GCC_JIT_UNARY_OP_ABS to enum gcc_jit_unary_op · 18146f45
      gcc/jit/ChangeLog:
      	* 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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/test-expressions.c (make_tests_of_unary_ops): Add test of
      	GCC_JIT_UNARY_OP_ABS.
      	(verify_unary_ops): Likewise.
      
      From-SVN: r219321
      David Malcolm committed
    • Fix typo in jit-recording.h · 11af98ff
      gcc/jit/ChangeLog:
      	* jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
      	typo in comment.
      
      From-SVN: r219319
      David Malcolm committed
    • jit.exp: support C++ testcases · 433d16df
      gcc/jit/ChangeLog:
      	* 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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/jit.exp: Load wrapper.exp with %{tool} set to "g++"
      	rather than "jit".  Load g++.exp, and call g++_init.
      	Run test-*.cc files within the testsuite and *.cc files within
      	docs/examples.
      	(jit-dg-test): Drop the addition of -fgnu89-inline to
      	DEFAULT_CFLAGS in favor of adding it to additional_flags, only
      	doing it when compiling C testcases (since g++ does not handle
      	it).  Reset "orig_environment_saved" so that LD_LIBRARY_PATH
      	is restored to the value after g++_init ran, rather than the
      	value before g++_init ran.  Return a list of
      	$comp_output $output_file, as dg-test assumes.
      
      From-SVN: r219318
      David Malcolm committed
    • jit.exp: Don't drop the extension from the testcase when naming executable · 50bb6c8e
      gcc/jit/ChangeLog:
      	* 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.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/jit.exp (jit-dg-test): Remove "rootname" call when
      	generating name of built executable.
      
      From-SVN: r219312
      David Malcolm committed
  18. 05 Jan, 2015 1 commit
  19. 19 Dec, 2014 3 commits
  20. 11 Dec, 2014 3 commits
  21. 10 Dec, 2014 1 commit
    • Document libgccjit++.h · 29df5715
      gcc/jit/ChangeLog:
      	* 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.
      
      From-SVN: r218588
      David Malcolm committed