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