Eliminate source_location in favor of location_t
[official-gcc.git] / gcc / jit / ChangeLog
blob8451fd500e61ac6e4d7ea100504ea63b88dd3250
1 2018-11-13  David Malcolm  <dmalcolm@redhat.com>
3         * jit-playback.c: Replace "source_location" with "location_t".
5 2018-10-17  David Malcolm  <dmalcolm@redhat.com>
7         * Make-lang.in (selftest-jit): New.
9 2018-06-28  Martin Liska  <mliska@suse.cz>
11         * jit-playback.c: Include opt-suggestions.h.
13 2018-06-28  Martin Liska  <mliska@suse.cz>
15         * jit-playback.c (class auto_argvec): Moved to vec.h.
16         (auto_argvec::~auto_argvec): Likewise.
17         (compile): Use the renamed name.
18         (invoke_driver): Likewise.
20 2018-03-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
22         PR jit/84288
23         * Make-lang.in ($(LIBGCCJIT_FILENAME)): Add $(EXTRA_GCC_LIBS).
25 2018-03-09  David Malcolm  <dmalcolm@redhat.com>
26             Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
28         PR jit/64089
29         PR jit/84288
30         * Make-lang.in (COMMA): New.
31         (LIBGCCJIT_VERSION_SCRIPT_OPTION): New.
32         (LIBGCCJIT_SONAME_OPTION): New.
33         (jit): Move --version-script and -soname linker options to the
34         above.
36 2018-01-25  David Malcolm  <dmalcolm@redhat.com>
38         PR jit/81672
39         * jit-recording.h (gcc::jit::recording::union_): Remove fields
40         "m_loc" and "m_name".
42 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
44         Update copyright years.
46 2017-12-19  Jakub Jelinek  <jakub@redhat.com>
48         * jit-playback.c (get_type, playback::compile_to_file::copy_file,
49         playback::context::acquire_mutex): Replace Yoda conditions with
50         typical order conditions.
51         * libgccjit.c (gcc_jit_context_new_struct_type,
52         gcc_jit_struct_set_fields, gcc_jit_context_new_union_type,
53         gcc_jit_context_new_function, gcc_jit_timer_pop): Likewise.
54         * jit-builtins.c (matches_builtin): Likewise.
55         * jit-recording.c (recording::compound_type::set_fields,
56         recording::fields::write_reproducer, recording::rvalue::set_scope,
57         recording::function::validate): Likewise.
58         * jit-logging.c (logger::decref): Likewise.
60 2017-11-30  Jakub Jelinek  <jakub@redhat.com>
62         * jit-recording.c
63         (recording::memento_of_new_rvalue_from_const <long>::write_reproducer):
64         Use ; instead of ;;.
66 2017-11-28  Jakub Jelinek  <jakub@redhat.com>
68         * jit-playback.c (add_switch): Build SWITCH_EXPR using build2 instead
69         of build3.  Formatting fixes.  Adjust funciton comment.
71 2017-11-23  Tom de Vries  <tom@codesourcery.com>
73         * libgccjit.c (RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE): Wrap in
74         JIT_{BEGIN,END}_STMT.
76 2017-10-31  David Malcolm  <dmalcolm@redhat.com>
78         * docs/internals/index.rst (Running the test suite): Document
79         PRESERVE_EXECUTABLES.
80         (Running under valgrind): Add markup to RUN_UNDER_VALGRIND.
81         * docs/_build/texinfo/libgccjit.texi: Regenerate.
83 2017-10-04  David Malcolm  <dmalcolm@redhat.com>
85         * docs/cp/topics/expressions.rst (Vector expressions): New
86         section.
87         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_10): New ABI tag.
88         * docs/topics/expressions.rst (Vector expressions): New section.
89         * docs/topics/types.rst (gcc_jit_type_get_vector): Add link to
90         gcc_jit_context_new_rvalue_from_vector.
91         * docs/_build/texinfo/libgccjit.texi: Regenerate.
92         * jit-common.h (gcc::jit:recording::vector_type): New forward
93         decl.
94         * jit-playback.c
95         (gcc::jit::playback::context::new_rvalue_from_vector): New method.
96         * jit-playback.h
97         (gcc::jit::playback::context::new_rvalue_from_vector): New method.
98         * jit-recording.c: In namespace gcc::jit::
99         (class comma_separated_string): New class.
100         (comma_separated_string::comma_separated_string): New ctor,
101         adapted from recording::call::make_debug_string.
102         (comma_separated_string::~comma_separated_string): New dtor.
103         In namespace gcc::jit::recording::
104         (context::new_rvalue_from_vector): New method.
105         (type::get_vector): Update for renaming of memento_of_get_vector.
106         (class memento_of_get_vector): Rename to...
107         (class vector_type): ..this.
108         (memento_of_new_rvalue_from_vector::memento_of_new_rvalue_from_vector):
109         New ctor.
110         (memento_of_new_rvalue_from_vector::replay_into): New method.
111         (memento_of_new_rvalue_from_vector::visit_children): New method.
112         (memento_of_new_rvalue_from_vector::make_debug_string): New
113         method.
114         (memento_of_new_rvalue_from_vector::write_reproducer): New method.
115         (call::make_debug_string): Split out arg-printing code into ctor
116         for comma_separated_string.
117         * jit-recording.h: In namespace gcc::jit::recording::
118         (context::new_rvalue_from_vector): New method.
119         (type::dyn_cast_vector_type): New virtual function.
120         (class memento_of_get_vector): Rename to...
121         (class vector_type): ...this.
122         (vector_type::unqualified): Remove this vfunc override in favor
123         of...
124         (vector_type::get_element_type): ...this new method.
125         (vector_type::get_num_units): New method.
126         (vector_type::dyn_cast_vector_type): New vfunc override.
127         (class memento_of_new_rvalue_from_vector): New class.
128         * libgccjit++.h (gccjit::context::new_rvalue): Add overload for
129         vector of rvalue.
130         * libgccjit.c (gcc_jit_context_new_binary_op): Strip off type
131         qualifications when checking that both operands have same type.
132         (gcc_jit_context_new_rvalue_from_vector): New API entrypoint.
133         * libgccjit.h
134         (LIBGCCJIT_HAVE_gcc_jit_context_new_rvalue_from_vector): New
135         macro.
136         (gcc_jit_context_new_rvalue_from_vector): New API entrypoint.
137         * libgccjit.map (LIBGCCJIT_ABI_10): New ABI tag.
139 2017-09-28  David Malcolm  <dmalcolm@redhat.com>
141         * docs/topics/expressions.rst (Function calls): Add link to
142         gcc_jit_context_new_function_ptr_type.
143         (Function pointers): Convert to cross-references to
144         function-pointers.rst, moving material there.
145         * docs/topics/function-pointers.rst: New page.
146         * docs/topics/index.rst: Add function-pointers.rst.
147         * docs/topics/types.rst (Function pointer types): New section.
148         * docs/_build/texinfo/libgccjit.texi: Regenerate.
150 2017-09-28  David Malcolm  <dmalcolm@redhat.com>
152         * jit-recording.c
153         (gcc::jit::recording::function_type::is_same_type_as): New function.
154         * jit-recording.h: In namespace gcc::jit::recording::
155         (type::accepts_writes_from): Use is_same_type_as rather than pointer
156         equality.
157         (type::is_same_type_as): New virtual function.
158         (function_type::is_same_type_as): New override.
160 2017-09-27  David Malcolm  <dmalcolm@redhat.com>
162         * docs/cp/topics/expressions.rst (Function pointers): New section.
163         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_9): New tag.
164         * docs/topics/expressions.rst (Function pointers): New section.
165         * docs/_build/texinfo/libgccjit.texi: Regenerate.
166         * jit-common.h (class gcc::jit::recording::function_pointer): New
167         forward decl.
168         * jit-playback.c (gcc::jit::playback::function::get_address): New
169         method.
170         * jit-playback.h (gcc::jit::playback::function::get_address): New
171         method decl.
172         * jit-recording.c: Within namespace gcc::jit::recording...
173         (function::function): Initialize new field "m_fn_ptr_type".
174         (function::get_address): New method.
175         (function_pointer::replay_into): New method.
176         (function_pointer::visit_children): New method.
177         (function_pointer::make_debug_string): New method.
178         (function_pointer::write_reproducer): New method.
179         * jit-recording.h: Within namespace gcc::jit::recording...
180         (function::get_address): New method.
181         (function): Add field "m_fn_ptr_type".
182         (class function_pointer): New subclass of rvalue.
183         * libgccjit++.h (gccjit::function::get_address): New method.
184         * libgccjit.c (gcc_jit_function_get_address): New function.
185         * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_function_get_address): New
186         macro.
187         (gcc_jit_function_get_address): New API entrypoint.
188         * libgccjit.map (LIBGCCJIT_ABI_9): New tag.
190 2017-09-14  David Malcolm  <dmalcolm@redhat.com>
192         PR jit/82174
193         * jit-builtins.c (matches_builtin): Ignore entries with a NULL
194         name.
196 2017-08-18  David Malcolm  <dmalcolm@redhat.com>
198         PR tree-optimization/46805
199         * dummy-frontend.c (jit_langhook_parse_file): Handle vector types.
201 2017-08-18  David Malcolm  <dmalcolm@redhat.com>
203         * jit-recording.c (class gcc::jit::reproducer): Rename field
204         "m_identifiers" to "m_map_memento_to_identifier".  Add field
205         "m_set_identifiers" and struct hash_traits for it.
206         (gcc::jit::reproducer::reproducer): Update for above.
207         (convert_to_identifier): New function.
208         (gcc::jit::reproducer::ensure_identifier_is_unique): New method.
209         (gcc::jit::reproducer::make_identifier): Avoid appending the %p
210         unless necessary for uniqueness.  Update for field renaming.
211         (gcc::jit::reproducer::get_identifier): Update for field renaming.
213 2017-08-09  David Malcolm  <dmalcolm@redhat.com>
215         * docs/cp/topics/types.rst (Vector types): New section.
216         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_8): New tag.
217         * docs/topics/types.rst (gcc_jit_context_get_type): Fix typo in
218         example.
219         (Vector types): New section.
220         * docs/_build/texinfo/libgccjit.texi: Regenerate.
221         * jit-playback.c (gcc::jit::playback::type::get_vector): New
222         method.
223         * jit-playback.h (gcc::jit::playback::type::get_vector): New
224         method.
225         * jit-recording.c: In namespace gcc::jit::recording::
226         (type::get_vector): New method.
227         (memento_of_get_aligned::write_reproducer): Fix typo
228         in leading comment.
229         (memento_of_get_vector::replay_into): New method.
230         (memento_of_get_vector::make_debug_string): New method.
231         (memento_of_get_vector::write_reproducer): New method.
232         * jit-recording.h: In namespace gcc::jit::recording::
233         (type::get_vector): New
234          method.
235         (class memento_of_get_vector): New class.
236         * libgccjit++.h (gccjit::type::get_vector): New method.
237         * libgccjit.c (gcc_jit_type_get_vector): New public entrypoint.
238         * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_type_get_vector): New
239         define.
240         (gcc_jit_type_get_vector): New decl.
241         * libgccjit.map (LIBGCCJIT_ABI_8): New ABI tag.
243 2017-07-05  Richard Sandiford  <richard.sandiford@linaro.org>
244             Alan Hayward  <alan.hayward@arm.com>
245             David Sherwood  <david.sherwood@arm.com>
247         * dummy-frontend.c (jit_langhook_type_for_mode): Remove "enum" before
248         "machine_mode".
250 2017-04-24  David Malcolm  <dmalcolm@redhat.com>
252         * docs/cp/topics/types.rst (gccjit::type::get_const): Remove
253         comment.
254         (gccjit::type::get_aligned): Add.
255         * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_7.
256         * docs/topics/types.rst: Add gcc_jit_type_get_aligned.
257         * docs/_build/texinfo/libgccjit.texi: Regenerate.
258         * jit-playback.c (gcc::jit::playback::type::get_aligned): New
259         method.
260         * jit-playback.h (gcc::jit::playback::type::get_aligned): New
261         method.
262         * jit-recording.c: Within namespace gcc::jit::recording...
263         (type::get_aligned): New method.
264         (memento_of_get_aligned::replay_into): New method.
265         (memento_of_get_aligned::make_debug_string): New method.
266         (memento_of_get_aligned::write_reproducer): New method.
267         * jit-recording.h: Within namespace gcc::jit::recording...
268         (type::get_aligned): New method.
269         (type::accepts_writes_from): Strip off qualifications from
270         this when comparing pointer equality.
271         (decorated_type): New subclass of type, subsuming the
272         commonality between memento_of_get_const and
273         memento_of_get_volatile.
274         (memento_of_get_const): Make a subclass of decorated_type,
275         rather than type.
276         (memento_of_get_volatile): Likewise.
277         (memento_of_get_aligned): Likewise.
278         * libgccjit++.h: Within namespace gccjit...
279         (type::get_const): New method.
280         (type::get_aligned): New method.
281         * libgccjit.c (gcc_jit_type_get_aligned): New function.
282         * libgccjit.h (gcc_jit_type_get_aligned): New decl.
283         * libgccjit.map (LIBGCCJIT_ABI_7): New
284         (gcc_jit_type_get_aligned): Add.
286 2017-01-19  David Malcolm  <dmalcolm@redhat.com>
288         * dummy-frontend.c (jit_langhook_type_for_size): Delete.
289         (LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine.
291 2017-01-18  David Malcolm  <dmalcolm@redhat.com>
293         * dummy-frontend.c (jit_langhook_type_for_size): Implement, using
294         lto's lto_type_for_size.
296 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
298         Update copyright years.
300 2016-05-20  David Malcolm  <dmalcolm@redhat.com>
302         * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_6.
303         * docs/topics/expressions.rst (Function calls): Add documentation
304         of gcc_jit_rvalue_set_bool_require_tail_call.
305         * docs/_build/texinfo/libgccjit.texi: Regenerate.
306         * jit-common.h (gcc::jit::recording::base_call): Add forward decl.
307         * jit-playback.c: Within namespace gcc::jit::playback...
308         (context::build_call) Add "require_tail_call" param and use it
309         to set CALL_EXPR_MUST_TAIL_CALL.
310         (context::new_call): Add "require_tail_call" param.
311         (context::new_call_through_ptr): Likewise.
312         * jit-playback.h: Within namespace gcc::jit::playback...
313         (context::new_call: Add "require_tail_call" param.
314         (context::new_call_through_ptr): Likewise.
315         (context::build_call): Likewise.
316         * jit-recording.c: Within namespace gcc::jit::recording...
317         (base_call::base_call): New constructor.
318         (base_call::write_reproducer_tail_call): New method.
319         (call::call): Update for inheritance from base_call.
320         (call::replay_into): Provide m_require_tail_call to call
321         to new_call.
322         (call::write_reproducer): Call write_reproducer_tail_call.
323         (call_through_ptr::call_through_ptr): Update for inheritance from
324         base_call.
325         (call_through_ptr::replay_into): Provide m_require_tail_call to call
326         to new_call_through_ptr.
327         (recording::call_through_ptr::write_reproducer): Call
328         write_reproducer_tail_call.
329         * jit-recording.h: Within namespace gcc::jit::recording...
330         (rvalue::dyn_cast_base_call): New virtual function.
331         (class base_call): New subclass of class rvalue.
332         (class call): Inherit from base_call rather than directly from
333         rvalue, moving get_precedence and m_args to base_call.
334         (class call_through_ptr): Likewise.
335         * libgccjit.c (gcc_jit_rvalue_set_bool_require_tail_call): New
336         function.
337         * libgccjit.h
338         (LIBGCCJIT_HAVE_gcc_jit_rvalue_set_bool_require_tail_call): New
339         macro.
340         (gcc_jit_rvalue_set_bool_require_tail_call): New function.
341         * libgccjit.map (LIBGCCJIT_ABI_6): New.
342         (gcc_jit_rvalue_set_bool_require_tail_call): Add.
344 2016-05-17  David Malcolm  <dmalcolm@redhat.com>
346         * dummy-frontend.c: Include diagnostic.h.
347         (jit_begin_diagnostic): New function.
348         (jit_end_diagnostic): New function.
349         (jit_langhook_init): Register jit_begin_diagnostic
350         and jit_end_diagnostic with the global_dc.
351         * jit-playback.c: Include diagnostic.h.
352         (gcc::jit::playback::context::add_diagnostic): New method.
353         * jit-playback.h (struct diagnostic_context): Add forward
354         declaration.
355         (gcc::jit::playback::context::add_diagnostic): New method.
357 2016-05-17  David Malcolm  <dmalcolm@redhat.com>
359         * docs/topics/expressions.rst (Function calls): Document
360         gcc_jit_context_new_call_through_ptr.
361         * docs/_build/texinfo/libgccjit.texi: Regenerate.
363 2016-05-13  David Malcolm  <dmalcolm@redhat.com>
365         * jit-playback.h: Within namespace gcc:jit::playback...
366         (compile_to_memory::postprocess): Mark with FINAL OVERRIDE.
367         (compile_to_file::postprocess): Likewise.
368         (function::finalizer): Likewise.
369         (block::finalizer): Likewise.
370         (source_file::finalizer): Likewise.
371         (source_line::finalizer): Likewise.
372         * jit-recording.c (gcc::jit::rvalue_usage_validator):: Likewise.
373         * jit-recording.h: Within namespace gcc::jit::recording...
374         (string::replay_into): Mark with FINAL OVERRIDE.
375         (string::make_debug_string): Likewise.
376         (string::write_reproducer): Likewise.
377         (location::replay_into): Likewise.
378         (location::dyn_cast_location): Likewise.
379         (location::make_debug_string): Likewise.
380         (location::write_reproducer): Likewise.
381         (memento_of_get_type::dereference): Likewise.
382         (memento_of_get_type::accepts_writes_from): Likewise.
383         (memento_of_get_type::is_int): Likewise.
384         (memento_of_get_type::is_float): Likewise.
385         (memento_of_get_type::is_bool): Likewise.
386         (memento_of_get_type::is_pointer): Likewise.
387         (memento_of_get_type::is_array): Likewise.
388         (memento_of_get_type::is_void): Likewise.
389         (memento_of_get_type::replay_into): Likewise.
390         (memento_of_get_type::make_debug_string): Likewise.
391         (memento_of_get_type::write_reproducer): Likewise.
392         (memento_of_get_pointer::dereference): Likewise.
393         (memento_of_get_pointer::accepts_writes_from): Likewise.
394         (memento_of_get_pointer::replay_into): Likewise.
395         (memento_of_get_pointer::is_int): Likewise.
396         (memento_of_get_pointer::is_float): Likewise.
397         (memento_of_get_pointer::is_bool): Likewise.
398         (memento_of_get_pointer::is_pointer): Likewise.
399         (memento_of_get_pointer::is_array): Likewise.
400         (memento_of_get_pointer::make_debug_string): Likewise.
401         (memento_of_get_pointer::write_reproducer): Likewise.
402         (memento_of_get_const::dereference): Likewise.
403         (memento_of_get_const::accepts_writes_from): Likewise.
404         (memento_of_get_const::unqualified): Likewise.
405         (memento_of_get_const::is_int): Likewise.
406         (memento_of_get_const::is_float): Likewise.
407         (memento_of_get_const::is_bool): Likewise.
408         (memento_of_get_const::is_pointer): Likewise.
409         (memento_of_get_const::is_array): Likewise.
410         (memento_of_get_const::void replay_into): Likewise;
411         (memento_of_get_const::make_debug_string): Likewise.
412         (memento_of_get_const::write_reproducer): Likewise.
413         (memento_of_get_volatile::dereference): Likewise.
414         (memento_of_get_volatile::unqualified): Likewise.
415         (memento_of_get_volatile::is_int): Likewise.
416         (memento_of_get_volatile::is_float): Likewise.
417         (memento_of_get_volatile::is_bool): Likewise.
418         (memento_of_get_volatile::is_pointer): Likewise.
419         (memento_of_get_volatile::is_array): Likewise.
420         (memento_of_get_volatile::replay_into): Likewise;
421         (memento_of_get_volatile::make_debug_string): Likewise.
422         (memento_of_get_volatile::write_reproducer): Likewise.
423         (array_type::dereference): Likewise.
424         (array_type::is_int): Likewise.
425         (array_type::is_float): Likewise.
426         (array_type::is_bool): Likewise.
427         (array_type::is_pointer): Likewise.
428         (array_type::is_array): Likewise.
429         (array_type::replay_into): Likewise;
430         (array_type::make_debug_string): Likewise.
431         (array_type::write_reproducer): Likewise.
432         (function_type::dereference): Likewise.
433         (function_type::function_dyn_cast_function_type): Likewise.
434         (function_type::function_as_a_function_type): Likewise.
435         (function_type::is_int): Likewise.
436         (function_type::is_float): Likewise.
437         (function_type::is_bool): Likewise.
438         (function_type::is_pointer): Likewise.
439         (function_type::is_array): Likewise.
440         (function_type::replay_into): Likewise;
441         (function_type::make_debug_string): Likewise.
442         (function_type::write_reproducer): Likewise.
443         (field::replay_into): Likewise;
444         (field::write_to_dump): Likewise.
445         (field::make_debug_string): Likewise.
446         (field::write_reproducer): Likewise.
447         (compound_type::dereference): Likewise.
448         (compound_type::is_int): Likewise.
449         (compound_type::is_float): Likewise.
450         (compound_type::is_bool): Likewise.
451         (compound_type::is_pointer): Likewise.
452         (compound_type::is_array): Likewise.
453         (compound_type::has_known_size): Likewise.
454         (struct_::dyn_cast_struct): Likewise.
455         (struct_::replay_into): Likewise.
456         (struct_::access_as_type): Likewise.
457         (struct_::make_debug_string): Likewise.
458         (struct_::write_reproducer): Likewise.
459         (fields::replay_into): Likewise.
460         (fields::write_to_dump): Likewise.
461         (fields::make_debug_string): Likewise.
462         (fields::write_reproducer): Likewise.
463         (union_::replay_into): Likewise.
464         (union_::make_debug_string): Likewise.
465         (union_::write_reproducer): Likewise.
466         (lvalue::access_as_rvalue): Mark with OVERRIDE.
467         (param::replay_into): Mark with FINAL OVERRIDE.
468         (param::visit_children): Likewise.
469         (param::dyn_cast_param): Likewise.
470         (param::access_as_rvalue): Likewise.
471         (param::access_as_lvalue): Likewise.
472         (param::make_debug_string): Likewise.
473         (param::write_reproducer): Likewise.
474         (param::get_precedence): Likewise.
475         (function::replay_into): Likewise.
476         (function::write_to_dump): Likewise.
477         (function::make_debug_string): Likewise.
478         (function::write_reproducer): Likewise.
479         (block::write_to_dump): Likewise.
480         (block::make_debug_string): Likewise.
481         (block::write_reproducer): Likewise.
482         (block::replay_into): Likewise.
483         (global::replay_into): Likewise;
484         (global::visit_children): Likewise.
485         (global::write_to_dump): Likewise.
486         (global::make_debug_string): Likewise.
487         (global::write_reproducer): Likewise.
488         (global::get_precedence): Likewise.
489         (memento_of_new_rvalue_from_const::replay_into): Likewise.
490         (memento_of_new_rvalue_from_const::visit_children): Likewise.
491         (memento_of_new_rvalue_from_const::is_constant): Likewise.
492         (memento_of_new_rvalue_from_const::get_wide_int): Likewise.
493         (memento_of_new_rvalue_from_const::make_debug_string): Likewise.
494         (memento_of_new_rvalue_from_const::write_reproducer): Likewise.
495         (memento_of_new_rvalue_from_const::get_precedence): Likewise.
496         (memento_of_new_string_literal::replay_into): Likewise.
497         (memento_of_new_string_literal::visit_children): Likewise.
498         (memento_of_new_string_literal::make_debug_string): Likewise.
499         (memento_of_new_string_literal::write_reproducer): Likewise.
500         (memento_of_new_string_literal::get_precedence): Likewise.
501         (unary_op::replay_into): Likewise.
502         (unary_op::visit_children): Likewise.
503         (unary_op::make_debug_string): Likewise.
504         (unary_op::write_reproducer): Likewise.
505         (unary_op::get_precedence): Likewise.
506         (binary_op::replay_into): Likewise.
507         (binary_op::visit_children): Likewise.
508         (binary_op::make_debug_string): Likewise.
509         (binary_op::write_reproducer): Likewise.
510         (binary_op::get_precedence): Likewise.
511         (comparison::replay_into): Likewise.
512         (comparison::visit_children): Likewise.
513         (comparison::make_debug_string): Likewise.
514         (comparison::write_reproducer): Likewise.
515         (comparison::get_precedence): Likewise.
516         (cast::replay_into): Likewise.
517         (cast::visit_children): Likewise.
518         (cast::make_debug_string): Likewise.
519         (cast::write_reproducer): Likewise.
520         (cast::get_precedence): Likewise.
521         (call::replay_into): Likewise.
522         (call::visit_children): Likewise.
523         (call::make_debug_string): Likewise.
524         (call::write_reproducer): Likewise.
525         (call::get_precedence): Likewise.
526         (call_through_ptr::replay_into): Likewise.
527         (call_through_ptr::visit_children): Likewise.
528         (call_through_ptr::make_debug_string): Likewise.
529         (call_through_ptr::write_reproducer): Likewise.
530         (call_through_ptr::get_precedence): Likewise.
531         (array_access::replay_into): Likewise.
532         (array_access::visit_children): Likewise.
533         (array_access::make_debug_string): Likewise.
534         (array_access::write_reproducer): Likewise.
535         (array_access::get_precedence): Likewise.
536         (access_field_of_lvalue::replay_into): Likewise.
537         (access_field_of_lvalue::visit_children): Likewise.
538         (access_field_of_lvalue::make_debug_string): Likewise.
539         (access_field_of_lvalue::write_reproducer): Likewise.
540         (access_field_of_lvalue::get_precedence): Likewise.
541         (access_field_rvalue::replay_into): Likewise.
542         (access_field_rvalue::visit_children): Likewise.
543         (access_field_rvalue::make_debug_string): Likewise.
544         (access_field_rvalue::write_reproducer): Likewise.
545         (access_field_rvalue::get_precedence): Likewise.
546         (dereference_field_rvalue::replay_into): Likewise.
547         (dereference_field_rvalue::visit_children): Likewise.
548         (dereference_field_rvalue::make_debug_string): Likewise.
549         (dereference_field_rvalue::write_reproducer): Likewise.
550         (dereference_field_rvalue::get_precedence): Likewise.
551         (dereference_rvalue::replay_into): Likewise.
552         (dereference_rvalue::visit_children): Likewise.
553         (dereference_rvalue::make_debug_string): Likewise.
554         (dereference_rvalue::write_reproducer): Likewise.
555         (dereference_rvalue::get_precedence): Likewise.
556         (get_address_of_lvalue::replay_into): Likewise.
557         (get_address_of_lvalue::visit_children): Likewise.
558         (get_address_of_lvalue::make_debug_string): Likewise.
559         (get_address_of_lvalue::write_reproducer): Likewise.
560         (get_address_of_lvalue::get_precedence): Likewise.
561         (local::replay_into): Likewise.
562         (local::visit_children): Likewise.
563         (local::write_to_dump): Likewise.
564         (local::make_debug_string): Likewise.
565         (local::write_reproducer): Likewise.
566         (local::get_precedence): Likewise.
567         (statement::write_to_dump): Likewise.
568         (eval::replay_into): Likewise.
569         (eval::make_debug_string): Likewise.
570         (eval::write_reproducer): Likewise.
571         (assignment::replay_into): Likewise.
572         (assignment::make_debug_string): Likewise.
573         (assignment::write_reproducer): Likewise.
574         (assignment_op::replay_into): Likewise.
575         (assignment_op::make_debug_string): Likewise.
576         (assignment_op::write_reproducer): Likewise.
577         (comment::replay_into): Likewise.
578         (comment::make_debug_string): Likewise.
579         (comment::write_reproducer): Likewise.
580         (conditional::replay_into): Likewise.
581         (conditional::get_successor_blocks): Likewise.
582         (conditional::make_debug_string): Likewise.
583         (conditional::write_reproducer): Likewise.
584         (jump::replay_into): Likewise.
585         (jump::get_successor_blocks): Likewise.
586         (jump::make_debug_string): Likewise.
587         (jump::write_reproducer): Likewise.
588         (return_::replay_into): Likewise.
589         (return_::get_successor_blocks): Likewise.
590         (return_::make_debug_string): Likewise.
591         (return_::write_reproducer): Likewise.
592         (case_::replay_into): Likewise.
593         (case_::write_reproducer): Likewise.
594         (case_::make_debug_string): Likewise.
595         (switch_::replay_into): Likewise.
596         (switch_::get_successor_blocks): Likewise.
597         (switch_::make_debug_string): Likewise.
598         (switch_::write_reproducer): Likewise.
600 2016-02-08  David Malcolm  <dmalcolm@redhat.com>
602         * dummy-frontend.c (jit_langhook_init): Remove
603         second argument to build_common_tree_nodes to
604         track r233218.
606 2016-01-23  Iain Buclaw  <ibuclaw@gdcproject.org>
608         * jit-playback.c: Include pthread.h.
610 2016-01-19  David Malcolm  <dmalcolm@redhat.com>
612         PR jit/69144
613         * jit-playback.c (gcc::jit::playback::compile_to_file::postprocess):
614         Potentially add the temporary artifact to the tempdir's list of
615         tempfiles needing additional cleanup.
616         (gcc::jit::playback::context::extract_any_requested_dumps): Likewise
617         for the dumpfile.
618         * jit-tempdir.c (gcc::jit::tempdir::~tempdir): Clean up additional
619         tempfiles.
620         * jit-tempdir.h (gcc::jit::tempdir::add_temp_file): New method.
621         (gcc::jit::tempdir::m_tempfiles): New field.
622         * docs/cp/intro/tutorial04.rst: Update for changes to toyvm.cc.
623         * docs/examples/tut04-toyvm/toyvm.cc (class compilation_result):
624         New.
625         (toyvm_function::compile): Change return type from function ptr
626         to a compilation_result.
627         (toyvm_function::get_function_name): New accessor.
628         (toyvm_function::m_funcname): New field.
629         (get_function_name): Convert to...
630         (toyvm_function::make_function_name): ...this new method.
631         (toyvm_function::parse): Call make_function_name.
632         (toyvm_function::compile): Convert return type from function ptr
633         to a compilation_result.  Use get_function_name.
634         (compilation_state::compile): Convert return type from
635         gcc_jit_result * to a compilation_result.
636         (test_script): Update for above changes, extracting the code from
637         the compilation_result.
638         (main): Likewise.
639         * docs/_build/texinfo/libgccjit.texi: Regenerate.
641 2016-01-04  Jakub Jelinek  <jakub@redhat.com>
643         Update copyright years.
645 2015-11-11  Andrew MacLeod  <amacleod@redhat.com>
647         * dummy-frontend.c: Remove unused header files.
648         * jit-builtins.c: Likewise.
649         * jit-playback.c: Likewise.
650         * jit-recording.c: Likewise.
651         * jit-spec.c: Likewise.
652         * libgccjit.c: Likewise.
654 2015-11-07  Richard Sandiford  <richard.sandiford@arm.com>
656         * jit-builtins.c: Don't undef DEF_BUILTIN.
658 2015-10-29  Andrew MacLeod  <amacleod@redhat.com>
660         * dummy-frontend.c: Reorder #include's and remove duplicates.
661         * jit-builtins.c: Likewise.
662         * jit-playback.c: Likewise.
663         * jit-recording.c: Likewise.
664         * libgccjit.c: Likewise.
666 2015-10-13  Jakub Jelinek  <jakub@redhat.com>
668         * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
669         DEF_FUNCTION_TYPE_11): Define.
670         * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
671         DEF_FUNCTION_TYPE_11): Define.
673 2015-09-30  Thomas Schwinge  <thomas@codesourcery.com>
674             Ulrich Drepper  <drepper@gmail.com>
676         * jit-builtins.h: Undefine DEF_FUNCTION_TYPE_VAR_6 after use.
678 2015-09-30  Matthias Klose  <doko@ubuntu.com>
680         * jit-builtins.h Define DEF_FUNCTION_TYPE_VAR_6,
681         remove DEF_FUNCTION_TYPE_VAR_11.
682         * jit-builtins.c (builtins_manager::make_type): Define and handle
683         DEF_FUNCTION_TYPE_VAR_6, remove DEF_FUNCTION_TYPE_VAR_11.
685 2015-08-25  David Malcolm  <dmalcolm@redhat.com>
687         * docs/cp/topics/contexts.rst
688         (gccjit::context::set_bool_use_external_driver): New.
689         * docs/internals/test-hello-world.exe.log.txt: Update.
690         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_5): New.
691         * docs/topics/contexts.rst
692         (gcc_jit_context_set_bool_use_external_driver): New.
693         * jit-common.h (enum inner_bool_option): Add
694         INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
695         * jit-playback.c (gcc_driver_name): New global.
696         (gcc:jit::playback::context::invoke_driver): Split out second
697         half into...
698         (gcc::jit::playback::context::invoke_embedded_driver): ...this new
699         function, and...
700         (gcc::jit::playback::context::invoke_external_driver): ...this new
701         function.
702         * jit-playback.h
703         (gcc::jit::playback::context::get_inner_bool_option): New.
704         (gcc::jit::playback::context::invoke_embedded_driver): New.
705         (gcc::jit::playback::context::invoke_external_driver): New.
706         * jit-recording.c (inner_bool_option_reproducer_strings):
707         Add entry for INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
708         * libgccjit++.h
709         (gccjit::context::set_bool_use_external_driver): New.
710         * libgccjit.c (gcc_jit_context_set_bool_use_external_driver): New.
711         * libgccjit.h (gcc_jit_context_set_bool_use_external_driver): New.
712         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_use_external_driver):
713         New.
714         * libgccjit.map (LIBGCCJIT_ABI_5): New.
715         * notes.txt: Show invocation of embedded copy of driver.
716         * docs/internals/test-hello-world.exe.log.txt: Update
718 2015-08-13  David Malcolm  <dmalcolm@redhat.com>
720         * jit-playback.c (invoke_driver): On OS X, add
721         "-Wl,-undefined,dynamic_lookup" to the driver arguments.
723 2015-08-03  David Malcolm  <dmalcolm@redhat.com>
725         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_4): New.
726         * docs/topics/contexts.rst (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY):
727         We no longer show a profile.
728         * docs/topics/index.rst (Topic Reference): Add performance.rst.
729         * docs/topics/performance.rst: New file.
730         * docs/_build/texinfo/libgccjit.texi: Regenerate.
731         * jit-playback.c (gcc::jit::playback::context::compile): Add timer
732         param when constructing the "toplev" instance.
733         (gcc::jit::playback::context::acquire_mutex): Add timer param when
734         constructing auto_timevar instance.
735         (gcc::jit::playback::context::make_fake_args): If we have a timer,
736         add "-ftime-report".
737         (gcc::jit::playback::context::invoke_driver): Add timer param when
738         constructing auto_timevar instance.
739         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
740         * jit-playback.h (gcc::jit::playback::context::get_timer): New accessor.
741         * jit-recording.c: Include timevar.h.
742         (gcc::jit::recording::context::context): Initialize field "m_timer".
743         * jit-recording.h: Add forward declaration of class timer.
744         (gcc::jit::recording::context::set_timer): New method.
745         (gcc::jit::recording::context::get_timer): New method.
746         (gcc::jit::recording::context::m_timer): New field.
747         * libgccjit++.h (gccjit::timer): New class.
748         (gccjit::auto_time): New class.
749         (gccjit::context::set_timer): New method.
750         (gccjit::context::get_timer): New.
751         (gccjit::timer::timer): New.
752         (gccjit::timer::push): New.
753         (gccjit::timer::pop): New.
754         (timer::print): New.
755         (timer::get_inner_timer): New.
756         (timer::release): New.
757         (auto_time::auto_time): New.
758         (auto_time::~auto_time): New.
759         * libgccjit.c: Include timevar.h.
760         (struct gcc_jit_timer): New.
761         (gcc_jit_timer_new): New function.
762         (gcc_jit_timer_release): New function.
763         (gcc_jit_context_set_timer): New function.
764         (gcc_jit_context_get_timer): New function.
765         (gcc_jit_timer_push): New function.
766         (gcc_jit_timer_pop): New function.
767         (gcc_jit_timer_print): New function.
768         * libgccjit.h (LIBGCCJIT_HAVE_TIMING_API): New macro.
769         (gcc_jit_timer): New typedef.
770         (gcc_jit_timer_new): New function.
771         (gcc_jit_timer_release): New function.
772         (gcc_jit_context_set_timer): New function.
773         (gcc_jit_context_get_timer): New function.
774         (gcc_jit_timer_push): New function.
775         (gcc_jit_timer_pop): New function.
776         (gcc_jit_timer_print): New function.
777         * libgccjit.map (LIBGCCJIT_ABI_4): New.
778         (gcc_jit_timer_new): New function.
779         (gcc_jit_timer_release): New function.
780         (gcc_jit_context_set_timer): New function.
781         (gcc_jit_context_get_timer): New function.
782         (gcc_jit_timer_push): New function.
783         (gcc_jit_timer_pop): New function.
784         (gcc_jit_timer_print): New function.
786 2015-07-23  David Malcolm  <dmalcolm@redhat.com>
788         * jit-playback.c (invoke_driver): Convert local "argvec"
789         to an auto_argvec, so that it owns copies of the strings,
790         rather than borrows them, updating ADD_ARG to use xstrdup
791         and special-casing the NULL terminator to avoid
792         xstrdup (NULL).  Call add_multilib_driver_arguments at the front
793         of the arguments.
794         (MULTILIB_DEFAULTS): Provide a default definition.
795         (multilib_defaults_raw): New constant array.
796         (gcc::jit::playback::context::add_multilib_driver_arguments): New
797         method.
798         * jit-playback.h
799         (gcc::jit::playback::context::add_multilib_driver_arguments): New
800         method.
801         * docs/internals/test-hello-world.exe.log.txt: Update.
802         * docs/_build/texinfo/libgccjit.texi: Regenerate.
804 2015-07-16  David Malcolm  <dmalcolm@redhat.com>
806         * docs/internals/index.rst (Overview of code structure): Add note
807         that the implementation is in C++, despite the .c extension.
808         (Submitting patches): New subsection.
809         * docs/_build/texinfo/libgccjit.texi: Regenerate.
811 2015-07-09  Andrew MacLeod  <amacleod@redhat.com>
813         * dummy-frontend.c: Adjust includes for flags.h changes.
814         * jit-common.h: Likewise.
815         * jit-playback.c: Likewise.
817 2015-07-08  David Malcolm  <dmalcolm@redhat.com>
819         PR jit/66783
820         * libgccjit.c (gcc_jit_context_new_field): Show name of field in
821         "unknown size" error message.
822         (gcc_jit_struct_set_fields): Show name of struct in error message.
823         (gcc_jit_context_new_global): Show name of global in
824         "unknown size" error message.
825         (gcc_jit_function_new_local): Likewise for local.
827 2015-07-07  Andrew MacLeod  <amacleod@redhat.com>
829         * dummy-frontend.c: Adjust includes.
830         * jit-common.h: Likewise.
831         * jit-playback.c: Likewise.
833 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
835         PR jit/66783
836         * jit-recording.h: Within namespace gcc:jit::recording...
837         (type::has_known_size): New virtual function.
838         (struct_has_known_size): New function.
839         * libgccjit.c (gcc_jit_context_new_field): Verify that the type
840         has a known size.
841         (gcc_jit_context_new_global): Likewise.
842         (gcc_jit_function_new_local): Likewise.
844 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
846         PR jit/66779
847         * dummy-frontend.c (jit_langhook_type_for_mode): Ensure that we
848         handle modes QI, HI, SI, DI, TI.
850 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
852         PR jit/66700
853         * jit-playback.c (jit_mark_addressable): New function.
854         (gcc::jit::playback::lvalue::get_address): Call
855         jit_mark_addressable on the underlying tree.
857 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
859         * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
860         documentation.
861         * docs/_build/texinfo/libgccjit.texi: Regenerate.
863 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
865         * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
866         Clarify lack of lifetime requirements on (const char *) parameter.
867         * docs/topics/expressions.rst
868         (gcc_jit_context_new_string_literal): Likewise.
869         (gcc_jit_context_new_global): Likewise.
870         * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
871         (gcc_jit_context_new_function): Likewise.
872         (gcc_jit_function_new_block): Likewise.
873         (gcc_jit_block_add_comment): Likewise.
874         * docs/topics/locations.rst (gcc_jit_context_new_location):
875         Likewise.
876         * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
877         (gcc_jit_context_new_struct_type): Likewise.
878         * docs/_build/texinfo/libgccjit.texi: Regenerate.
880 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
882         * docs/cp/topics/functions.rst (Blocks): Add switch statements to
883         list of ways to terminate a block.
884         (gccjit::block::end_with_switch): Add function description.
885         (gccjit::case_): Add class.
886         (gccjit::context::new_case): Add function description.
887         * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
888         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
889         * docs/topics/functions.rst (Blocks): Add switch statements to
890         list of ways to terminate a block.
891         (gcc_jit_block_end_with_switch): Add function description.
892         (gcc_jit_case): Add type.
893         (gcc_jit_context_new_case): Add function description.
894         (gcc_jit_case_as_object): Add function description.
895         * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
896         * docs/_build/texinfo/libgccjit.texi: Regenerate.
897         * jit-common.h (gcc::jit::recording::case_): Add forward decl.
898         (gcc::jit::playback::case_): Add forward decl.
899         * jit-playback.c (add_case): New function.
900         (gcc::jit::playback::block::add_switch): New function.
901         * jit-playback.h (gcc::jit::playback::case_): New struct.
902         (gcc::jit::playback::block::get_function): New method.
903         (gcc::jit::playback::block::add_switch): New method.
904         * jit-recording.c: Within namespace gcc::jit...
905         (recording::context::new_case): New method.
906         (recording::function::validate): Update for change to
907         get_successor_blocks.
908         (recording::block::end_with_switch): New method.
909         (recording::block::get_successor_blocks): Update to support an
910         arbitrary number of successor blocks.
911         (recording::block::dump_edges_to_dot): Likewise.
912         (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
913         (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
914         (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
915         (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
916         (recording::statement::get_successor_blocks): Update to support an
917         arbitrary number of successor blocks.
918         (recording::conditional::get_successor_blocks): Likewise.
919         (recording::jump::get_successor_blocks): Likewise.
920         (recording::return_::get_successor_blocks): Likewise.
921         (recording::case_::write_reproducer): New.
922         (recording::case_::make_debug_string): New.
923         (recording::switch_::switch_): New.
924         (recording::switch_::replay_into): New.
925         (recording::switch_::get_successor_blocks): New.
926         (recording::switch_::make_debug_string): New.
927         (recording::switch_::write_reproducer): New.
928         * jit-recording.h: Within namespace gcc::jit::recording...
929         (context::new_case): New.
930         (rvalue::is_constant): New.
931         (rvalue::get_wide_int): New.
932         (block::end_with_switch): New.
933         (block::get_successor_blocks): Update to support an arbitrary
934         number of successor blocks.
935         (memento_of_new_rvalue_from_const::is_constant): New.
936         (memento_of_new_rvalue_from_const::get_wide_int): New.
937         (statement::get_successor_blocks): Update to support an arbitrary
938         number of successor blocks.
939         (conditional::get_successor_blocks): Likewise.
940         (jump::get_successor_blocks): Likewise.
941         (return_::get_successor_blocks): Likewise.
942         (case_): New subclass of memento.
943         (switch_): New subclass of statement.
944         * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
945         (gccjit::context::new_case): New method.
946         (gccjit::block::end_with_switch): New method.
947         (gccjit::case_::case): New ctors.
948         (gccjit::case_::get_inner_case): New method.
949         * libgccjit.c: Include "typed-splay-tree.h"
950         (struct gcc_jit_case): New.
951         (gcc_jit_context_new_case): New function.
952         (gcc_jit_case_as_object): New function.
953         (valid_dest_for_switch): New function.
954         (valid_case_for_switch): New function.
955         (class api_call_validator): New class.
956         (class case_range_validator): New class.
957         (case_range_validator::case_range_validator): New.
958         (case_range_validator::validate): New.
959         (case_range_validator::case_compare): New.
960         (case_range_validator::get_wide_int): new.
961         (gcc_jit_block_end_with_switch): New.
962         * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
963         (gcc_jit_case): New typedef.
964         (gcc_jit_context_new_case): New function.
965         (gcc_jit_case_as_object): New function.
966         (gcc_jit_block_end_with_switch): New function.
967         (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
968         * libgccjit.map: Add gcc_jit_block_end_with_switch,
969         gcc_jit_case_as_object and gcc_jit_context_new_case.
971 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
973         PR jit/66546
974         * docs/cp/topics/contexts.rst
975         (gccjit::context::set_bool_allow_unreachable_blocks): New.
976         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
977         * docs/topics/contexts.rst (Options): Add notes discussing the
978         transition from enums to entrypoints for new options.
979         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
980         * docs/_build/texinfo/libgccjit.texi: Regenerate.
981         * jit-common.h (gcc::jit::inner_bool_option): New enum.
982         * jit-recording.c: Within namespace gcc::jit...
983         (recording::context::context): Handle m_inner_bool_options.
984         (recording::context::set_inner_bool_option): New.
985         (inner_bool_option_reproducer_strings): New.
986         (recording::context::log_all_options): Log the "inner" bool
987         options.
988         (recording::context::log_inner_bool_option): New.
989         (recording::context::dump_reproducer_to_file): Write initializers
990         for "inner" bool options.
991         (recording::function::validate): Don't check for block
992         reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
993         * jit-recording.h: Within namespace gcc::jit...
994         (recording::context::set_inner_bool_option): New.
995         (recording::context::get_inner_bool_option): New.
996         (recording::context::log_inner_bool_option): New.
997         (recording::context::m_inner_bool_options): New.
998         * libgccjit++.h
999         (gccjit::context::set_bool_allow_unreachable_blocks): New.
1000         * libgccjit.c
1001         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
1002         * libgccjit.h: Add note about options present in the
1003         initial release of libgccjit.
1004         (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
1005         entrypoint.
1006         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
1007         New macro.
1008         * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
1009         (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
1010         entrypoint.
1012 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1014         PR jit/66628
1015         * docs/cp/topics/contexts.rst (Additional command-line options):
1016         New section.
1017         * docs/topics/compatibility.rst: New file.
1018         * docs/topics/contexts.rst (Additional command-line options): New
1019         section.
1020         * docs/topics/index.rst: Add compatibility.rst.
1021         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1022         * jit-playback.c (make_fake_args): Add call to
1023         append_command_line_options.
1024         * jit-recording.c: Within namespace gcc::jit...
1025         (recording::context::~context): Free the optnames within
1026         m_command_line_options.
1027         (recording::context::set_bool_option): Likewise.
1028         (recording::context::add_command_line_option): New method.
1029         (recording::context::append_command_line_options): New method.
1030         (recording::context::dump_reproducer_to_file): Add command-line
1031         options.
1032         * jit-recording.h: Within namespace gcc::jit...
1033         (recording::context::add_command_line_option): New method.
1034         (recording::context::append_command_line_options): New method.
1035         (recording::context::m_command_line_options): New field.
1036         * libgccjit++.h (gccjit::context::add_command_line_option): New
1037         method.
1038         * libgccjit.c (gcc_jit_context_add_command_line_option): New API
1039         entrypoint.
1040         * libgccjit.h (gcc_jit_context_add_command_line_option): New API
1041         entrypoint.
1042         (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
1043         macro.
1044         * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
1045         LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
1047 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1049         * jit-recording.c
1050         (gcc::jit::recording::context::dump_reproducer_to_file):
1051         Add pragma to generated reproducers to disable -Wunused-variable.
1052         Fix handling of NULL string options.
1054 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1056         * docs/cp/topics/expressions.rst: Remove stray semicolon.
1057         * docs/cp/topics/functions.rst: Remove stray backslash.
1058         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1060 2015-06-25  Andrew MacLeod  <amacleod@redhat.com>
1062         * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
1063         * jit-playback.c: Likewise.
1065 2015-06-25  Andrew Macleod  <amacleod@redhat.com>
1067         * jit-common.h: Don't include alias.h.
1069 2015-06-17  David Malcolm  <dmalcolm@redhat.com>
1071         * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
1072         is for the correct struct.
1073         (gcc_jit_rvalue_access_field): Likewise.
1075 2015-06-17  Andrew MacLeod  <amacleod@redhat.com>
1077         * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
1078         * jit-common.h: Likewise.
1079         * jit-playback.c: Likewise.
1081 2015-06-16  David Malcolm  <dmalcolm@redhat.com>
1083         PR jit/66539
1084         * jit-recording.c: Within namespace gcc::jit::recording::
1085         (rvalue::get_debug_string_parens): New function.
1086         (binary_op::make_debug_string): Update to mimic C precedence
1087         rules.
1088         (binary_op_precedence): New array.
1089         (binary_op::get_precedence): New function.
1090         (comparison::make_debug_string): Update to mimic C precedence
1091         rules.
1092         (comparison_precedence): New array.
1093         (comparison::get_precedence): New function.
1094         (cast::make_debug_string): Update to mimic C precedence rules.
1095         (call::make_debug_string): Likewise.
1096         (call_through_ptr::make_debug_string): Likewise.
1097         (array_access::make_debug_string): Likewise.
1098         (access_field_of_lvalue::make_debug_string): Likewise.
1099         (access_field_rvalue::make_debug_string): Likewise.
1100         (dereference_field_rvalue::make_debug_string): Likewise.
1101         (dereference_rvalue::make_debug_string): Likewise.
1102         (get_address_of_lvalue::make_debug_string): Likewise.
1103         * jit-recording.h: Within namespace gcc::jit::recording::
1104         (precedence): New enum.
1105         (rvalue::rvalue): Initialize field "m_parenthesized_string".
1106         (rvalue::get_debug_string_parens): New method.
1107         (rvalue::get_precedence): New pure virtual function.
1108         (rvalue::m_parenthesized_string): New field.
1109         (param::get_precedence): New function.
1110         (global::get_precedence): New function.
1111         (memento_of_new_rvalue_from_const::get_precedence): New function.
1112         (memento_of_new_string_literal::get_precedence): New function.
1113         (unary_op::get_precedence): New function.
1114         (binary_op::get_precedence): New function.
1115         (comparison::get_precedence): New function.
1116         (cast::get_precedence): New function.
1117         (call::get_precedence): New function.
1118         (call_through_ptr::get_precedence): New function.
1119         (array_access::get_precedence): New function.
1120         (access_field_of_lvalue::get_precedence): New function.
1121         (access_field_rvalue::get_precedence): New function.
1122         (dereference_field_rvalue::get_precedence): New function.
1123         (dereference_rvalue::get_precedence): New function.
1124         (get_address_of_lvalue::get_precedence): New function.
1125         (local::get_precedence): New function.
1127 2015-06-09  Matthias Klose  <doko@ubuntu.com>
1129         * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
1131 2015-06-08  Andrew MacLeod  <amacleod@redhat.com>
1133         * dummy-frontend.c : Adjust include files.
1134         * jit-common.h : Likewise.
1135         * jit-playback.c : Likewise.
1137 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
1139         * dummy-frontend.c
1140         (jit_langhook_post_compilation_parsing_cleanups): Remove.
1141         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
1142         * jit-playback.c (gcc::jit::playback::context::new_global): Add
1143         call to varpool_node::finalize_decl.
1144         (gcc::jit::playback::context::finalize_global_decls): Remove.
1145         * jit-playback.h
1146         (gcc::jit::playback::context::finalize_global_decls): Remove.
1148 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
1150         * dummy-frontend.c (jit_langhook_write_globals): Rename to...
1151         (jit_langhook_post_compilation_parsing_cleanups): ...this, and
1152         eliminate calls to finalize_compilation_unit and
1153         write_global_decls_2.
1154         (LANG_HOOKS_WRITE_GLOBALS): Rename to...
1155         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
1156         redirect from jit_langhook_write_globals to
1157         jit_langhook_post_compilation_parsing_cleanups.
1158         * jit-playback.c
1159         (gcc::jit::playback::context::write_global_decls_1): Rename to...
1160         (gcc::jit::playback::context::finalize_global_decls): ...this.
1161         (gcc::jit::playback::context::write_global_decls_1): Delete.
1162         * jit-playback.h
1163         (gcc::jit::playback::context::write_global_decls_1): Rename to...
1164         (gcc::jit::playback::context::finalize_global_decls): ...this.
1165         (gcc::jit::playback::context::write_global_decls_1): Delete.
1167 2015-06-04  Andrew MacLeod  <amacleod@redhat.com>
1169         * dummy-frontend.c: Adjust includes for restructured coretypes.h.
1170         * jit-common.h: Likewise.
1171         * jit-playback.c: Likewise.
1173 2015-05-12  David Malcolm  <dmalcolm@redhat.com>
1175         * jit-builtins.c: Include vec.h before target.h.
1177 2015-04-27  Jim Wilson  <jim.wilson@linaro.org>
1179         * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
1180         files.
1182 2015-04-09  David Malcolm  <dmalcolm@redhat.com>
1184         PR jit/65691
1185         * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
1186         and paste error in description of gccjit::context::one.
1187         * docs/topics/expressions.rst (Simple expressions): Likewise in
1188         description of gcc_jit_context_one.
1189         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1191 2015-03-13  Uros Bizjak  <ubizjak@gmail.com>
1193         * jit-recording.c (dump::write): Also check vasprintf return value.
1194         (recording::context::add_error_va): Ditto.
1195         (recording::string::from_printf): Ditto.
1197 2015-03-13  David Malcolm  <dmalcolm@redhat.com>
1199         * docs/internals/index.rst (Packaging notes): New section.
1200         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1202 2015-03-05  David Malcolm  <dmalcolm@redhat.com>
1204         * docs/cp/intro/tutorial03.rst: Add missing arguments to
1205         gccjit::block::end_with_conditional call.  Add on_true/on_false
1206         comments.  Tweak the wording.
1207         * docs/intro/tutorial03.rst: Add missing arguments to
1208         gcc_jit_block_end_with_conditional call.  Add some clarifying
1209         comments.
1210         * docs/topics/compilation.rst: Tweak the wording to avoid an
1211         ambiguous use of "this".
1212         * docs/topics/contexts.rst: Fix a typo.
1213         * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
1214         a stray backtick.
1215         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1217 2015-02-24  Thomas Schwinge  <thomas@codesourcery.com>
1219         PR libgomp/64625
1220         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
1221         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
1222         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
1223         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
1224         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
1225         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
1227 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
1229         PR jit/64257
1230         * docs/conf.py (html_theme): Change from 'pyramid'
1231         to 'sphinxdoc'.
1233 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
1235         * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
1236         typo.
1237         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1239 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
1241         * jit-logging.h (gcc::jit::log_user::log): Make const.
1242         * jit-recording.c (gcc::jit::recording::context::set_str_option):
1243         Log the new value of the option.
1244         (gcc::jit::recording::context::set_int_option): Likewise.
1245         (gcc::jit::recording::context::set_bool_option): Likewise.
1246         (gcc::jit::recording::context::compile): Log the value of all
1247         options.
1248         (gcc::jit::recording::context::compile_to_file): Likewise.
1249         (gcc::jit::recording::context::log_all_options): New function.
1250         (gcc::jit::recording::context::log_str_option): New function.
1251         (gcc::jit::recording::context::log_int_option): New function.
1252         (gcc::jit::recording::context::log_bool_option): New function.
1253         * jit-recording.h (gcc::jit::recording::context::log_all_options):
1254         New function.
1255         (gcc::jit::recording::context::log_str_option): New function.
1256         (gcc::jit::recording::context::log_int_option): New function.
1257         (gcc::jit::recording::context::log_bool_option): New function.
1258         * docs/internals/test-hello-world.exe.log.txt: Update for above
1259         changes.
1260         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1262 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
1264         PR jit/64810
1265         * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
1266         (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
1267         * jit-playback.c: Include gcc.h.
1268         (gcc::jit::playback::context::compile): Move mutex acquisition
1269         to before the call to make_fake_args.
1270         (append_arg_from_driver): New function.
1271         (gcc::jit::playback::context::make_fake_args): On the first call,
1272         call into driver_get_configure_time_options to get configure-time
1273         default options and cache them.  Add them to the args for
1274         toplev::main.
1275         * jit-spec.c: New source file.
1276         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
1277         above changes.
1278         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1280 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
1282         PR jit/64810
1283         * dummy-frontend.c (jit_langhook_type_for_mode): Support
1284         TYPE_MODE (long_long_integer_type_node).
1286 2015-01-27  David Malcolm  <dmalcolm@redhat.com>
1288         * docs/internals/test-hello-world.exe.log.txt: Add example version
1289         lines.
1290         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1291         * jit-common.h (gcc::jit::dump::get_file): New accessor.
1292         * jit-logging.c: Include toplev.h.
1293         (gcc::jit::logger::logger): Log the GCC version.
1294         * jit-recording.c: Include toplev.h.
1295         (gcc:jit::recording::context::dump_reproducer_to_file): Log the
1296         GCC version.
1298 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
1300         * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
1301         * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
1302         error buffer is only valid until the next call to the context.
1303         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1304         * libgccjit.h (gcc_jit_context_get_first_error): Reword the
1305         comment to omit mention of compiling.
1306         (gcc_jit_context_get_last_error): The error buffer is only valid
1307         until the next call to the context.
1309 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
1311         PR jit/64708
1312         * config-lang.in (compilers): Drop "libgccjit.so".
1314 2015-01-23  David Malcolm  <dmalcolm@redhat.com>
1316         PR jit/64721
1317         * jit-playback.c (gcc::jit::playback::context::compile): Construct
1318         toplev instances with init_signals=false.
1320 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
1322         * docs/cp/topics/results.rst: Rename to...
1323         * docs/cp/topics/compilation.rst: ...this, and add section on
1324         ahead-of-time compilation.
1325         * docs/cp/topics/index.rst: Update for renaming of results.rst
1326         to compilation.rst.
1327         * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
1328         script.
1329         * docs/examples/tut05-bf.c: New file, implementing a compiler
1330         for "brainf".
1331         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
1332         changes to logger output.
1333         * docs/intro/index.rst: Add tutorial05.rst
1334         * docs/intro/tutorial05.rst: New file.
1335         * docs/topics/results.rst: Rename to...
1336         * docs/topics/compilation.rst: ...this, and add section on
1337         ahead-of-time compilation.
1338         * docs/topics/index.rst: Update for renaming of results.rst to
1339         compilation.rst.
1340         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1341         * jit-playback.c (gcc::jit::playback::context::compile): Convert
1342         return type from result * to void.  Move the code to convert to
1343         dso and dlopen the result to a new pure virtual "postprocess"
1344         method.
1345         (gcc::jit::playback::compile_to_memory::compile_to_memory): New
1346         function.
1347         (gcc::jit::playback::compile_to_memory::postprocess): New
1348         function, based on playback::context::compile.
1349         (gcc::jit::playback::compile_to_file::compile_to_file): New
1350         function.
1351         (gcc::jit::playback::compile_to_file::postprocess): New function.
1352         (gcc::jit::playback::compile_to_file::copy_file): New function.
1353         (gcc::jit::playback::context::convert_to_dso): Move internals
1354         to...
1355         (gcc::jit::playback::context::invoke_driver): New method.  Add
1356         "-shared" and "-c" options to driver's argv as needed.
1357         * jit-playback.h: Include "timevar.h".
1358         (gcc::jit::playback::context::compile): Convert return type from
1359         result * to void.
1360         (gcc::jit::playback::context::postprocess): New pure virtual
1361         function, making this an abstract base class.
1362         (gcc::jit::playback::context::get_tempdir): New accessor.
1363         (gcc::jit::playback::context::invoke_driver): New function.
1364         (class gcc::jit::playback::compile_to_memory): New subclass of
1365         playback::context.
1366         (class gcc::jit::playback::compile_to_file): Likewise.
1367         * jit-recording.c (gcc::jit::recording::context::compile): Use a
1368         playback::compile_to_memory, and extract its result.
1369         (gcc::jit::recording::context::compile_to_file): New function.
1370         * jit-recording.h (gcc::jit::recording::context::compile_to_file):
1371         New function.
1372         * libgccjit++.h (gccjit::context::compile_to_file): New method.
1373         * libgccjit.c (gcc_jit_context_compile): Update log message to
1374         clarify that this is an in-memory compile.
1375         (gcc_jit_context_compile_to_file): New function.
1376         * libgccjit.h (gcc_jit_context): Clarify that you can compile
1377         a context more than once, and that you can compile to a file
1378         as well as to memory.
1379         (gcc_jit_result): Clarify that this is the result of an
1380         in-memory compilation.
1381         (gcc_jit_context_compile): Clarify that you can compile, and that
1382         this is an in-memory compilation.
1383         (enum gcc_jit_output_kind): New enum.
1384         (gcc_jit_context_compile_to_file): New function.
1385         (gcc_jit_context_enable_dump): Clarify comment to cover both forms
1386         of compilation.
1387         * libgccjit.map (gcc_jit_context_compile_to_file): New API
1388         entrypoint.
1389         * notes.txt: Update to show the playback::context::postprocess
1390         virtual function.
1392 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
1394         * jit-recording.c
1395         (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
1396         Add missing format string.
1398 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
1400         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
1401         (check_jit_parallelize): Set this to an arbitrary value (10).
1403 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
1405         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
1406         last argument.
1407         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
1408         undef afterwards.
1409         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
1410         Likewise.
1412 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
1414         Update copyright years in docs/.
1416 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
1418         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
1419         lvalue and the rvalue are of compatible type.
1421 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
1423         * docs/cp/topics/contexts.rst (Debugging): Add
1424         gccjit::context::dump_reproducer_to_file.
1425         * docs/internals/index.rst (Design notes): New section,
1426         discussing input validation and
1427         gcc_jit_context_dump_reproducer_to_file.
1428         * docs/topics/contexts.rst (Debugging): Add
1429         gcc_jit_context_dump_reproducer_to_file.
1430         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1431         * jit-common.h (gcc::jit::dump::get_context): New accessor.
1432         * jit-recording.c: Include "hash-map.h".
1433         Within namespace ::gcc::jit...
1434         (dump::write): Flush each line.
1435         (dump::make_location): Pass false for new param "created_by_user".
1436         (class allocator): New class.
1437         (allocator::~allocator): New function.
1438         (allocator::xstrdup_printf): New function.
1439         (allocator::xstrdup_printf_va): New function.
1440         (class reproducer): New subclass of dump.
1441         (reproducer::reproducer): New function.
1442         (reproducer::write_params): New function.
1443         (reproducer::write_args): New function.
1444         (reproducer::make_identifier): New function.
1445         (reproducer::make_tmp_identifier): New function.
1446         (reproducer::get_identifier): New pair of functions.
1447         (reproducer::get_identifier_as_rvalue): New function.
1448         (reproducer::get_identifier_as_lvalue): New function.
1449         (reproducer::get_identifier_as_type): New function.
1450         (reproducer::xstrdup_printf): New function.
1451         (recording::context::context): Initialize m_toplevel_ctxt.
1452         (recording::context::new_location): Add param created_by_user.
1453         (str_option_reproducer_strings): New table of strings.
1454         (int_option_reproducer_strings): Likewise.
1455         (bool_option_reproducer_strings): Likewise.
1456         (get_type_enum_strings): Likewise.
1457         (names_of_function_kinds): Likewise.
1458         (global_kind_reproducer_strings): Likewise.
1459         (unary_op_reproducer_strings): Likewise.
1460         (binary_op_reproducer_strings): Likewise.
1461         (comparison_reproducer_strings): Likewise.
1462         Within namespace ::gcc::jit::recording::...
1463         (context::dump_reproducer_to_file): New function.
1464         (string::write_reproducer): Likewise.
1465         (location::write_reproducer): Likewise.
1466         (type::access_as_type): Likewise.
1467         (memento_of_get_type::write_reproducer): Likewise.
1468         (memento_of_get_pointer::write_reproducer): Likewise.
1469         (memento_of_get_const::write_reproducer): Likewise.
1470         (memento_of_get_volatile::write_reproducer): Likewise.
1471         (array_type::write_reproducer): Likewise.
1472         (function_type::write_reproducer): Likewise.
1473         (function_type::write_deferred_reproducer): Likewise.
1474         (field::write_reproducer): Likewise.
1475         (struct_::access_as_type): Likewise.
1476         (struct_::write_reproducer): Likewise.
1477         (union_::write_reproducer): Likewise.
1478         (fields::write_reproducer): Likewise.
1479         (rvalue::access_as_rvalue): Likewise.
1480         (lvalue::access_as_rvalue): Likewise.
1481         (lvalue::access_as_lvalue): Likewise.
1482         (param::access_as_rvalue): Likewise.
1483         (param::access_as_lvalue): Likewise.
1484         (param::write_reproducer): Likewise.
1485         (function::write_reproducer): Likewise.
1486         (block::write_reproducer): Likewise.
1487         (global::write_reproducer): Likewise.
1488         (memento_of_new_rvalue_from_const <int>::write_reproducer):
1489         Likewise.
1490         (memento_of_new_rvalue_from_const <long>::write_reproducer):
1491         Likewise.
1492         (memento_of_new_rvalue_from_const <double>::write_reproducer):
1493         Likewise.
1494         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
1495         Likewise.
1496         (memento_of_new_string_literal::write_reproducer): Likewise.
1497         (unary_op::write_reproducer): Likewise.
1498         (binary_op::write_reproducer): Likewise.
1499         (comparison::write_reproducer): Likewise.
1500         (cast::write_reproducer): Likewise.
1501         (call::write_reproducer): Likewise.
1502         (call_through_ptr::write_reproducer): Likewise.
1503         (array_access::write_reproducer): Likewise.
1504         (access_field_of_lvalue::write_reproducer): Likewise.
1505         (access_field_rvalue::write_reproducer): Likewise.
1506         (dereference_field_rvalue::write_reproducer): Likewise.
1507         (dereference_rvalue::write_reproducer): Likewise.
1508         (get_address_of_lvalue::write_reproducer): Likewise.
1509         (local::write_reproducer): Likewise.
1510         (eval::write_reproducer): Likewise.
1511         (assignment::write_reproducer): Likewise.
1512         (assignment_op::write_reproducer): Likewise.
1513         (comment::write_reproducer): Likewise.
1514         (conditional::write_reproducer): Likewise.
1515         (jump::write_reproducer): Likewise.
1516         (return_::write_reproducer): Likewise.
1517         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
1518         Within namespace ::gcc::jit::recording::...
1519         (context::new_location): Add "created_by_user" param.
1520         (context::dump_reproducer_to_file): New method.
1521         (context::m_toplevel_ctxt): New field.
1522         (memento::write_reproducer): New pure virtual function.
1523         (memento::dyn_cast_location): New virtual function.
1524         (string::write_reproducer):
1525         (location::location): Add "created_by_user" param.
1526         (location::dyn_cast_location): New function.
1527         (location::created_by_user): New accessor.
1528         (location::write_reproducer): New function.
1529         (location::m_created_by_user): New field.
1530         (type::access_as_type): New virtual function.
1531         (location::write_reproducer): Likewise.
1532         (type::access_as_type): Likewise.
1533         (memento_of_get_type::write_reproducer): Likewise.
1534         (memento_of_get_pointer::write_reproducer): Likewise.
1535         (memento_of_get_const::write_reproducer): Likewise.
1536         (memento_of_get_volatile::write_reproducer): Likewise.
1537         (array_type::write_reproducer): Likewise.
1538         (function_type::write_reproducer): Likewise.
1539         (function_type::write_deferred_reproducer): Likewise.
1540         (field::write_reproducer): Likewise.
1541         (struct_::access_as_type): Likewise.
1542         (struct_::write_reproducer): Likewise.
1543         (union_::write_reproducer): Likewise.
1544         (union_::m_fields): Remove stray unused field.
1545         (fields::length): New accessor.
1546         (fields::get_field): New accessor.
1547         (fields::write_reproducer): New function.
1548         (rvalue::access_as_rvalue): Likewise.
1549         (lvalue::access_as_rvalue): Likewise.
1550         (lvalue::access_as_lvalue): Likewise.
1551         (param::access_as_rvalue): Likewise.
1552         (param::access_as_lvalue): Likewise.
1553         (param::write_reproducer): Likewise.
1554         (function::write_reproducer): Likewise.
1555         (block::write_reproducer): Likewise.
1556         (global::write_reproducer): Likewise.
1557         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
1558         Likewise.
1559         (memento_of_new_string_literal::write_reproducer): Likewise.
1560         (unary_op::write_reproducer): Likewise.
1561         (binary_op::write_reproducer): Likewise.
1562         (comparison::write_reproducer): Likewise.
1563         (cast::write_reproducer): Likewise.
1564         (call::write_reproducer): Likewise.
1565         (call_through_ptr::write_reproducer): Likewise.
1566         (array_access::write_reproducer): Likewise.
1567         (access_field_of_lvalue::write_reproducer): Likewise.
1568         (access_field_rvalue::write_reproducer): Likewise.
1569         (dereference_field_rvalue::write_reproducer): Likewise.
1570         (dereference_rvalue::write_reproducer): Likewise.
1571         (get_address_of_lvalue::write_reproducer): Likewise.
1572         (local::write_reproducer): Likewise.
1573         (eval::write_reproducer): Likewise.
1574         (assignment::write_reproducer): Likewise.
1575         (assignment_op::write_reproducer): Likewise.
1576         (comment::write_reproducer): Likewise.
1577         (conditional::write_reproducer): Likewise.
1578         (jump::write_reproducer): Likewise.
1579         (return_::write_reproducer): Likewise.
1580         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
1581         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
1582         param "created_by_user".
1583         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
1584         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
1585         entrypoint.
1586         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
1587         entrypoint.
1589 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1591         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
1592         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
1593         ctor.
1594         (gcc::jit::rvalue_usage_validator::visit): New function.
1595         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
1596         function.
1597         (gcc::jit::recording::rvalue::set_scope): New function.
1598         (gcc::jit::recording::function::function): Call set_scope on each
1599         param, issuing errors for any params that already have a function.
1600         (gcc::jit::recording::block::add_eval): Return the new statement;
1601         update the comment given that some error-checking now happens after
1602         this returns.
1603         (gcc::jit::recording::block::add_assignment): Likewise.
1604         (gcc::jit::recording::block::add_assignment_op): Likewise.
1605         (gcc::jit::recording::block::add_comment): Likewise.
1606         (gcc::jit::recording::block::end_with_conditional): Likewise.
1607         (gcc::jit::recording::block::end_with_jump): Likewise.
1608         (gcc::jit::recording::block::end_with_return): Likewise.
1609         (gcc::jit::recording::block::validate): Add a comment.
1610         (gcc::jit::recording::unary_op::visit_children): New function.
1611         (gcc::jit::recording::binary_op::visit_children): New function.
1612         (gcc::jit::recording::comparison::visit_children): New function.
1613         (gcc::jit::recording::cast::visit_children): New function.
1614         (gcc::jit::recording::call::visit_children): New function.
1615         (gcc::jit::recording::call_through_ptr::visit_children): New function.
1616         (gcc::jit::recording::array_access::visit_children): New function.
1617         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
1618         function.
1619         (gcc::jit::recording::access_field_rvalue::visit_children): New
1620         function.
1621         (gcc::jit::recording::dereference_field_rvalue::visit_children):
1622         New function.
1623         (gcc::jit::recording::dereference_rvalue::visit_children): New
1624         function.
1625         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
1626         function.
1627         * jit-recording.h: Within namespace gcc::jit::recording...
1628         (class rvalue_visitor): New.
1629         (rvalue::rvalue): Initialize m_scope.
1630         (rvalue::get_loc): New accessor.
1631         (rvalue::verify_valid_within_stmt): New function.
1632         (rvalue::visit_children): New pure virtual function.
1633         (rvalue::set_scope): New function.
1634         (rvalue::get_scope): New function.
1635         (rvalue::dyn_cast_param): New function.
1636         (rvalue::m_scope): New field.
1637         (param::visit_children): New empty function.
1638         (param::dyn_cast_param): New function.
1639         (function::get_loc): New function.
1640         (block::add_eval): Return the new statement.
1641         (block::add_assignment): Likewise.
1642         (block::add_assignment_op): Likewise.
1643         (block::add_comment): Likewise.
1644         (block::end_with_conditional): Likewise.
1645         (block::end_with_jump): Likewise.
1646         (block::end_with_return): Likewise.
1647         (global::visit_children): New function.
1648         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
1649         New function.
1650         (memento_of_new_string_literal::visit_children): New function.
1651         (unary_op::visit_children): New function.
1652         (binary_op::visit_children): New function.
1653         (comparison::visit_children): New function.
1654         (cast::visit_children): New function.
1655         (call::visit_children): New function.
1656         (call_through_ptr::visit_children): New function.
1657         (array_access::visit_children): New function.
1658         (access_field_of_lvalue::visit_children): New function.
1659         (access_field_rvalue::visit_children): New function.
1660         (dereference_field_rvalue::visit_children): New function.
1661         (dereference_rvalue::visit_children): New function.
1662         (get_address_of_lvalue::visit_children): New function.
1663         (local::local): Call set_scope.
1664         (local::visit_children): New function.
1665         (statement::get_block): Make public.
1666         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
1667         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
1668         (gcc_jit_context_new_function): Verify that each param has
1669         not yet been used for creating another function.
1670         (gcc_jit_block_add_eval): After creating the stmt, verify
1671         that the rvalue expression tree is valid to use within it.
1672         (gcc_jit_block_add_assignment): Likewise for the lvalue and
1673         rvalue expression trees.
1674         (gcc_jit_block_add_assignment_op): Likewise.
1675         (gcc_jit_block_end_with_conditional): Likewise for the boolval
1676         expression tree.
1677         (gcc_jit_block_end_with_return): Likewise for the rvalue
1678         expression tree.
1679         (gcc_jit_block_end_with_void_return): Remove return of "void",
1680         now that block::end_with_return is now non-void.
1682 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1684         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
1685         Add missing fclose on error-handling path.
1687 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1689         * docs/cp/topics/expressions.rst (Global variables): Add
1690         enum gcc_jit_global_kind param to gccjit::context::new_global.
1691         * docs/topics/expressions.rst (Global variables): Likewise.
1692         Document the new enum.
1693         * docs/topics/results.rst (Compilation results): Document
1694         globals-handling.
1695         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1696         * dummy-frontend.c (jit_langhook_write_globals): Call into the
1697         playback context's write_global_decls_1 and write_global_decls_2
1698         before and after calling symtab->finalize_compilation_unit ().
1699         * jit-playback.c: Include "debug.h".
1700         (gcc::jit::playback::context::new_global): Add "kind" param and
1701         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
1702         underlying VAR_DECL.  Call varpool_node::get_create on the
1703         VAR_DECL, and add it to m_globals.
1704         (gcc::jit::playback::context::write_global_decls_1): New function.
1705         (gcc::jit::playback::context::write_global_decls_2): New function.
1706         * jit-playback.h (gcc::jit::playback::context::context): Call
1707         create on m_globals.
1708         (gcc::jit::playback::context::new_global): Add "kind" param.
1709         (gcc::jit::playback::context::write_global_decls_1): New function.
1710         (gcc::jit::playback::context::write_global_decls_2): New function.
1711         (gcc::jit::playback::context::m_globals): New field.
1712         * jit-recording.c (gcc::jit::recording::context::context):
1713         Initialize m_globals.
1714         (gcc::jit::recording::context::new_global): Add param "kind".
1715         Add the new global to m_globals.
1716         (gcc::jit::recording::context::dump_to_file): Dump the globals.
1717         (gcc::jit::recording::global::replay_into): Add field m_kind.
1718         (gcc::jit::recording::global::write_to_dump): New override.
1719         * jit-recording.h (gcc::jit::recording::context::new_global): Add
1720         param "kind".
1721         (gcc::jit::recording::context::m_globals): New field.
1722         (gcc::jit::recording::global::global): Add param kind.
1723         (gcc::jit::recording::global::write_to_dump): New override.
1724         (gcc::jit::recording::global::m_kind): New field.
1725         * jit-result.c (gcc::jit::result::get_global): New function.
1726         * jit-result.h (gcc::jit::result::get_global): New function.
1727         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
1728         * libgccjit.c (gcc_jit_context_new_global): Likewise.
1729         (gcc_jit_result_get_global): New API entrypoint.
1730         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
1731         (enum gcc_jit_global_kind): New enum.
1732         (gcc_jit_context_new_global): API change: add "kind" param.
1733         * libgccjit.map (gcc_jit_result_get_global): New symbol.
1735 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1737         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
1738         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
1739         earlier.
1740         * jit-builtins.c: Remove redundant includes of "opts.h" and
1741         "tree.h".
1742         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
1743         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
1744         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
1745         "statistics.h", "vec.h", "double-int.h", "real.h",
1746         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
1747         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
1748         earlier.
1749         * jit-recording.c: Remove redundant includes of "opts.h" and
1750         "tree.h".
1752 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1754         * docs/cp/topics/expressions.rst (Simple expressions): Use
1755         ":c:type:" for C types.  Document new overload of
1756         gcc::jit::context::new_rvalue.
1757         * docs/topics/expressions.rst (Simple expressions): Use
1758         ":c:type:" for C types.  Document new entrypoint
1759         gcc_jit_context_new_rvalue_from_long.
1760         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1761         * jit-playback.c: Within namespace gcc::jit::playback...
1762         (context::new_rvalue_from_int): Eliminate in favor of...
1763         (context::new_rvalue_from_const <int>): ...this.
1764         (context::new_rvalue_from_double): Eliminate in favor of...
1765         (context::new_rvalue_from_const <double>): ...this.
1766         (context::new_rvalue_from_const <long>): New.
1767         (context::new_rvalue_from_ptr): Eliminate in favor of...
1768         (context::new_rvalue_from_const <void *>): ...this.
1769         * jit-playback.h: Within namespace gcc::jit::playback...
1770         (context::new_rvalue_from_int): Eliminate in favor of...
1771         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
1772         (context::new_rvalue_from_double): Likewise.
1773         (context::new_rvalue_from_ptr): Likewise.
1774         * jit-recording.c: Within namespace gcc::jit::recording...
1775         (context::new_rvalue_from_int): Eliminate.
1776         (context::new_rvalue_from_double): Likewise.
1777         (context::new_rvalue_from_ptr): Likewise.
1778         (class memento_of_new_rvalue_from_const <int>):
1779         Add explicit specialization.
1780         (class memento_of_new_rvalue_from_const <long>):
1781         Likewise.
1782         (class memento_of_new_rvalue_from_const <double>):
1783         Likewise.
1784         (class memento_of_new_rvalue_from_const <void *>):
1785         Likewise.
1786         (memento_of_new_rvalue_from_int::replay_into):
1787         Generalize into...
1788         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
1789         ...this...
1790         (memento_of_new_rvalue_from_double::replay_into):
1791         ...allowing this...
1792         (memento_of_new_rvalue_from_ptr::replay_into):
1793         ...and this to be deleted.
1794         (memento_of_new_rvalue_from_int::make_debug_string):
1795         Convert to...
1796         (memento_of_new_rvalue_from_const <int>::make_debug_string):
1797         ...this.
1798         (memento_of_new_rvalue_from_double::make_debug_string):
1799         Convert to...
1800         (memento_of_new_rvalue_from_const <double>::make_debug_string):
1801         ...this.
1802         (memento_of_new_rvalue_from_ptr::make_debug_string)
1803         Convert to...
1804         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
1805         ...this.
1806         (memento_of_new_rvalue_from_const <long>::make_debug_string):
1807         New function.
1808         * jit-recording.h: Within namespace gcc::jit::recording...
1809         (context::new_rvalue_from_int): Eliminate.
1810         (context::new_rvalue_from_double): Likewise.
1811         (context::new_rvalue_from_ptr): Likewise, all in favor of...
1812         (context::new_rvalue_from_const <HOST_TYPE>): New family of
1813         methods.
1814         (class memento_of_new_rvalue_from_int): Eliminate.
1815         (class memento_of_new_rvalue_from_double): Likewise.
1816         (class memento_of_new_rvalue_from_ptr): Likewise.
1817         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
1818         of rvalue subclasses.
1819         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
1820         "long".
1821         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
1822         rewriting of recording::context::new_rvalue_from_int to
1823         recording::context::new_rvalue_from_const <int>.
1824         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
1825         (gcc_jit_context_new_rvalue_from_double): Update for
1826         rewriting of recording::context::new_rvalue_from_double to
1827         recording::context::new_rvalue_from_const <double>.
1828         (gcc_jit_context_new_rvalue_from_ptr): Update for
1829         rewriting of recording::context::new_rvalue_from_ptr to
1830         recording::context::new_rvalue_from_const <void *>.
1831         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
1832         entrypoint.
1833         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
1835 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1837         PR jit/64206
1838         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
1839         shows tempdir creation/cleanup.
1840         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1841         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
1842         to the list of subclasses in the comment.
1843         * jit-playback.c (gcc::jit::playback::context::context): Add a
1844         comment clarifying when the tempdir gets cleaned up.
1845         (gcc::jit::playback::context::compile): Pass the context's logger,
1846         if any, to the tempdir.
1847         (gcc::jit::playback::context::dlopen_built_dso): When creating the
1848         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
1849         over ownership of the tempdir to it.
1850         * jit-result.c: Include "jit-tempdir.h".
1851         (gcc::jit::result::result): Add tempdir param, saving it as
1852         m_tempdir.
1853         (gcc::jit::result::~result): Delete m_tempdir.
1854         * jit-result.h (gcc::jit::result::result): Add tempdir param.
1855         (gcc::jit::result::m_tempdir): New field.
1856         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
1857         add JIT_LOG_SCOPE.
1858         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
1859         and log m_path_template and m_path_tempdir.
1860         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
1861         entry/exit, and log the unlink and rmdir calls.
1862         * jit-tempdir.h: Include "jit-logging.h".
1863         (class gcc::jit::tempdir): Make this be a subclass of log_user.
1864         (gcc::jit::tempdir::tempdir): Add logger param.
1865         * notes.txt: Update to show the two possible places where the
1866         tempdir can be cleaned up.
1868 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1870         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
1871         comment.
1873 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1875         * docs/topics/contexts.rst (Error-handling): Document new
1876         entrypoint gcc_jit_context_get_last_error.
1877         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1878         * jit-recording.c (gcc::jit::recording::context::context):
1879         Initialize new fields "m_last_error_str" and
1880         "m_owns_last_error_str".
1881         (gcc::jit::recording::context::~context): Clean up
1882         m_last_error_str, if needed.
1883         (gcc::jit::recording::context::add_error_va): Update
1884         m_last_error_str and m_owns_last_error_str, freeing the old
1885         value if appropriate.
1886         (gcc::jit::recording::context::get_last_error): New function.
1887         * jit-recording.h (gcc::jit::recording::context::get_last_error):
1888         New function.
1889         (gcc::jit::recording::context): New fields m_last_error_str and
1890         m_owns_last_error_str.
1891         * libgccjit.c (gcc_jit_context_get_last_error): New function.
1892         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1893         * libgccjit.map (gcc_jit_context_get_last_error): New function.
1895 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1897         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1898         * docs/internals/index.rst (Overview of code structure): Mention
1899         gcc_jit_context_set_logfile, and embed the example logfile.
1900         * docs/internals/test-hello-world.exe.log.txt: New file: example
1901         of a logfile.
1902         * docs/topics/contexts.rst (Debugging): Add documentation
1903         for gcc_jit_context_set_logfile.
1904         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1905         * dummy-frontend.c: Include "jit-logging.h".
1906         (jit_langhook_init): Assert that there is an active playback
1907         context.  If it has a logger, log entry/exit to this function.
1908         (jit_langhook_write_globals): Likewise.
1909         * jit-common.h (gcc::jit::logger): New forward declaration.
1910         * jit-logging.c: New file.
1911         * jit-logging.h: New file.
1912         * jit-playback.c: Include "jit-logging.h".
1913         (gcc::jit::playback::context::context): Initialize the log_user
1914         base class from the recording context's logger (if any).  Use
1915         JIT_LOG_SCOPE to log entry/exit from the function body.
1916         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1917         log entry/exit from the function body.
1918         (gcc::jit::playback::build_stmt_list): Likewise.
1919         (gcc::jit::playback::function::postprocess): Likewise.
1920         (gcc::jit::playback::context::compile): Likewise.  Log the
1921         entry/exit to toplev::main and toplev::finalize.  Log the
1922         fake argv passed to toplev::main.
1923         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1924         log entry/exit from the function body.
1925         (gcc::jit::playback::context::release_mutex): Likewise.
1926         (gcc::jit::playback::context::make_fake_args): Likewise.
1927         (gcc::jit::playback::context::extract_any_requested_dumps):
1928         Likewise.
1929         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1930         log the arguments that the driver is invoked with.
1931         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
1932         the logger to the result object.
1933         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1934         log entry/exit from the function body.
1935         (gcc::jit::playback::context::dump_generated_code): Likewise.
1936         (gcc::jit::playback::context::handle_locations): Likewise.
1937         * jit-playback.h (gcc::jit::playback::context): Make this be
1938         a subclass of gcc::jit::log_user.
1939         * jit-recording.c: Include "jit-logging.h".
1940         (gcc::jit::recording::context::context: Initialize the logger to
1941         NULL for root contexts, or to the parent's logger for child
1942         contexts.
1943         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1944         log entry/exit from the function body.
1945         (gcc::jit::recording::context::replay_into): Likewise.
1946         (gcc::jit::recording::context::disassociate_from_playback):
1947         Likewise.
1948         (gcc::jit::recording::context::compile): Likewise.
1949         (recording::context::add_error_va): Likewise.  Also, log the
1950         error.
1951         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1952         log entry/exit from the function body.
1953         * jit-recording.h: Include "jit-logging.h".
1954         (gcc::jit::recording::context): Make this be a subclass of
1955         gcc::jit::log_user.
1956         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1957         (gcc::jit::result::result): Add logger param, recording it.
1958         Use JIT_LOG_SCOPE to log entry/exit from the function body.
1959         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1960         log entry/exit from the function body.
1961         (gcc::jit::result::get_code): Likewise.
1962         * jit-result.h (gcc::jit::result): Make this be a subclass of
1963         gcc::jit::log_user.
1964         (gcc::jit::result::result): Add logger parameter.
1965         * libgccjit++.h (gccjit::context::set_logfile): New function.
1966         * libgccjit.c: Include "jit-logging.h".
1967         (gcc_jit_context_acquire): Log the context.
1968         (gcc_jit_context_release): Use JIT_LOG_FUNC to
1969         log entry/exit from the function body, and log the context.
1970         (gcc_jit_context_new_child_context): Likewise, logging both
1971         contexts.
1972         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1973         log entry/exit from the function body.
1974         (gcc_jit_context_get_type): Likewise.
1975         (gcc_jit_context_get_int_type): Likewise.
1976         (gcc_jit_context_new_array_type): Likewise.
1977         (gcc_jit_context_new_field): Likewise.
1978         (gcc_jit_context_new_struct_type): Likewise.
1979         (gcc_jit_context_new_opaque_struct): Likewise.
1980         (gcc_jit_struct_set_fields): Likewise.
1981         (gcc_jit_context_new_union_type): Likewise.
1982         (gcc_jit_context_new_function_ptr_type): Likewise.
1983         (gcc_jit_context_new_param): Likewise.
1984         (gcc_jit_context_new_function): Likewise.
1985         (gcc_jit_context_get_builtin_function): Likewise.
1986         (gcc_jit_function_get_param): Likewise.
1987         (gcc_jit_function_dump_to_dot): Likewise.
1988         (gcc_jit_function_new_block): Likewise.
1989         (gcc_jit_context_new_global): Likewise.
1990         (gcc_jit_context_new_rvalue_from_int): Likewise.
1991         (gcc_jit_context_zero): Likewise.
1992         (gcc_jit_context_one): Likewise.
1993         (gcc_jit_context_new_rvalue_from_double): Likewise.
1994         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1995         (gcc_jit_context_null): Likewise.
1996         (gcc_jit_context_new_string_literal): Likewise.
1997         (gcc_jit_context_new_unary_op): Likewise.
1998         (gcc_jit_context_new_binary_op): Likewise.
1999         (gcc_jit_context_new_comparison): Likewise.
2000         (gcc_jit_context_new_call): Likewise.
2001         (gcc_jit_context_new_call_through_ptr): Likewise.
2002         (gcc_jit_context_new_cast): Likewise.
2003         (gcc_jit_context_new_array_access): Likewise.
2004         (gcc_jit_lvalue_access_field): Likewise.
2005         (gcc_jit_rvalue_access_field): Likewise.
2006         (gcc_jit_rvalue_dereference_field): Likewise.
2007         (gcc_jit_rvalue_dereference): Likewise.
2008         (gcc_jit_lvalue_get_address): Likewise.
2009         (gcc_jit_function_new_local): Likewise.
2010         (gcc_jit_block_add_eval): Likewise.
2011         (gcc_jit_block_add_assignment): Likewise.
2012         (gcc_jit_block_add_assignment_op): Likewise.
2013         (gcc_jit_block_end_with_conditional): Likewise.
2014         (gcc_jit_block_add_comment): Likewise.
2015         (gcc_jit_block_end_with_jump): Likewise.
2016         (gcc_jit_block_end_with_return): Likewise.
2017         (gcc_jit_block_end_with_void_return): Likewise.
2018         (gcc_jit_context_set_str_option): Likewise.
2019         (gcc_jit_context_set_int_option): Likewise.
2020         (gcc_jit_context_set_bool_option): Likewise.
2021         (gcc_jit_context_enable_dump): Likewise.
2022         (gcc_jit_context_compile): Likewise.  Also log the context,
2023         and the result.
2024         (gcc_jit_context_dump_to_file): Likewise.
2025         (gcc_jit_context_set_logfile): New function.
2026         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
2027         log entry/exit from the function body.
2028         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
2029         and the ptr to be returned.
2030         (gcc_jit_result_release): Likewise.  Also log the result.
2031         * libgccjit.h: Include <stdio.h>, since we need FILE *.
2032         (gcc_jit_context_set_logfile): New declaration.
2033         * libgccjit.map (gcc_jit_context_set_logfile): New.
2035 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2037         * jit-recording.h (gcc::jit::recording::type::is_void): New
2038         virtual function.
2039         (gcc::jit::recording::memento_of_get_type::is_void): New
2040         function, overriding default implementation.
2041         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
2042         the underlying type is not "void".
2044 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2046         * docs/topics/expressions.rst (Unary Operations): Add
2047         GCC_JIT_UNARY_OP_ABS.
2048         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
2049         Likewise.
2050         * jit-recording.c (unary_op_strings): Likewise.
2051         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
2052         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
2053         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
2054         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2056 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2058         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
2059         typo in comment.
2061 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2063         * TODO.rst (Test suite): Remove item about running C++ testcases.
2064         * docs/internals/index.rst (Working on the JIT library): Add
2065         "c++" to the enabled languages in the suggested "configure"
2066         invocation, and add a description of why this is necessary.
2067         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2069 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2071         * docs/internals/index.rst: Update to reflect that built
2072         testcases are now test-foo.c.exe, rather than test-foo.exe.
2073         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2075 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
2077         Update copyright years.
2079 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
2081         * jit-playback.c (gcc::jit::playback::context::build_cast): In
2082         case BOOLEAN_TYPE, don't assume that the source expression is
2083         of type "int".
2085 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
2087         * jit-recording.c (gcc::jit::recording::context::context): When
2088         copying string options from a parent context, take a copy of the
2089         underlying buffers, rather than simply copying the pointer.
2091 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
2093         * jit-recording.c (gcc::jit::recording::context::set_str_option):
2094         Handle NULL.
2096 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
2098         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
2099         Document new function.
2100         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2102 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
2104         Minor interface cleanups of libgccjit
2105         * jit-playback.c (convert_to_dso): Use auto_vec instead
2106         of automatic array to build up command line.
2107         * jit-recording.c (recording::context::set_str_option):
2108         Make copy of the string.
2109         (recording::context::~context): Free string options.
2110         * jit-recording.h (recording::context): Adjust type
2111         of m_str_options member.
2112         * libgccjit.h: Adjust comment about
2113         gcc_jit_context_set_str_option parameter being used after
2114         the call.
2115         Update comment now that all interfaces are copy strings
2116         if necessary.
2117         * libgccjit++.h (gccjit::context): Add set_str_option
2118         member function.
2120 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
2122         * docs/cp/index.rst: New file.
2123         * docs/cp/intro/index.rst: New file.
2124         * docs/cp/intro/tutorial01.rst: New file.
2125         * docs/cp/intro/tutorial02.rst: New file.
2126         * docs/cp/intro/tutorial03.rst: New file.
2127         * docs/cp/intro/tutorial04.rst: New file.
2128         * docs/cp/topics/contexts.rst: New file.
2129         * docs/cp/topics/expressions.rst: New file.
2130         * docs/cp/topics/functions.rst: New file.
2131         * docs/cp/topics/index.rst: New file.
2132         * docs/cp/topics/locations.rst: New file.
2133         * docs/cp/topics/objects.rst: New file.
2134         * docs/cp/topics/results.rst: New file.
2135         * docs/cp/topics/types.rst: New file.
2136         * docs/examples/tut01-hello-world.cc: New file.
2137         * docs/examples/tut02-square.c: Fix missing newline in output.
2138         * docs/examples/tut02-square.cc: New file.
2139         * docs/examples/tut03-sum-of-squares.cc: New file.
2140         * docs/examples/tut04-toyvm/toyvm.cc: New file.
2141         * docs/index.rst: Move summary to above the table of contents.
2142         Add text about the C vs C++ APIs.
2143         * docs/topics/contexts.rst: Fix a typo.
2145         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2146         * docs/_build/texinfo/factorial1.png: New file.
2147         * docs/_build/texinfo/sum-of-squares1.png: New file.
2149 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2151         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
2152         logic for determine "funcname" to new function...
2153         (get_function_name): ...here, adding logic to skip any leading
2154         path from the filename.
2155         (toyvm_function_parse): Use the filename for fn_filename, rather
2156         than "name", so that the debugger can locate the source .toy
2157         file.
2158         (toyvm_function_parse): Don't fclose a NULL FILE *.
2160 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2162         PR jit/63854
2163         * docs/internals/index.rst (Running under valgrind): New
2164         subsection.
2165         (docs/_build/texinfo/libgccjit.texi): Regenerate.
2167 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2169         PR jit/64206
2170         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
2171         * jit-common.h (gcc::jit::tempdir): New forward decl.
2172         * jit-playback.c: Include jit-tempdir.h.
2173         (gcc::jit::playback::context::context): Initialize m_tempdir.
2174         (gcc::jit::playback::context::~context): Move tempdir
2175         cleanup to new file jit-tempdir.c
2176         (make_tempdir_path_template): Move to new file jit-tempdir.c.
2177         (gcc::jit::playback::context::compile): Move tempdir creation
2178         to new tempdir object in new file jit-tempdir.c.
2179         (gcc::jit::playback::context::make_fake_args): Get path from
2180         tempdir object rather than from member data.
2181         (gcc::jit::playback::context::convert_to_dso): Likewise.
2182         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
2183         (gcc::jit::playback::context::dump_generated_code): Likewise.
2184         (gcc::jit::playback::context::get_path_c_file): New function.
2185         (gcc::jit::playback::context::get_path_s_file): New function.
2186         (gcc::jit::playback::context::get_path_so_file): New function.
2187         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
2188         New function.
2189         (gcc::jit::playback::context::get_path_s_file): New function.
2190         (gcc::jit::playback::context::get_path_so_file): New function.
2191         (gcc::jit::playback::context): Move fields "m_path_template",
2192         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
2193         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
2194         * jit-tempdir.c: New file.
2195         * jit-tempdir.h: New file.
2197 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2199         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
2200         mutex here, immediately before using toplev, and release it here, on
2201         each exit path after acquisition.
2202         (jit_mutex): Move this variable here, from jit-recording.c.
2203         (gcc::jit::playback::context::acquire_mutex): New function, based on
2204         code in jit-recording.c.
2205         (gcc::jit::playback::context::release_mutex): Likewise.
2206         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
2207         function.
2208         (gcc::jit::playback::context::release_mutex): New function.
2209         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
2210         (gcc::jit::recording::context::compile): Move mutex-handling from
2211         here into jit-playback.c's gcc::jit::playback::context::compile.
2212         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
2213         and RELEASE_MUTEX.
2215 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2217         * jit-playback.c (gcc::jit::playback::context::compile): Move the
2218         dlopen code into...
2219         (gcc::jit::playback::context::dlopen_built_dso): ...this new
2220         function.
2221         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
2222         New function.
2224 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2226         PR jit/64166
2227         * docs/topics/contexts.rst (Debugging): Add description of
2228         gcc_jit_context_enable_dump.
2229         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2230         * jit-playback.c: Include context.h.
2231         (class auto_argvec): New class.
2232         (auto_argvec::~auto_argvec): New function.
2233         (gcc::jit::playback::context::compile): Convert fake_args to be
2234         an auto_argvec, so that it can contain dynamically-allocated
2235         strings.   Construct a vec of all requested dumps, and pass it to
2236         make_fake_args.  Extract requested dumps between the calls to
2237         toplev::main and toplev::finalize.
2238         (gcc::jit::playback::context::make_fake_args): Convert param
2239         "argvec" to be a vec <char *>, and gain a "requested_dumps"
2240         param.  Convert to dynamically-allocated arg strings by converting
2241         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
2242         for args that are already a copy.  Add args for all requested dumps.
2243         (gcc::jit::playback::context::extract_any_requested_dumps): New
2244         function.
2245         (gcc::jit::playback::context::read_dump_file): New function.
2246         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
2247         Convert param "argvec" to be a vec <char *>, and gain a
2248         "requested_dumps" param.
2249         (gcc::jit::playback::context::extract_any_requested_dumps): New
2250         function.
2251         (gcc::jit::playback::context::read_dump_file): New function.
2252         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
2253         function.
2254         (gcc::jit::recording::context::get_all_requested_dumps): New
2255         function.
2256         * jit-recording.h (gcc::jit::recording::requested_dump): New
2257         struct.
2258         (gcc::jit::recording::context::enable_dump): New function.
2259         (gcc::jit::recording::context::get_all_requested_dumps): New
2260         function.
2261         (gcc::jit::recording::context::m_requested_dumps): New field.
2262         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
2263         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
2264         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
2266 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
2268         * libgccjit++.h: Indent the forward declarations of the classes to
2269         show the inheritance hierarchy.
2271 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
2273         * notes.txt: Show the beginning and ending of
2274         recording::context::compile vs playback::context::compile.  Show
2275         the creation and unlinking of the tempdir.  Show toplev::finalize.
2276         Move "RELEASE MUTEX" to the correct location.  Show
2277         gcc_jit_result_release, and indicate where the
2278         dlopen/dlsym/dlclose occur.
2280 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2282         * docs/examples/tut02-square.c (main): Release the context
2283         earlier, to show that this is possible.  Update error-handling
2284         to avoid a double-release of the context, and to avoid
2285         releasing a NULL result.
2286         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
2287         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
2288         * docs/topics/results.rst (gcc_jit_result): Mention that this
2289         controls the lifetimes of machine code functions.
2290         (gcc_jit_result_get_code): Spell out the requirements for this
2291         to succeed, and the lifetime of the result.
2292         (gcc_jit_result_release): Mention that this invalidates any code
2293         that was obtained from the result.
2294         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2296 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2298         PR jit/64018
2299         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
2300         Add description of error-handling, taken in part from...
2301         * docs/topics/contexts.rst (Error-handling): Expand, and move some
2302         content to tutorial02.rst.
2303         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2305 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2307         PR jit/64020
2308         * docs/topics/types.rst (Standard types) Add new enum values to
2309         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
2310         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2311         Widen the left-hand column so that
2312         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
2313         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2315         * jit-builtins.c: Include stringpool.h and jit-playback.h.
2316         Move everything out of the gcc::jit::recording namespace into
2317         just gcc::jit.
2318         (struct builtin_data): Add fields "fnclass", "attr", and
2319         "implicit_p".
2320         (DEF_BUILTIN): Update macro so populate the new fields.
2321         (builtins_manager::builtins_manager): Update for move out of
2322         recording namespace.  Initialize the m_attributes array.
2323         (builtins_manager::get_builtin_function): Likewise.
2324         (builtins_manager::get_builtin_function_by_id): New function.
2325         (builtins_manager::make_builtin_function): Update for move out of
2326         recording namespace.  Add fix for PR jit/64020 by detecting
2327         specific builtin ids and having them ensure that builtins for
2328         other ids are created as necessary.
2329         (builtins_manager::get_type): Update for move out of recording
2330         namespace.
2331         (builtins_manager::make_type): Likewise.  Add some missing
2332         #undefs.
2333         (builtins_manager::make_primitive_type): Update for move out of
2334         recording namespace.  Implement the three BT_COMPLEX_ cases and
2335         BT_DOUBLE_PTR.
2336         (builtins_manager::make_fn_type): Update for move out of recording
2337         namespace.
2338         (builtins_manager::make_ptr_type): Likewise.
2339         (builtins_manager::finish_playback): New function.
2340         (builtins_manager::get_class): New function.
2341         (builtins_manager::implicit_p): New function.
2342         (builtins_manager::get_attrs_tree): Two new functions.
2343         (builtins_manager::make_attrs_tree): New function.
2345         * jit-builtins.h: Move everything out of the gcc::jit::recording
2346         namespace into just gcc::jit.
2347         (enum built_in_attribute): New.
2348         (builtins_manager::builtins_manager): Update decl for namespace
2349         change.
2350         (builtins_manager::get_builtin_function): Likewise.
2351         (builtins_manager::get_class): New.
2352         (builtins_manager::implicit_p): New.
2353         (builtins_manager::get_attrs_tree): Two new functions.
2354         (builtins_manager::make_attrs_tree): New function.
2355         (builtins_manager::finish_playback): New.
2356         (builtins_manager::get_builtin_function_by_id): New.
2357         (builtins_manager::make_builtin_function): Update decl for
2358         namespace change.
2359         (builtins_manager::get_type): Likewise.
2360         (builtins_manager::make_type): Likewise.
2361         (builtins_manager::make_primitive_type): Likewise.
2362         (builtins_manager::make_fn_type): Likewise.
2363         (builtins_manager::make_ptr_type): Likewise.
2364         (builtins_manager): Likewise for fields.  Add new field
2365         "m_attributes".
2367         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
2368         (builtins_manager): Update forward decl to reflect namespace
2369         change.
2371         * jit-playback.c: Include attribs.h and jit-builtins.h.
2372         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
2373         for the new COMPLEX_ types.
2374         (gcc::jit::playback::context::new_function): If creating a
2375         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
2376         and call set_builtin_decl.
2377         (gcc::jit::playback::context::replay): If we have a
2378         builtins_manager, call its finish_playback method when we're done.
2380         * jit-playback.h:
2381         (gcc::jit::playback::context::get_builtins_manager): New function.
2383         * jit-recording.c
2384         (gcc::jit::recording::context::get_builtins_manager): New function.
2385         (gcc::jit::recording::get_builtin_function): Use
2386         get_builtins_manager, in case we're a child context.
2387         (gcc::jit::recording::memento_of_get_type::dereference): Add the
2388         COMPLEX_ types.
2389         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
2390         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
2391         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
2392         (get_type_strings): Likewise.
2394         * jit-recording.h
2395         (gcc::jit::recording::context::get_builtins_manager): New.
2397         * libgccjit.h (enum gcc_jit_types): Add
2398         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
2399         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2401 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2403         * jit-builtins.c
2404         (gcc::jit::recording::builtins_manager::get_builtin_function):
2405         Check for NULL return from make_builtin_function.
2406         (gcc::jit::recording::builtins_manager::make_builtin_function):
2407         Check for NULL return from get_type.
2409 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2411         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
2412         creation code into...
2413         (gcc::jit::playback::context::convert_to_dso): New function.
2414         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
2415         New function.
2417 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2419         * jit-playback.c (gcc::jit::playback::context::compile): Use an
2420         auto_vec<const char *> rather than a const char *[20] for the
2421         top-level argv, and move the logic to build it to...
2422         (gcc::jit::playback::context::make_fake_args): New function.
2423         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
2424         New function.
2426 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2428         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
2429         * jit-playback.c: Include new header jit-result.h.
2430         (gcc::jit::result::result): Move to new file jit-result.c.
2431         (gcc::jit::result::~result): Likewise.
2432         (gcc::jit::playback::result): Likewise.
2433         * jit-recording.h (class gcc::jit::result): Move to new
2434         header jit-result.h.
2435         * jit-result.c: New file, to contain...
2436         (gcc::jit::result::result): Move here from jit-playback.c,
2437         removing erroneous "playback" namespace from comment.
2438         (gcc::jit::result::~result): Likewise.
2439         (gcc::jit::playback::result): Likewise.
2440         * jit-result.h: New file, to contain...
2441         (class gcc::jit::result): Move from jit-recording.h.
2442         * libgccjit.c: Include jit-result.h.
2443         (gcc_jit_result_get_code): Update comment to reflect move
2444         of implementation.
2445         (gcc_jit_result_release): Likewise.
2447 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2449         PR jit/63854
2450         * docs/examples/tut04-toyvm/toyvm.c
2451         (toyvm_compiled_function): New typedef.
2452         (toyvm_compiled_func) Rename to...
2453         (toyvm_compiled_code) ...this.
2454         (struct toyvm_compiled_function): New struct.
2455         (toyvm_function_compile): Return a toyvm_compiled_function *
2456         rather than a toyvm_compiled_func, so that the caller can fully
2457         clean things up.  Free "funcname".
2458         (test_script): Update for change to toyvm_function_compile.
2459         Clean up the toyvm_compiled_function.
2460         (main): Likewise.
2461         (docs/intro/tutorial04.rst): Update to reflect the above changes,
2462         and to better spell out the lifetime of the compiled code.
2464 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2466         PR jit/63854
2467         * jit-builtins.c
2468         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
2469         context's new_function_type method, rather than directly creating
2470         a function_type instance.
2471         * jit-recording.c
2472         (gcc::jit::recording::context::new_function_type): New method,
2473         adapted from part of...
2474         (gcc::jit::recording::context::new_function_ptr_type): ...this.
2475         Update to call new_function_type.
2476         * jit-recording.h
2477         (gcc::jit::recording::context::new_function_type): New method.
2479 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2481         PR jit/63969
2482         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
2484 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
2486         PR jit/63854
2487         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
2488         Convert param from const vec<playback::field *> & to
2489         const auto_vec<playback::field *> *.
2490         (gcc::jit::playback::context::new_function_type): Convert param
2491         "param_types" from vec<type *> * to const auto_vec<type *> *.
2492         (gcc::jit::playback::context::new_function): Convert param
2493         "params" from vec<param *> * to const auto_vec<param *> *.
2494         (gcc::jit::playback::context::build_call): Convert param "args"
2495         from vec<rvalue *> to const auto_vec<rvalue *> *.
2496         (gcc::jit::playback::context::new_call): Likewise.
2497         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
2498         (wrapper_finalizer): New function.
2499         (gcc::jit::playback::wrapper::operator new): Call the finalizer
2500         variant of ggc_internal_cleared_alloc, supplying
2501         wrapper_finalizer.
2502         (gcc::jit::playback::function::finalizer): New.
2503         (gcc::jit::playback::block::finalizer): New.
2504         (gcc::jit::playback::source_file::finalizer): New.
2505         (gcc::jit::playback::source_line::finalizer): New.
2507         * jit-playback.h
2508         (gcc::jit::playback::context::new_function_type): Convert param
2509         "param_types" from vec<type *> * to const auto_vec<type *> *.
2510         (gcc::jit::playback::context::new_function): Convert param
2511         "params" from vec<param *> * to const auto_vec<param *> *.
2512         (gcc::jit::playback::context::new_call): Convert param
2513         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
2514         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
2515         (gcc::jit::playback::context::build_call): Likewise.
2516         (gcc::jit::playback::context): Convert fields "m_functions",
2517         "m_source_files", "m_cached_locations" from vec to auto_vec.
2518         (gcc::jit::playback::wrapper::finalizer): New virtual function.
2519         (gcc::jit::playback::compound_type::set_fields): Convert param fro
2520         const vec<playback::field *> & to
2521         const auto_vec<playback::field *> *.
2522         (gcc::jit::playback::function::finalizer): New.
2523         (gcc::jit::playback::block::finalizer): New.
2524         (gcc::jit::playback::source_file::finalizer): New.
2525         (gcc::jit::playback::source_line::finalizer): New.
2527         * jit-recording.c
2528         (gcc::jit::recording::function_type::replay_into): Convert local
2529         from a vec into an auto_vec.
2530         (gcc::jit::recording::fields::replay_into): Likewise.
2531         (gcc::jit::recording::function::replay_into): Likewise.
2532         (gcc::jit::recording::call::replay_into): Likewise.
2533         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
2535         * jit-recording.h (gcc::jit::recording::context): Convert fields
2536         "m_mementos", "m_compound_types", "m_functions" from vec<> to
2537         auto_vec <>.
2538         (gcc::jit::recording::function_type::get_param_types): Convert
2539         return type from vec<type *> to const vec<type *> &.
2540         (gcc::jit::recording::function_type): Convert field
2541         "m_param_types" from a vec<> to an auto_vec<>.
2542         (gcc::jit::recording::fields): Likewise for field "m_fields".
2543         (gcc::jit::recording::function::get_params): Convert return type
2544         from vec <param *> to const vec<param *> &.
2545         (gcc::jit::recording::function): Convert fields "m_params",
2546         "m_locals", "m_blocks" from vec<> to auto_vec<>.
2547         (gcc::jit::recording::block): Likewise for field "m_statements".
2548         vec<> to auto_vec<>.
2549         (gcc::jit::recording::call): Likewise for field "m_args".
2550         (gcc::jit::recording::call_through_ptr): Likewise.
2552 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
2554         PR jit/63854
2555         * jit-recording.c (recording::function::validate): Convert
2556         "worklist" from vec<> to autovec<> to fix a leak.
2558 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
2560         * ChangeLog.jit: New.
2561         * ChangeLog: New.
2562         * Make-lang.in: New.
2563         * TODO.rst: New.
2564         * config-lang.in: New.
2565         * docs/Makefile: New.
2566         * docs/_build/texinfo/Makefile: New.
2567         * docs/_build/texinfo/factorial.png: New.
2568         * docs/_build/texinfo/libgccjit.texi: New.
2569         * docs/_build/texinfo/sum-of-squares.png: New.
2570         * docs/conf.py: New.
2571         * docs/examples/tut01-hello-world.c: New.
2572         * docs/examples/tut02-square.c: New.
2573         * docs/examples/tut03-sum-of-squares.c: New.
2574         * docs/examples/tut04-toyvm/Makefile: New.
2575         * docs/examples/tut04-toyvm/factorial.toy: New.
2576         * docs/examples/tut04-toyvm/fibonacci.toy: New.
2577         * docs/examples/tut04-toyvm/toyvm.c: New.
2578         * docs/index.rst: New.
2579         * docs/internals/index.rst: New.
2580         * docs/intro/factorial.png: New.
2581         * docs/intro/index.rst: New.
2582         * docs/intro/sum-of-squares.png: New.
2583         * docs/intro/tutorial01.rst: New.
2584         * docs/intro/tutorial02.rst: New.
2585         * docs/intro/tutorial03.rst: New.
2586         * docs/intro/tutorial04.rst: New.
2587         * docs/topics/contexts.rst: New.
2588         * docs/topics/expressions.rst: New.
2589         * docs/topics/functions.rst: New.
2590         * docs/topics/index.rst: New.
2591         * docs/topics/locations.rst: New.
2592         * docs/topics/objects.rst: New.
2593         * docs/topics/results.rst: New.
2594         * docs/topics/types.rst: New.
2595         * dummy-frontend.c: New.
2596         * jit-builtins.c: New.
2597         * jit-builtins.h: New.
2598         * jit-common.h: New.
2599         * jit-playback.c: New.
2600         * jit-playback.h: New.
2601         * jit-recording.c: New.
2602         * jit-recording.h: New.
2603         * libgccjit++.h: New.
2604         * libgccjit.c: New.
2605         * libgccjit.h: New.
2606         * libgccjit.map: New.
2607         * notes.txt: New.
2609 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
2611         * Initial creation
2613 Copyright (C) 2013-2018 Free Software Foundation, Inc.
2615 Copying and distribution of this file, with or without modification,
2616 are permitted in any medium without royalty provided the copyright
2617 notice and this notice are preserved.