Introduce add_stmt helper method.

gcc/jit/
	* internal-api.h (gcc::jit::function::add_stmt): New.

	* internal-api.c (gcc::jit::function::add_eval): Replace use of
	tsi_link_stmt with call to add_stmt.
	(gcc::jit::function::add_assignment): Likewise.
	(gcc::jit::function::add_conditional): Likewise.
	(gcc::jit::function::place_forward_label): Likewise.
	(gcc::jit::function::add_jump): Likewise.
	(gcc::jit::function::add_return): Likewise.
Fix how locals are created; add BIND_EXPR

Attempting to add test coverage uncovered that locals weren't being
associated with their functions, leading to crashes later on in the
compile for various valid constructs.

To fix this, we now set the DECL_CONTEXT of locals to be the
FUNCTION_DECL.  To do so, we also need to put them within a BIND_EXPR
otherwise gimplify_var_or_parm_decl dies, with:
       !DECL_SEEN_IN_BIND_EXPR_P (decl)

Hence we now create a BIND_EXPR for every function with a body, moving
the statement list within it.

gcc/jit/
	* internal-api.h (gcc::jit::function): Add field
	"m_inner_bind_expr".
	* internal-api.c (gcc::jit::function::function): Create a BIND_EXPR
	for all non-imported functions, and put the statement list within
	it.
	(gcc::jit::function::gt_ggc_mx): Visit m_inner_bind_expr.
	(gcc::jit::function::new_local): Set the DECL_CONTEXT of the new
	local to be the function's BIND_EXPR, and prepend the new local
	to said BIND_EXPR's BIND_EXPR_VARS chain.
	(gcc::jit::function::postprocess): Set the DECL_SAVED_TREE of the
	FUNCTION_DECL to be the BIND_EXPR, rather than the statement list.
	The latter is now contained within the former.

gcc/testsuite/
	* jit.dg/test-reading-struct.c: New test, to provide test coverage
	of gcc_jit_type_get_const and gcc_jit_lvalue_access_field, in the
	process uncovering bugs in how locals were handled.
	* jit.dg/test-combination.c: Add usage of test-reading-struct.c.
Add GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE

Add a debug flag for dumping the generated assembler to stderr:
  GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE

This is technically an ABI change, since the value is added before
some existing values, but we don't yet guarantee an ABI.

gcc/jit/
	* libgccjit.h (enum gcc_jit_bool_option): New value:
	GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE.

	* internal-api.c (gcc::jit::context::compile): Call
	dump_generated_code if the user has requested it.
	(gcc::jit::context::dump_generated_code): New, copying
	from the .s file to stderr.

	* internal-api.h (gcc::jit::context::dump_generated_code): New.
Add contrib/jit-coverage-report.py

contrib/
	* jit-coverage-report.py: New file: a script to print crude
	code-coverage information for the libgccjit API.
Use access methods for context options

gcc/jit/
	* internal-api.h (gcc::jit::context::get_str_option): New access
	method.
	(gcc::jit::context::get_int_option): Likewise.

	* internal-api.c (gcc::jit::context::~context): Use access methods
	for options, rather than direct field access.
	(gcc::jit::context::compile): Likewise.
Support floating-point division; add test-quadratic.c

Add testcase test-quadratic.c, written to achieve test coverage of
gcc_jit_rvalue_access_field - with this commit, the test suite has at
least one call to every public symbol in the API.

In the process, I found that GCC_JIT_BINARY_OP_DIVIDE on
floating-point types would lead to a crash when expanding gimple to RTL,
since the use of TRUNC_DIV_EXPR requires integer args.  (Violating this
assumption led to a crash when the division by 2 was turned into a shift,
which the RTL expander assumes is on an integer).

Hence we update GCC_JIT_BINARY_OP_DIVIDE to internally pick either
RDIV_EXPR (floating point division) or TRUNC_DIV_EXPR (truncation towards
zero) based on the result-type of the binary op (my intent being to be
least-surprising to a C programmer).

gcc/jit/
	* libgccjit.h (enum gcc_jit_binary_op): We will use the result
	type to determine if GCC_JIT_BINARY_OP_DIVIDE should
	truncate towards zero, or be floating-point division.

	* internal-api.c (gcc::jit::context::new_binary_op): Likewise.

gcc/testsuite/
	* jit.dg/test-quadratic.c: New test case, written to achieve test
	coverage of gcc_jit_rvalue_access_field, but also exercising
	division of doubles.

	* jit.dg/test-combination.c: Add test-quadratic.c

	* jit.dg/test-expressions.c: Add TODOs.
Eliminate the code-creation callback

Eliminate the code-creation callback, so that clients can simply call the
API directly.

All "contextual" objects change from merely being "alive" during the
callback (and eventually garbage-collected) to having a lifetime equal to
that of the context they are created within, with automatic cleanup
when the context is released.

Internally this is implemented by having two parallel class-hierarchies:
the existing gcc::jit classes become gcc::jit::playback classes, plus a
new parallel hierarchy within a gcc::jit::recording namespace.  Calls to
the client API are recorded as jit::recording objects, and during
compilation are played back as jit::playback objects, which create GCC
trees.

This should let us play better with C++ exception-handling, and support
more interesting objects lifetimes of the kind discussed in
http://gcc.gnu.org/ml/jit/2014-q1/msg00001.html
(aka "Caching one-time startup (and GNU Octave JIT)")

gcc/
	* timevar.def: Replace TV_CLIENT_CALLBACK with TV_JIT_REPLAY.

gcc/jit/
	* libgccjit.h: Update comments to eliminate the code-creation
	callback.  All "contextual" objects change from merely being
	"alive" during the callback to having a lifetime equal to that
	of the context they are created within, with automatic cleanup
	when the context is released.
	(gcc_jit_code_callback): Delete.
	(gcc_jit_context_set_code_factory): Delete.

	* libgccjit.map (gcc_jit_context_set_code_factory): Delete.

	* dummy-frontend.c (my_walker): Update for rename of the singleton
	reference-owning context.
	(jit_langhook_parse_file): Rather than run a client-provided
	callback, we now replay a recording of the client activity.

	* internal-api.h (gcc::jit): Split the existing API into two
	copies...
	(gcc::jit::recording): ...a class hierarchy used to implement
	the client-facing API, which records the API calls made to it
	and...
	(gcc::jit::playback): ...a class hierarchy used within the
	dummy GCC frontend, which plays back the recorded API calls once
	GCC is initialized.

	* internal-api.c (gcc::jit::recording::playback_location): New
	API, in which client API calls are recorded as a list of "memento"
	objects, to be played back into GCC when the dummy frontend runs.
	(gcc::jit::recording::playback_string): Likewise.
	(gcc::jit::recording::playback_label): Likewise.
	(gcc::jit::recording::context::~context): Likewise.
	(gcc::jit::recording::context::replay_into): Likewise.
	(gcc::jit::recording::context::disassociate_from_playback): Likewise.
	(gcc::jit::recording::context::new_string): Likewise.
	(gcc::jit::recording::context::new_location): Likewise.
	(gcc::jit::recording::context::get_type): Likewise.
	(gcc::jit::recording::context::new_field): Likewise.
	(gcc::jit::recording::context::new_struct_type): Likewise.
	(gcc::jit::recording::context::new_param): Likewise.
	(gcc::jit::recording::context::new_function): Likewise.
	(gcc::jit::recording::context::new_global): Likewise.
	(gcc::jit::recording::context::new_rvalue_from_int): Likewise.
	(gcc::jit::recording::context::new_rvalue_from_double): Likewise.
	(gcc::jit::recording::context::new_rvalue_from_ptr): Likewise.
	(gcc::jit::recording::context::new_string_literal): Likewise.
	(gcc::jit::recording::context::new_unary_op): Likewise.
	(gcc::jit::recording::context::new_binary_op): Likewise.
	(gcc::jit::recording::context::new_comparison): Likewise.
	(gcc::jit::recording::context::new_call): Likewise.
	(gcc::jit::recording::context::new_array_lookup): Likewise.
	(gcc::jit::recording::string::string): Likewise.
	(gcc::jit::recording::string::~string): Likewise.
	(gcc::jit::recording::location::replay_into): Likewise.
	(gcc::jit::recording::type::get_pointer): Likewise.
	(gcc::jit::recording::type::get_const): Likewise.
	(gcc::jit::recording::memento_of_get_type::replay_into): Likewise.
	(gcc::jit::recording::memento_of_get_pointer::replay_into): Likewise.
	(gcc::jit::recording::memento_of_get_const::replay_into): Likewise.
	(gcc::jit::recording::field::replay_into): Likewise.
	(gcc::jit::recording::struct_::replay_into): Likewise.
	(gcc::jit::recording::rvalue::access_field): Likewise.
	(gcc::jit::recording::rvalue::dereference_field): Likewise.
	(gcc::jit::recording::rvalue::dereference): Likewise.
	(gcc::jit::recording::lvalue::access_field): Likewise.
	(gcc::jit::recording::lvalue::get_address): Likewise.
	(gcc::jit::recording::param::replay_into): Likewise.
	(gcc::jit::recording::function::function): Likewise.
	(gcc::jit::recording::function::replay_into): Likewise.
	(gcc::jit::recording::function::new_local): Likewise.
	(gcc::jit::recording::function::new_forward_label): Likewise.
	(gcc::jit::recording::function::add_eval): Likewise.
	(gcc::jit::recording::function::add_assignment): Likewise.
	(gcc::jit::recording::function::add_assignment_op): Likewise.
	(gcc::jit::recording::function::add_comment): Likewise.
	(gcc::jit::recording::function::add_conditional): Likewise.
	(gcc::jit::recording::function::add_label): Likewise.
	(gcc::jit::recording::function::place_forward_label): Likewise.
	(gcc::jit::recording::function::add_jump): Likewise.
	(gcc::jit::recording::function::add_return): Likewise.
	(gcc::jit::recording::function::new_loop): Likewise.
	(gcc::jit::recording::label::replay_into): Likewise.
	(gcc::jit::recording::global::replay_into): Likewise.
	(gcc::jit::recording::memento_of_new_rvalue_from_int::replay_into):
	Likewise.
	(gcc::jit::recording::memento_of_new_rvalue_from_double::replay_into):
	Likewise.
	(gcc::jit::recording::memento_of_new_rvalue_from_ptr::replay_into):
	Likewise.
	(gcc::jit::recording::memento_of_new_string_literal::replay_into):
	Likewise.
	(gcc::jit::recording::unary_op::replay_into): Likewise.
	(gcc::jit::recording::binary_op::replay_into): Likewise.
	(gcc::jit::recording::comparison::replay_into): Likewise.
	(gcc::jit::recording::call::call): Likewise.
	(gcc::jit::recording::call::replay_into): Likewise.
	(gcc::jit::recording::array_lookup::replay_into): Likewise.
	(gcc::jit::recording::access_field_of_lvalue::replay_into): Likewise.
	(gcc::jit::recording::access_field_rvalue::replay_into): Likewise.
	(gcc::jit::recording::dereference_field_rvalue::replay_into): Likewise.
	(gcc::jit::recording::dereference_rvalue::replay_into): Likewise.
	(gcc::jit::recording::get_address_of_lvalue::replay_into): Likewise.
	(gcc::jit::recording::local::replay_into): Likewise.
	(gcc::jit::recording::eval::replay_into): Likewise.
	(gcc::jit::recording::assignment::replay_into): Likewise.
	(gcc::jit::recording::assignment_op::replay_into): Likewise.
	(gcc::jit::recording::comment::replay_into): Likewise.
	(gcc::jit::recording::conditional::replay_into): Likewise.
	(gcc::jit::recording::place_label::replay_into): Likewise.
	(gcc::jit::recording::jump::replay_into): Likewise.
	(gcc::jit::recording::return_::replay_into): Likewise.
	(gcc::jit::recording::loop::replay_into): Likewise.
	(gcc::jit::recording::loop::end): Likewise.
	(gcc::jit::recording::loop_end::replay_into): Likewise.

	(gcc::jit::recording::context::set_str_option): Likewise.
	Option setting and error-handling is now "owned" by the recording
	context; the playback context delegates to the recording context
	for these aspects.
	(gcc::jit::recording::context::set_int_option): Likewise.
	(gcc::jit::recording::context::set_bool_option): Likewise.
	(gcc::jit::recording::context::compile): Likewise.
	(gcc::jit::recording::context::add_error): Likewise.
	(gcc::jit::recording::context::add_error_va): Likewise.
	(gcc::jit::recording::context::get_first_error): Likewise.

	(gcc::jit::context::context): Rename to...
	(gcc::jit::playback::context::context): ...this.
	(gcc::jit::context::~context): Rename to...
	(gcc::jit::playback::context::~context): ...this.
	(gcc::jit::context::gt_ggc_mx): Rename to...
	(gcc::jit::playback::context::gt_ggc_mx): ...this.

	(gcc::jit::context::set_code_factory): Eliminate.

	(gcc::jit::context::get_type): Rename to...
	(gcc::jit::playback::context::get_type): ...this.
	(gcc::jit::context::new_field): Rename to...
	(gcc::jit::playback::context::new_field): ...this.
	(gcc::jit::context::new_struct_type): Rename to...
	(gcc::jit::playback::context::new_struct_type): ...this, and
	update to require a vec<field *>.
	(gcc::jit::context::new_param): Rename to...
	(gcc::jit::playback::context::new_param): ...this.
	(gcc::jit::context::new_function): Rename to...
	(gcc::jit::playback::context::new_function): ...this, and update
	to require a vec<param *>.
	(gcc::jit::context::new_global): Rename to...
	(gcc::jit::playback::context::new_global): ...this.
	(gcc::jit::context::new_rvalue_from_int): Rename to...
	(gcc::jit::playback::context::new_rvalue_from_int): ...this.
	(gcc::jit::context::new_rvalue_from_double): Rename to...
	(gcc::jit::playback::context::new_rvalue_from_double): ...this.
	(gcc::jit::context::new_rvalue_from_ptr): Rename to...
	(gcc::jit::playback::context::new_rvalue_from_ptr): ...this.
	(gcc::jit::context::new_string_literal): Rename to...
	(gcc::jit::playback::context::new_string_literal): ...this.
	(gcc::jit::context::as_truth_value): Rename to...
	(gcc::jit::playback::context::as_truth_value): ...this.
	(gcc::jit::context::new_unary_op): Rename to...
	(gcc::jit::playback::context::new_unary_op): ...this.
	(gcc::jit::context::new_binary_op): Rename to...
	(gcc::jit::playback::context::new_binary_op): ...this.
	(gcc::jit::context::new_comparison): Rename to...
	(gcc::jit::playback::context::new_comparison): ...this.
	(gcc::jit::context::new_call): Rename to...
	(gcc::jit::playback::context::new_call): ...this, and update
	to require a vec<rvalue *>.
	(gcc::jit::context::new_array_lookup): Rename to...
	(gcc::jit::playback::context::new_array_lookup): ...this.
	(gcc::jit::context::new_field_access): Rename to...
	(gcc::jit::playback::context::new_field_access): ...this.
	(gcc::jit::context::new_dereference): Rename to...
	(gcc::jit::playback::context::new_dereference): ...this.

	(gcc::jit::lvalue::access_field): Rename to...
	(gcc::jit::playback::lvalue::access_field): ...this.
	(gcc::jit::lvalue::get_address): Rename to...
	(gcc::jit::playback::lvalue::get_address): ...this.

	(gcc::jit::rvalue::dereference_field): Rename to...
	(gcc::jit::playback::rvalue::dereference_field): ...this.

	(gcc::jit::rvalue::dereference): Rename to...
	(gcc::jit::playback::rvalue::dereference): ...this.

	(gcc::jit::wrapper::operator new): Rename to...
	(gcc::jit::playback::wrapper::operator new): ...this.

	(gcc::jit::function::function): Rename to...
	(gcc::jit::playback::function::function): ...this.
	(gcc::jit::function::gt_ggc_mx): Rename to...
	(gcc::jit::playback::function::gt_ggc_mx): ...this.
	(gcc::jit::function::get_return_type_as_tree): Rename to...
	(gcc::jit::playback::function::get_return_type_as_tree): ...this.
	(gcc::jit::function::new_local): Rename to...
	(gcc::jit::playback::function::new_local): ...this.
	(gcc::jit::function::new_forward_label): Rename to...
	(gcc::jit::playback::function::new_forward_label): ...this.
	(gcc::jit::function::postprocess): Rename to...
	(gcc::jit::playback::function::postprocess): ...this.
	(gcc::jit::function::add_eval): Rename to...
	(gcc::jit::playback::function::add_eval): ...this.
	(gcc::jit::function::add_assignment): Rename to...
	(gcc::jit::playback::function::add_assignment): ...this.
	(gcc::jit::function::add_comment): Rename to...
	(gcc::jit::playback::function::add_comment): ...this.
	(gcc::jit::function::add_conditional): Rename to...
	(gcc::jit::playback::function::add_conditional): ...this.
	(gcc::jit::function::add_label): Rename to...
	(gcc::jit::playback::function::add_label): ...this.
	(gcc::jit::function::place_forward_label): Rename to...
	(gcc::jit::playback::function::place_forward_label): ...this.
	(gcc::jit::function::add_jump): Rename to...
	(gcc::jit::playback::function::add_jump): ...this.
	(gcc::jit::function::add_return): Rename to...
	(gcc::jit::playback::function::add_return): ...this.
	(gcc::jit::function::new_loop): Rename to...
	(gcc::jit::playback::function::new_loop): ...this.

	(gcc::jit::label::label): Rename to...
	(gcc::jit::playback::label::label): ...this.

	(gcc::jit::loop::loop): Rename to...
	(gc::jit::playback::loop::loop): ...this.
	(gcc::jit::loop::end): Rename to...
	(gcc::jit::playback::loop): ...this.

	(gcc::jit::active_jit_ctxt): Eliminate in favor of...
	(gcc::jit::active_playback_ctxt): ...this.

	(gcc::jit::context::compile): Rename to...
	(gcc::jit::playback::context::compile): ...this, and eliminate the
	mutex handling; this is done for us by the caller.

	(gcc::jit::context::invoke_code_factory): Rename to...
	(gcc::jit::playback::context::replay): this.  Rather than call
	a client-provided callback, instead replay the recorded API
	calls.

	(gcc::jit::context::dump_generated_code): Rename to...
	(gcc::jit::playback::context::dump_generated_code): ...this.

	(location_comparator): Update for renamed types.

	(gcc::jit::context::handle_locations): Rename to...
	(gcc::jit::playback::context::handle_locations): ...this.

	(gcc::jit::context::add_error): Rename to...
	(gcc::jit::playback::context::add_error): this, and delegate to
	the recording context's add_error_va.

	(gcc::jit::context::add_error_va): Rename to...
	(gcc::jit::playback::context::add_error_va): this, and delegate
	to the recording context.

	(gcc::jit::context::new_location): Rename to...
	(gcc::jit::playback::context::new_location): ...this.
	(gcc::jit::context::set_tree_location): Rename to...
	(gcc::jit::playback::context::set_tree_location): ...this.
	(gcc::jit::context::get_source_file): Rename to...
	(gcc::jit::playback::context::get_source_file): ...this.
	(gcc::jit::source_file::source_file): Rename to...
	(gcc::jit::playback::source_file::source_file): ...this.
	(gcc::jit::source_file::get_source_line): Rename to...
	(gcc::jit::playback::source_file::get_source_line): ...this.
	(gcc::jit::source_line::source_line): Rename to...
	(gcc::jit::playback::source_line::source_line): ...this.
	(gcc::jit::source_line::get_location): Rename to...
	(gcc::jit::playback::source_line::get_location): ...this.

	(gcc::jit::location::location): Rename to...
	(gcc::jit::playback::location::location): ...this.

	* libgccjit.c: Update classes to derive from the "jit::recording"
	class hierarchy.
	(RETURN_IF_NOT_INITIAL_CTXT): Eliminate, as it relates to
	code-creation callbacks.
	(RETURN_NULL_IF_NOT_INITIAL_CTXT): Likewise.
	(RETURN_NULL_IF_NOT_CALLBACK_CTXT): Likewise.
	(jit_error): There isn't an "active jit context" anymore, except
	during actual compilation, so simplify the logic here.
	(gcc_jit_context_set_code_factory): Delete.

	(gcc_jit_context_new_location): Update preconditions now that we
	don't have code-creation callbacks.
	(gcc_jit_context_get_type): Likewise.
	(gcc_jit_type_get_pointer): Likewise.
	(gcc_jit_type_get_const): Likewise.
	(gcc_jit_context_new_field): Likewise.
	(gcc_jit_context_new_struct_type): Likewise.
	(gcc_jit_context_new_param): Likewise.
	(gcc_jit_param_as_lvalue): Likewise.
	(gcc_jit_param_as_rvalue): Likewise.
	(gcc_jit_context_new_function): Likewise.
	(gcc_jit_context_new_function): Likewise.
	(gcc_jit_function_new_forward_label): Likewise.
	(gcc_jit_context_new_global): Likewise.
	(gcc_jit_lvalue_as_rvalue): 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_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): Likewise.
	(gcc_jit_context_new_array_lookup): 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_compile): Likewise.
	(gcc_jit_function_add_assignment_op): Likewise.  Also,
	reimplement as a separate kind of recording, since we can't know
	the type of the lvalue at recording-time.

	* notes.txt: Update diagram to reflect the new implementation.

gcc/testsuite/
	* jit.dg/harness.h (code_making_callback): Rename to...
	(create_code): ...this, and eliminate the returned
	error-handling value: test cases will simply call into the
	gcc_jit_ API, without needing to be run from a callback.
	(test_jit): Don't register a callback, simply call the
	"create_code" function for the testcase before compiling the
	context.

	* jit.dg/test-accessing-struct.c: Rename "code_making_callback"
	to "create_code" and eliminate the return code.
	* jit.dg/test-calling-external-function.c: Likewise.
	* jit.dg/test-combination.c: Likewise.
	* jit.dg/test-dot-product.c: Likewise.
	* jit.dg/test-expressions.c: Likewise.
	* jit.dg/test-factorial.c: Likewise.
	* jit.dg/test-fibonacci.c: Likewise.
	* jit.dg/test-fuzzer.c: Likewise.
	* jit.dg/test-hello-world.c: Likewise.
	* jit.dg/test-null-passed-to-api.c: Likewise.
	* jit.dg/test-quadratic.c: Likewise.
	* jit.dg/test-reading-struct.c: Likewise.
	* jit.dg/test-string-literal.c: Likewise.
	* jit.dg/test-sum-of-squares.c: Likewise.
	* jit.dg/test-types.c: Likewise.
	* jit.dg/test-using-global.c: Likewise.

	* jit.dg/test-failure.c: Remove this test case, since it was
	specifically for testing the now-defunct callback-based API.
Add test case for a client that adds nothing to a gcc_jit_context

gcc/testsuite/
	* jit.dg/test-empty.c: New test case: a client that adds nothing
	to a gcc_jit_context.
Remove GCC_JIT_BINARY_OP_FLOATING_DIVIDE

gcc/jit/
	* libgccjit.h (enum gcc_jit_binary_op): Remove
	GCC_JIT_BINARY_OP_FLOATING_DIVIDE, which I accidentally added
	as part of a880c0d9c642730550f39d328f29a1d9935cb07e.
Verify argument counts within gcc_jit_context_new_call

gcc/jit/
	* internal-api (gcc::jit::recording::context::new_call): Verify
	the argument count of the call against the parameter count of the
	function, issuing an error if there's a mismatch.

	* internal-api.h (gcc::jit::recording::function::get_name): New.
	* (gcc::jit::recording::function::get_params): New.
	* (gcc::jit::recording::function::is_variadic): New.

gcc/testsuite/
	* jit.dg/test-error-call-with-not-enough-args.c: New test case.
	* jit.dg/test-error-call-with-too-many-args.c: New test case.
	* jit.dg/test-null-passed-to-api.c: Rename to...
	* jit.dg/test-error-null-passed-to-api.c: ...this, so that
	error-handling test cases are consistently named.
Fix accidental removal of GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE

gcc/jit/
	* internal-api.c (gcc::jit::playback::context::compile): Removal
	of the code-creation callback (96b218c9a1d5f39fb649e02c0e77586b180e8516)
	accidentally removed the implementation of
	GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE; reinstate it.
Add missing ChangeLog.jit entries

In affb26d113c6ebf2cb7a7f49271255e70a9c886f I omitted the ChangeLog
entries from the ChangeLog.jit files.  Add them.
Add set_options function to the testsuite

gcc/testsuite/
	* jit.dg/harness.h (test_jit): Move the various calls to set up
	options on the context into...
	(set_options): ...this new function.
Implement nested jit-compilation contexts

As discussed in http://gcc.gnu.org/ml/jit/2014-q1/msg00001.html,
experiments with adding libgccjit to GNU Octave revealed the absence of
a way for a user of libgccjit to separate one-time startup from
per-invocation activities.

For example, the existing GNU Octave JIT has a singleton class
"jit_typeinfo" which is created once per process, containing the JIT
representation of types, helper functions and other such global
declarations.   When a function or loop becomes "hot", the JIT uses the
objects referenced by this singleton - for example, a type-inferencer
uses the instances of types owned by the jit_typeinfo singleton, giving
back an IR for the function in terms of these type object instances.

As of 96b218c9a1d5f39fb649e02c0e77586b180e8516, libgccjit's entities now
have lifetimes bounded by gcc_jit_context objects, rather than within
the activation frame of a callback.

This next commit adds a gcc_jit_context_new_child_context API entrypoint,
allowing client code to create nested contexts: one-time initialization
can be done in a parent context, and per-method JIT-compilation can be
done in a child context.  Child contexts can use entities from their
parent context (or, indeed, ancestor contexts), though not vice-versa.

Currently contexts can be arbitrarily nested, but I believe it will be
unlikely for client code to need a nesting structure more complex than
that of a singleton parent context with multiple child contexts.

Implementation-wise, this is all rather suboptimal, requiring repeated
playback of parent contexts, but fixing that would require deep surgery
to GCC proper e.g. being able to share GC heaps between in-process
invocations of the compiler.   I believe this API at least allows the
future possibility of such a refactoring internally without necessarily
having to break clients.

gcc/jit/
	* libgccjit.h (gcc_jit_context_new_child_context): New function.

	* libgccjit.map (gcc_jit_context_new_child_context): New function.

	* libgccjit.c (gcc_jit_context): Make the constructor explicit,
	with a parent context as a parameter.
	(gcc_jit_context_acquire): Create context with a NULL parent.
	(gcc_jit_context_new_child_context): New function, creating a
	context with the given parent.

	* internal-api.h (gcc::jit::recording::context::context): New
	explicit constructor, taking a parent context as a parameter.
	(gcc::jit::recording::context::m_parent_ctxt): New field.

	* internal-api.c (gcc::jit::recording::context::context): New
	explicit constructor, taking a parent context as a parameter.
	(gcc::jit::recording::context::replay_into): Replay parent contexts
	before replaying the context itself.

gcc/testsuite/
	* jit.dg/harness.h (test_jit): Add the possibility of turning off
	this function, if the newly-coined "TEST_ESCHEWS_TEST_JIT" is
	defined, for use by...
	* jit.dg/test-nested-contexts.c: New test case, adapting
	test-quadratic.c, but splitting it into a 3-deep arrangement of
	nested contexts, to test the implementation of child contexts.
API change: access fields via (gcc_jit_field *) rather than by name

Currently there's almost no type-checking within libgccjit - if client
code uses the API in such a way as to generate bogus code, this is
likely to violate assumptions made later on within GCC proper, leading
to errors deep inside GCC (e.g. with
	internal compiler error: verify_gimple failed
when converting tree to gimple, when expanding gimple to RTL, or indeed
in other places; see the results of test-fuzzer.c for examples).

The API will be more developer-friendly if we catch such type errors
at the API boundary (similar to how the other language frontends enforce
these assumptions).

As a step towards this, change the API for accessing fields to use
gcc_jit_field pointers, rather than passing field name as strings,
avoiding the need to do a lookup in the replay code, and allowing
for the possibility of directly examining the type of the
field when implementing type-checking.

gcc/jit/
	* libgccjit.h (gcc_jit_lvalue_access_field): Require
	a (gcc_jit_field *) rather than a field name.
	(gcc_jit_rvalue_access_field): Likewise.
	(gcc_jit_rvalue_dereference_field): Likewise.

	* libgccjit.c (gcc_jit_lvalue_access_field): Require
	a (gcc_jit_field *) rather than a field name.
	(gcc_jit_rvalue_access_field): Likewise.
	(gcc_jit_rvalue_dereference_field): Likewise.

	* internal-api.c (gcc::jit::recording::rvalue::access_field):
	Require a field rather than a fieldname string.
	(gcc::jit::recording::rvalue::dereference_field): Likewise.
	(gcc::jit::recording::lvalue::access_field): Likewise.

	(gcc::jit::recording::access_field_of_lvalue::replay_into): Update
	given that this now has a field, rather than a fieldname.
	(gcc::jit::recording::access_field_rvalue::replay_into): Likewise.
	(gcc::jit::recording::dereference_field_rvalue::replay_into): Likewise.

	(get_field): Delete, as we no longer need to convert
	from (struct, identifier) pairs to fields, instead directly using
	fields.

	(gcc::jit::playback::context::new_field_access): Require a field
	rather than a fieldname, removing the need to look up the field by
	name within the struct.

	(gcc::jit::playback::lvalue::access_field): Likewise.
	(gcc::jit::playback::rvalue::access_field): Likewise.
	(gcc::jit::playback::rvalue::dereference_field): Likewise.

	* internal-api.h (gcc::jit::recording::rvalue::access_field):
	Require a field rather than a fieldname string.
	(gcc::jit::recording::rvalue::dereference_field): Likewise.
	(gcc::jit::recording::lvalue::access_field): Likewise.

	(gcc::jit::recording::access_field_of_lvalue::access_field_of_lvalue):
	Likewise.
	(gcc::jit::recording::access_field_of_lvalue::m_fieldname): Drop
	string field in favor of...
	(gcc::jit::recording::access_field_of_lvalue::m_field):
	..."field" field, as it were.

	(gcc::jit::recording::access_field_of_rvalue::access_field_of_rvalue):
	Likewise.
	(gcc::jit::recording::access_field_of_rvalue::m_fieldname): Drop
	string field in favor of...
	(gcc::jit::recording::access_field_of_rvalue::m_field):
	..."field" field.

	(gcc::jit::recording::dereference_field_rvalue::
	dereference_field_rvalue): Likewise.
	(gcc::jit::recording::dereference_field_rvalue::m_fieldname): Drop
	string field in favor of...
	(gcc::jit::recording::dereference_field_rvalue::m_field):
	..."field" field.

	(gcc::jit::playback::context::new_field_access): Require a field
	rather than a fieldname string.
	(gcc::jit::playback::context::access_field): Likewise.
	(gcc::jit::playback::context::dereference_field): Likewise.
	(gcc::jit::playback::rvalue::access_field):

gcc/testsuite/
	* jit.dg/test-accessing-struct.c (create_code): Update for API change
	for accessing fields in terms of gcc_jit_field pointers rather than
	by name.
	* jit.dg/test-nested-contexts.c (make_calc_discriminant): Likewise.
	(make_test_quadratic): Likewise.
	* jit.dg/test-quadratic.c (make_calc_discriminant): Likewise.
	(make_test_quadratic): Likewise.
	* jit.dg/test-reading-struct.c (create_code): Likewise.
	* jit.dg/test-types.c: Likewise.