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