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