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