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