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