2015-09-30 Matthias Klose <doko@ubuntu.com>
[official-gcc.git] / gcc / jit / ChangeLog
blobfaa854512d29687636482bb3552f999959ecd5de
1 2015-09-30  Matthias Klose  <doko@ubuntu.com>
3         * jit-builtins.h Define DEF_FUNCTION_TYPE_VAR_6,
4         remove DEF_FUNCTION_TYPE_VAR_11.
5         * jit-builtins.c (builtins_manager::make_type): Define and handle
6         DEF_FUNCTION_TYPE_VAR_6, remove DEF_FUNCTION_TYPE_VAR_11.
8 2015-08-25  David Malcolm  <dmalcolm@redhat.com>
10         * docs/cp/topics/contexts.rst
11         (gccjit::context::set_bool_use_external_driver): New.
12         * docs/internals/test-hello-world.exe.log.txt: Update.
13         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_5): New.
14         * docs/topics/contexts.rst
15         (gcc_jit_context_set_bool_use_external_driver): New.
16         * jit-common.h (enum inner_bool_option): Add
17         INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
18         * jit-playback.c (gcc_driver_name): New global.
19         (gcc:jit::playback::context::invoke_driver): Split out second
20         half into...
21         (gcc::jit::playback::context::invoke_embedded_driver): ...this new
22         function, and...
23         (gcc::jit::playback::context::invoke_external_driver): ...this new
24         function.
25         * jit-playback.h
26         (gcc::jit::playback::context::get_inner_bool_option): New.
27         (gcc::jit::playback::context::invoke_embedded_driver): New.
28         (gcc::jit::playback::context::invoke_external_driver): New.
29         * jit-recording.c (inner_bool_option_reproducer_strings):
30         Add entry for INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
31         * libgccjit++.h
32         (gccjit::context::set_bool_use_external_driver): New.
33         * libgccjit.c (gcc_jit_context_set_bool_use_external_driver): New.
34         * libgccjit.h (gcc_jit_context_set_bool_use_external_driver): New.
35         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_use_external_driver):
36         New.
37         * libgccjit.map (LIBGCCJIT_ABI_5): New.
38         * notes.txt: Show invocation of embedded copy of driver.
39         * docs/internals/test-hello-world.exe.log.txt: Update
41 2015-08-13  David Malcolm  <dmalcolm@redhat.com>
43         * jit-playback.c (invoke_driver): On OS X, add
44         "-Wl,-undefined,dynamic_lookup" to the driver arguments.
46 2015-08-03  David Malcolm  <dmalcolm@redhat.com>
48         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_4): New.
49         * docs/topics/contexts.rst (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY):
50         We no longer show a profile.
51         * docs/topics/index.rst (Topic Reference): Add performance.rst.
52         * docs/topics/performance.rst: New file.
53         * docs/_build/texinfo/libgccjit.texi: Regenerate.
54         * jit-playback.c (gcc::jit::playback::context::compile): Add timer
55         param when constructing the "toplev" instance.
56         (gcc::jit::playback::context::acquire_mutex): Add timer param when
57         constructing auto_timevar instance.
58         (gcc::jit::playback::context::make_fake_args): If we have a timer,
59         add "-ftime-report".
60         (gcc::jit::playback::context::invoke_driver): Add timer param when
61         constructing auto_timevar instance.
62         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
63         * jit-playback.h (gcc::jit::playback::context::get_timer): New accessor.
64         * jit-recording.c: Include timevar.h.
65         (gcc::jit::recording::context::context): Initialize field "m_timer".
66         * jit-recording.h: Add forward declaration of class timer.
67         (gcc::jit::recording::context::set_timer): New method.
68         (gcc::jit::recording::context::get_timer): New method.
69         (gcc::jit::recording::context::m_timer): New field.
70         * libgccjit++.h (gccjit::timer): New class.
71         (gccjit::auto_time): New class.
72         (gccjit::context::set_timer): New method.
73         (gccjit::context::get_timer): New.
74         (gccjit::timer::timer): New.
75         (gccjit::timer::push): New.
76         (gccjit::timer::pop): New.
77         (timer::print): New.
78         (timer::get_inner_timer): New.
79         (timer::release): New.
80         (auto_time::auto_time): New.
81         (auto_time::~auto_time): New.
82         * libgccjit.c: Include timevar.h.
83         (struct gcc_jit_timer): New.
84         (gcc_jit_timer_new): New function.
85         (gcc_jit_timer_release): New function.
86         (gcc_jit_context_set_timer): New function.
87         (gcc_jit_context_get_timer): New function.
88         (gcc_jit_timer_push): New function.
89         (gcc_jit_timer_pop): New function.
90         (gcc_jit_timer_print): New function.
91         * libgccjit.h (LIBGCCJIT_HAVE_TIMING_API): New macro.
92         (gcc_jit_timer): New typedef.
93         (gcc_jit_timer_new): New function.
94         (gcc_jit_timer_release): New function.
95         (gcc_jit_context_set_timer): New function.
96         (gcc_jit_context_get_timer): New function.
97         (gcc_jit_timer_push): New function.
98         (gcc_jit_timer_pop): New function.
99         (gcc_jit_timer_print): New function.
100         * libgccjit.map (LIBGCCJIT_ABI_4): New.
101         (gcc_jit_timer_new): New function.
102         (gcc_jit_timer_release): New function.
103         (gcc_jit_context_set_timer): New function.
104         (gcc_jit_context_get_timer): New function.
105         (gcc_jit_timer_push): New function.
106         (gcc_jit_timer_pop): New function.
107         (gcc_jit_timer_print): New function.
109 2015-07-23  David Malcolm  <dmalcolm@redhat.com>
111         * jit-playback.c (invoke_driver): Convert local "argvec"
112         to an auto_argvec, so that it owns copies of the strings,
113         rather than borrows them, updating ADD_ARG to use xstrdup
114         and special-casing the NULL terminator to avoid
115         xstrdup (NULL).  Call add_multilib_driver_arguments at the front
116         of the arguments.
117         (MULTILIB_DEFAULTS): Provide a default definition.
118         (multilib_defaults_raw): New constant array.
119         (gcc::jit::playback::context::add_multilib_driver_arguments): New
120         method.
121         * jit-playback.h
122         (gcc::jit::playback::context::add_multilib_driver_arguments): New
123         method.
124         * docs/internals/test-hello-world.exe.log.txt: Update.
125         * docs/_build/texinfo/libgccjit.texi: Regenerate.
127 2015-07-16  David Malcolm  <dmalcolm@redhat.com>
129         * docs/internals/index.rst (Overview of code structure): Add note
130         that the implementation is in C++, despite the .c extension.
131         (Submitting patches): New subsection.
132         * docs/_build/texinfo/libgccjit.texi: Regenerate.
134 2015-07-09  Andrew MacLeod  <amacleod@redhat.com>
136         * dummy-frontend.c: Adjust includes for flags.h changes.
137         * jit-common.h: Likewise.
138         * jit-playback.c: Likewise.
140 2015-07-08  David Malcolm  <dmalcolm@redhat.com>
142         PR jit/66783
143         * libgccjit.c (gcc_jit_context_new_field): Show name of field in
144         "unknown size" error message.
145         (gcc_jit_struct_set_fields): Show name of struct in error message.
146         (gcc_jit_context_new_global): Show name of global in
147         "unknown size" error message.
148         (gcc_jit_function_new_local): Likewise for local.
150 2015-07-07  Andrew MacLeod  <amacleod@redhat.com>
152         * dummy-frontend.c: Adjust includes.
153         * jit-common.h: Likewise.
154         * jit-playback.c: Likewise.
156 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
158         PR jit/66783
159         * jit-recording.h: Within namespace gcc:jit::recording...
160         (type::has_known_size): New virtual function.
161         (struct_has_known_size): New function.
162         * libgccjit.c (gcc_jit_context_new_field): Verify that the type
163         has a known size.
164         (gcc_jit_context_new_global): Likewise.
165         (gcc_jit_function_new_local): Likewise.
167 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
169         PR jit/66779
170         * dummy-frontend.c (jit_langhook_type_for_mode): Ensure that we
171         handle modes QI, HI, SI, DI, TI.
173 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
175         PR jit/66700
176         * jit-playback.c (jit_mark_addressable): New function.
177         (gcc::jit::playback::lvalue::get_address): Call
178         jit_mark_addressable on the underlying tree.
180 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
182         * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
183         documentation.
184         * docs/_build/texinfo/libgccjit.texi: Regenerate.
186 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
188         * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
189         Clarify lack of lifetime requirements on (const char *) parameter.
190         * docs/topics/expressions.rst
191         (gcc_jit_context_new_string_literal): Likewise.
192         (gcc_jit_context_new_global): Likewise.
193         * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
194         (gcc_jit_context_new_function): Likewise.
195         (gcc_jit_function_new_block): Likewise.
196         (gcc_jit_block_add_comment): Likewise.
197         * docs/topics/locations.rst (gcc_jit_context_new_location):
198         Likewise.
199         * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
200         (gcc_jit_context_new_struct_type): Likewise.
201         * docs/_build/texinfo/libgccjit.texi: Regenerate.
203 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
205         * docs/cp/topics/functions.rst (Blocks): Add switch statements to
206         list of ways to terminate a block.
207         (gccjit::block::end_with_switch): Add function description.
208         (gccjit::case_): Add class.
209         (gccjit::context::new_case): Add function description.
210         * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
211         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
212         * docs/topics/functions.rst (Blocks): Add switch statements to
213         list of ways to terminate a block.
214         (gcc_jit_block_end_with_switch): Add function description.
215         (gcc_jit_case): Add type.
216         (gcc_jit_context_new_case): Add function description.
217         (gcc_jit_case_as_object): Add function description.
218         * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
219         * docs/_build/texinfo/libgccjit.texi: Regenerate.
220         * jit-common.h (gcc::jit::recording::case_): Add forward decl.
221         (gcc::jit::playback::case_): Add forward decl.
222         * jit-playback.c (add_case): New function.
223         (gcc::jit::playback::block::add_switch): New function.
224         * jit-playback.h (gcc::jit::playback::case_): New struct.
225         (gcc::jit::playback::block::get_function): New method.
226         (gcc::jit::playback::block::add_switch): New method.
227         * jit-recording.c: Within namespace gcc::jit...
228         (recording::context::new_case): New method.
229         (recording::function::validate): Update for change to
230         get_successor_blocks.
231         (recording::block::end_with_switch): New method.
232         (recording::block::get_successor_blocks): Update to support an
233         arbitrary number of successor blocks.
234         (recording::block::dump_edges_to_dot): Likewise.
235         (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
236         (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
237         (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
238         (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
239         (recording::statement::get_successor_blocks): Update to support an
240         arbitrary number of successor blocks.
241         (recording::conditional::get_successor_blocks): Likewise.
242         (recording::jump::get_successor_blocks): Likewise.
243         (recording::return_::get_successor_blocks): Likewise.
244         (recording::case_::write_reproducer): New.
245         (recording::case_::make_debug_string): New.
246         (recording::switch_::switch_): New.
247         (recording::switch_::replay_into): New.
248         (recording::switch_::get_successor_blocks): New.
249         (recording::switch_::make_debug_string): New.
250         (recording::switch_::write_reproducer): New.
251         * jit-recording.h: Within namespace gcc::jit::recording...
252         (context::new_case): New.
253         (rvalue::is_constant): New.
254         (rvalue::get_wide_int): New.
255         (block::end_with_switch): New.
256         (block::get_successor_blocks): Update to support an arbitrary
257         number of successor blocks.
258         (memento_of_new_rvalue_from_const::is_constant): New.
259         (memento_of_new_rvalue_from_const::get_wide_int): New.
260         (statement::get_successor_blocks): Update to support an arbitrary
261         number of successor blocks.
262         (conditional::get_successor_blocks): Likewise.
263         (jump::get_successor_blocks): Likewise.
264         (return_::get_successor_blocks): Likewise.
265         (case_): New subclass of memento.
266         (switch_): New subclass of statement.
267         * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
268         (gccjit::context::new_case): New method.
269         (gccjit::block::end_with_switch): New method.
270         (gccjit::case_::case): New ctors.
271         (gccjit::case_::get_inner_case): New method.
272         * libgccjit.c: Include "typed-splay-tree.h"
273         (struct gcc_jit_case): New.
274         (gcc_jit_context_new_case): New function.
275         (gcc_jit_case_as_object): New function.
276         (valid_dest_for_switch): New function.
277         (valid_case_for_switch): New function.
278         (class api_call_validator): New class.
279         (class case_range_validator): New class.
280         (case_range_validator::case_range_validator): New.
281         (case_range_validator::validate): New.
282         (case_range_validator::case_compare): New.
283         (case_range_validator::get_wide_int): new.
284         (gcc_jit_block_end_with_switch): New.
285         * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
286         (gcc_jit_case): New typedef.
287         (gcc_jit_context_new_case): New function.
288         (gcc_jit_case_as_object): New function.
289         (gcc_jit_block_end_with_switch): New function.
290         (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
291         * libgccjit.map: Add gcc_jit_block_end_with_switch,
292         gcc_jit_case_as_object and gcc_jit_context_new_case.
294 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
296         PR jit/66546
297         * docs/cp/topics/contexts.rst
298         (gccjit::context::set_bool_allow_unreachable_blocks): New.
299         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
300         * docs/topics/contexts.rst (Options): Add notes discussing the
301         transition from enums to entrypoints for new options.
302         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
303         * docs/_build/texinfo/libgccjit.texi: Regenerate.
304         * jit-common.h (gcc::jit::inner_bool_option): New enum.
305         * jit-recording.c: Within namespace gcc::jit...
306         (recording::context::context): Handle m_inner_bool_options.
307         (recording::context::set_inner_bool_option): New.
308         (inner_bool_option_reproducer_strings): New.
309         (recording::context::log_all_options): Log the "inner" bool
310         options.
311         (recording::context::log_inner_bool_option): New.
312         (recording::context::dump_reproducer_to_file): Write initializers
313         for "inner" bool options.
314         (recording::function::validate): Don't check for block
315         reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
316         * jit-recording.h: Within namespace gcc::jit...
317         (recording::context::set_inner_bool_option): New.
318         (recording::context::get_inner_bool_option): New.
319         (recording::context::log_inner_bool_option): New.
320         (recording::context::m_inner_bool_options): New.
321         * libgccjit++.h
322         (gccjit::context::set_bool_allow_unreachable_blocks): New.
323         * libgccjit.c
324         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
325         * libgccjit.h: Add note about options present in the
326         initial release of libgccjit.
327         (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
328         entrypoint.
329         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
330         New macro.
331         * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
332         (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
333         entrypoint.
335 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
337         PR jit/66628
338         * docs/cp/topics/contexts.rst (Additional command-line options):
339         New section.
340         * docs/topics/compatibility.rst: New file.
341         * docs/topics/contexts.rst (Additional command-line options): New
342         section.
343         * docs/topics/index.rst: Add compatibility.rst.
344         * docs/_build/texinfo/libgccjit.texi: Regenerate.
345         * jit-playback.c (make_fake_args): Add call to
346         append_command_line_options.
347         * jit-recording.c: Within namespace gcc::jit...
348         (recording::context::~context): Free the optnames within
349         m_command_line_options.
350         (recording::context::set_bool_option): Likewise.
351         (recording::context::add_command_line_option): New method.
352         (recording::context::append_command_line_options): New method.
353         (recording::context::dump_reproducer_to_file): Add command-line
354         options.
355         * jit-recording.h: Within namespace gcc::jit...
356         (recording::context::add_command_line_option): New method.
357         (recording::context::append_command_line_options): New method.
358         (recording::context::m_command_line_options): New field.
359         * libgccjit++.h (gccjit::context::add_command_line_option): New
360         method.
361         * libgccjit.c (gcc_jit_context_add_command_line_option): New API
362         entrypoint.
363         * libgccjit.h (gcc_jit_context_add_command_line_option): New API
364         entrypoint.
365         (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
366         macro.
367         * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
368         LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
370 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
372         * jit-recording.c
373         (gcc::jit::recording::context::dump_reproducer_to_file):
374         Add pragma to generated reproducers to disable -Wunused-variable.
375         Fix handling of NULL string options.
377 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
379         * docs/cp/topics/expressions.rst: Remove stray semicolon.
380         * docs/cp/topics/functions.rst: Remove stray backslash.
381         * docs/_build/texinfo/libgccjit.texi: Regenerate.
383 2015-06-25  Andrew MacLeod  <amacleod@redhat.com>
385         * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
386         * jit-playback.c: Likewise.
388 2015-06-25  Andrew Macleod  <amacleod@redhat.com>
390         * jit-common.h: Don't include alias.h.
392 2015-06-17  David Malcolm  <dmalcolm@redhat.com>
394         * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
395         is for the correct struct.
396         (gcc_jit_rvalue_access_field): Likewise.
398 2015-06-17  Andrew MacLeod  <amacleod@redhat.com>
400         * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
401         * jit-common.h: Likewise.
402         * jit-playback.c: Likewise.
404 2015-06-16  David Malcolm  <dmalcolm@redhat.com>
406         PR jit/66539
407         * jit-recording.c: Within namespace gcc::jit::recording::
408         (rvalue::get_debug_string_parens): New function.
409         (binary_op::make_debug_string): Update to mimic C precedence
410         rules.
411         (binary_op_precedence): New array.
412         (binary_op::get_precedence): New function.
413         (comparison::make_debug_string): Update to mimic C precedence
414         rules.
415         (comparison_precedence): New array.
416         (comparison::get_precedence): New function.
417         (cast::make_debug_string): Update to mimic C precedence rules.
418         (call::make_debug_string): Likewise.
419         (call_through_ptr::make_debug_string): Likewise.
420         (array_access::make_debug_string): Likewise.
421         (access_field_of_lvalue::make_debug_string): Likewise.
422         (access_field_rvalue::make_debug_string): Likewise.
423         (dereference_field_rvalue::make_debug_string): Likewise.
424         (dereference_rvalue::make_debug_string): Likewise.
425         (get_address_of_lvalue::make_debug_string): Likewise.
426         * jit-recording.h: Within namespace gcc::jit::recording::
427         (precedence): New enum.
428         (rvalue::rvalue): Initialize field "m_parenthesized_string".
429         (rvalue::get_debug_string_parens): New method.
430         (rvalue::get_precedence): New pure virtual function.
431         (rvalue::m_parenthesized_string): New field.
432         (param::get_precedence): New function.
433         (global::get_precedence): New function.
434         (memento_of_new_rvalue_from_const::get_precedence): New function.
435         (memento_of_new_string_literal::get_precedence): New function.
436         (unary_op::get_precedence): New function.
437         (binary_op::get_precedence): New function.
438         (comparison::get_precedence): New function.
439         (cast::get_precedence): New function.
440         (call::get_precedence): New function.
441         (call_through_ptr::get_precedence): New function.
442         (array_access::get_precedence): New function.
443         (access_field_of_lvalue::get_precedence): New function.
444         (access_field_rvalue::get_precedence): New function.
445         (dereference_field_rvalue::get_precedence): New function.
446         (dereference_rvalue::get_precedence): New function.
447         (get_address_of_lvalue::get_precedence): New function.
448         (local::get_precedence): New function.
450 2015-06-09  Matthias Klose  <doko@ubuntu.com>
452         * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
454 2015-06-08  Andrew MacLeod  <amacleod@redhat.com>
456         * dummy-frontend.c : Adjust include files.
457         * jit-common.h : Likewise.
458         * jit-playback.c : Likewise.
460 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
462         * dummy-frontend.c
463         (jit_langhook_post_compilation_parsing_cleanups): Remove.
464         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
465         * jit-playback.c (gcc::jit::playback::context::new_global): Add
466         call to varpool_node::finalize_decl.
467         (gcc::jit::playback::context::finalize_global_decls): Remove.
468         * jit-playback.h
469         (gcc::jit::playback::context::finalize_global_decls): Remove.
471 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
473         * dummy-frontend.c (jit_langhook_write_globals): Rename to...
474         (jit_langhook_post_compilation_parsing_cleanups): ...this, and
475         eliminate calls to finalize_compilation_unit and
476         write_global_decls_2.
477         (LANG_HOOKS_WRITE_GLOBALS): Rename to...
478         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
479         redirect from jit_langhook_write_globals to
480         jit_langhook_post_compilation_parsing_cleanups.
481         * jit-playback.c
482         (gcc::jit::playback::context::write_global_decls_1): Rename to...
483         (gcc::jit::playback::context::finalize_global_decls): ...this.
484         (gcc::jit::playback::context::write_global_decls_1): Delete.
485         * jit-playback.h
486         (gcc::jit::playback::context::write_global_decls_1): Rename to...
487         (gcc::jit::playback::context::finalize_global_decls): ...this.
488         (gcc::jit::playback::context::write_global_decls_1): Delete.
490 2015-06-04  Andrew MacLeod  <amacleod@redhat.com>
492         * dummy-frontend.c: Adjust includes for restructured coretypes.h.
493         * jit-common.h: Likewise.
494         * jit-playback.c: Likewise.
496 2015-05-12  David Malcolm  <dmalcolm@redhat.com>
498         * jit-builtins.c: Include vec.h before target.h.
500 2015-04-27  Jim Wilson  <jim.wilson@linaro.org>
502         * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
503         files.
505 2015-04-09  David Malcolm  <dmalcolm@redhat.com>
507         PR jit/65691
508         * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
509         and paste error in description of gccjit::context::one.
510         * docs/topics/expressions.rst (Simple expressions): Likewise in
511         description of gcc_jit_context_one.
512         * docs/_build/texinfo/libgccjit.texi: Regenerate.
514 2015-03-13  Uros Bizjak  <ubizjak@gmail.com>
516         * jit-recording.c (dump::write): Also check vasprintf return value.
517         (recording::context::add_error_va): Ditto.
518         (recording::string::from_printf): Ditto.
520 2015-03-13  David Malcolm  <dmalcolm@redhat.com>
522         * docs/internals/index.rst (Packaging notes): New section.
523         * docs/_build/texinfo/libgccjit.texi: Regenerate.
525 2015-03-05  David Malcolm  <dmalcolm@redhat.com>
527         * docs/cp/intro/tutorial03.rst: Add missing arguments to
528         gccjit::block::end_with_conditional call.  Add on_true/on_false
529         comments.  Tweak the wording.
530         * docs/intro/tutorial03.rst: Add missing arguments to
531         gcc_jit_block_end_with_conditional call.  Add some clarifying
532         comments.
533         * docs/topics/compilation.rst: Tweak the wording to avoid an
534         ambiguous use of "this".
535         * docs/topics/contexts.rst: Fix a typo.
536         * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
537         a stray backtick.
538         * docs/_build/texinfo/libgccjit.texi: Regenerate.
540 2015-02-24  Thomas Schwinge  <thomas@codesourcery.com>
542         PR libgomp/64625
543         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
544         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
545         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
546         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
547         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
548         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
550 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
552         PR jit/64257
553         * docs/conf.py (html_theme): Change from 'pyramid'
554         to 'sphinxdoc'.
556 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
558         * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
559         typo.
560         * docs/_build/texinfo/libgccjit.texi: Regenerate.
562 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
564         * jit-logging.h (gcc::jit::log_user::log): Make const.
565         * jit-recording.c (gcc::jit::recording::context::set_str_option):
566         Log the new value of the option.
567         (gcc::jit::recording::context::set_int_option): Likewise.
568         (gcc::jit::recording::context::set_bool_option): Likewise.
569         (gcc::jit::recording::context::compile): Log the value of all
570         options.
571         (gcc::jit::recording::context::compile_to_file): Likewise.
572         (gcc::jit::recording::context::log_all_options): New function.
573         (gcc::jit::recording::context::log_str_option): New function.
574         (gcc::jit::recording::context::log_int_option): New function.
575         (gcc::jit::recording::context::log_bool_option): New function.
576         * jit-recording.h (gcc::jit::recording::context::log_all_options):
577         New function.
578         (gcc::jit::recording::context::log_str_option): New function.
579         (gcc::jit::recording::context::log_int_option): New function.
580         (gcc::jit::recording::context::log_bool_option): New function.
581         * docs/internals/test-hello-world.exe.log.txt: Update for above
582         changes.
583         * docs/_build/texinfo/libgccjit.texi: Regenerate.
585 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
587         PR jit/64810
588         * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
589         (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
590         * jit-playback.c: Include gcc.h.
591         (gcc::jit::playback::context::compile): Move mutex acquisition
592         to before the call to make_fake_args.
593         (append_arg_from_driver): New function.
594         (gcc::jit::playback::context::make_fake_args): On the first call,
595         call into driver_get_configure_time_options to get configure-time
596         default options and cache them.  Add them to the args for
597         toplev::main.
598         * jit-spec.c: New source file.
599         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
600         above changes.
601         * docs/_build/texinfo/libgccjit.texi: Regenerate.
603 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
605         PR jit/64810
606         * dummy-frontend.c (jit_langhook_type_for_mode): Support
607         TYPE_MODE (long_long_integer_type_node).
609 2015-01-27  David Malcolm  <dmalcolm@redhat.com>
611         * docs/internals/test-hello-world.exe.log.txt: Add example version
612         lines.
613         * docs/_build/texinfo/libgccjit.texi: Regenerate.
614         * jit-common.h (gcc::jit::dump::get_file): New accessor.
615         * jit-logging.c: Include toplev.h.
616         (gcc::jit::logger::logger): Log the GCC version.
617         * jit-recording.c: Include toplev.h.
618         (gcc:jit::recording::context::dump_reproducer_to_file): Log the
619         GCC version.
621 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
623         * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
624         * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
625         error buffer is only valid until the next call to the context.
626         * docs/_build/texinfo/libgccjit.texi: Regenerate.
627         * libgccjit.h (gcc_jit_context_get_first_error): Reword the
628         comment to omit mention of compiling.
629         (gcc_jit_context_get_last_error): The error buffer is only valid
630         until the next call to the context.
632 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
634         PR jit/64708
635         * config-lang.in (compilers): Drop "libgccjit.so".
637 2015-01-23  David Malcolm  <dmalcolm@redhat.com>
639         PR jit/64721
640         * jit-playback.c (gcc::jit::playback::context::compile): Construct
641         toplev instances with init_signals=false.
643 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
645         * docs/cp/topics/results.rst: Rename to...
646         * docs/cp/topics/compilation.rst: ...this, and add section on
647         ahead-of-time compilation.
648         * docs/cp/topics/index.rst: Update for renaming of results.rst
649         to compilation.rst.
650         * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
651         script.
652         * docs/examples/tut05-bf.c: New file, implementing a compiler
653         for "brainf".
654         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
655         changes to logger output.
656         * docs/intro/index.rst: Add tutorial05.rst
657         * docs/intro/tutorial05.rst: New file.
658         * docs/topics/results.rst: Rename to...
659         * docs/topics/compilation.rst: ...this, and add section on
660         ahead-of-time compilation.
661         * docs/topics/index.rst: Update for renaming of results.rst to
662         compilation.rst.
663         * docs/_build/texinfo/libgccjit.texi: Regenerate.
664         * jit-playback.c (gcc::jit::playback::context::compile): Convert
665         return type from result * to void.  Move the code to convert to
666         dso and dlopen the result to a new pure virtual "postprocess"
667         method.
668         (gcc::jit::playback::compile_to_memory::compile_to_memory): New
669         function.
670         (gcc::jit::playback::compile_to_memory::postprocess): New
671         function, based on playback::context::compile.
672         (gcc::jit::playback::compile_to_file::compile_to_file): New
673         function.
674         (gcc::jit::playback::compile_to_file::postprocess): New function.
675         (gcc::jit::playback::compile_to_file::copy_file): New function.
676         (gcc::jit::playback::context::convert_to_dso): Move internals
677         to...
678         (gcc::jit::playback::context::invoke_driver): New method.  Add
679         "-shared" and "-c" options to driver's argv as needed.
680         * jit-playback.h: Include "timevar.h".
681         (gcc::jit::playback::context::compile): Convert return type from
682         result * to void.
683         (gcc::jit::playback::context::postprocess): New pure virtual
684         function, making this an abstract base class.
685         (gcc::jit::playback::context::get_tempdir): New accessor.
686         (gcc::jit::playback::context::invoke_driver): New function.
687         (class gcc::jit::playback::compile_to_memory): New subclass of
688         playback::context.
689         (class gcc::jit::playback::compile_to_file): Likewise.
690         * jit-recording.c (gcc::jit::recording::context::compile): Use a
691         playback::compile_to_memory, and extract its result.
692         (gcc::jit::recording::context::compile_to_file): New function.
693         * jit-recording.h (gcc::jit::recording::context::compile_to_file):
694         New function.
695         * libgccjit++.h (gccjit::context::compile_to_file): New method.
696         * libgccjit.c (gcc_jit_context_compile): Update log message to
697         clarify that this is an in-memory compile.
698         (gcc_jit_context_compile_to_file): New function.
699         * libgccjit.h (gcc_jit_context): Clarify that you can compile
700         a context more than once, and that you can compile to a file
701         as well as to memory.
702         (gcc_jit_result): Clarify that this is the result of an
703         in-memory compilation.
704         (gcc_jit_context_compile): Clarify that you can compile, and that
705         this is an in-memory compilation.
706         (enum gcc_jit_output_kind): New enum.
707         (gcc_jit_context_compile_to_file): New function.
708         (gcc_jit_context_enable_dump): Clarify comment to cover both forms
709         of compilation.
710         * libgccjit.map (gcc_jit_context_compile_to_file): New API
711         entrypoint.
712         * notes.txt: Update to show the playback::context::postprocess
713         virtual function.
715 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
717         * jit-recording.c
718         (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
719         Add missing format string.
721 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
723         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
724         (check_jit_parallelize): Set this to an arbitrary value (10).
726 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
728         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
729         last argument.
730         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
731         undef afterwards.
732         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
733         Likewise.
735 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
737         Update copyright years in docs/.
739 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
741         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
742         lvalue and the rvalue are of compatible type.
744 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
746         * docs/cp/topics/contexts.rst (Debugging): Add
747         gccjit::context::dump_reproducer_to_file.
748         * docs/internals/index.rst (Design notes): New section,
749         discussing input validation and
750         gcc_jit_context_dump_reproducer_to_file.
751         * docs/topics/contexts.rst (Debugging): Add
752         gcc_jit_context_dump_reproducer_to_file.
753         * docs/_build/texinfo/libgccjit.texi: Regenerate.
754         * jit-common.h (gcc::jit::dump::get_context): New accessor.
755         * jit-recording.c: Include "hash-map.h".
756         Within namespace ::gcc::jit...
757         (dump::write): Flush each line.
758         (dump::make_location): Pass false for new param "created_by_user".
759         (class allocator): New class.
760         (allocator::~allocator): New function.
761         (allocator::xstrdup_printf): New function.
762         (allocator::xstrdup_printf_va): New function.
763         (class reproducer): New subclass of dump.
764         (reproducer::reproducer): New function.
765         (reproducer::write_params): New function.
766         (reproducer::write_args): New function.
767         (reproducer::make_identifier): New function.
768         (reproducer::make_tmp_identifier): New function.
769         (reproducer::get_identifier): New pair of functions.
770         (reproducer::get_identifier_as_rvalue): New function.
771         (reproducer::get_identifier_as_lvalue): New function.
772         (reproducer::get_identifier_as_type): New function.
773         (reproducer::xstrdup_printf): New function.
774         (recording::context::context): Initialize m_toplevel_ctxt.
775         (recording::context::new_location): Add param created_by_user.
776         (str_option_reproducer_strings): New table of strings.
777         (int_option_reproducer_strings): Likewise.
778         (bool_option_reproducer_strings): Likewise.
779         (get_type_enum_strings): Likewise.
780         (names_of_function_kinds): Likewise.
781         (global_kind_reproducer_strings): Likewise.
782         (unary_op_reproducer_strings): Likewise.
783         (binary_op_reproducer_strings): Likewise.
784         (comparison_reproducer_strings): Likewise.
785         Within namespace ::gcc::jit::recording::...
786         (context::dump_reproducer_to_file): New function.
787         (string::write_reproducer): Likewise.
788         (location::write_reproducer): Likewise.
789         (type::access_as_type): Likewise.
790         (memento_of_get_type::write_reproducer): Likewise.
791         (memento_of_get_pointer::write_reproducer): Likewise.
792         (memento_of_get_const::write_reproducer): Likewise.
793         (memento_of_get_volatile::write_reproducer): Likewise.
794         (array_type::write_reproducer): Likewise.
795         (function_type::write_reproducer): Likewise.
796         (function_type::write_deferred_reproducer): Likewise.
797         (field::write_reproducer): Likewise.
798         (struct_::access_as_type): Likewise.
799         (struct_::write_reproducer): Likewise.
800         (union_::write_reproducer): Likewise.
801         (fields::write_reproducer): Likewise.
802         (rvalue::access_as_rvalue): Likewise.
803         (lvalue::access_as_rvalue): Likewise.
804         (lvalue::access_as_lvalue): Likewise.
805         (param::access_as_rvalue): Likewise.
806         (param::access_as_lvalue): Likewise.
807         (param::write_reproducer): Likewise.
808         (function::write_reproducer): Likewise.
809         (block::write_reproducer): Likewise.
810         (global::write_reproducer): Likewise.
811         (memento_of_new_rvalue_from_const <int>::write_reproducer):
812         Likewise.
813         (memento_of_new_rvalue_from_const <long>::write_reproducer):
814         Likewise.
815         (memento_of_new_rvalue_from_const <double>::write_reproducer):
816         Likewise.
817         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
818         Likewise.
819         (memento_of_new_string_literal::write_reproducer): Likewise.
820         (unary_op::write_reproducer): Likewise.
821         (binary_op::write_reproducer): Likewise.
822         (comparison::write_reproducer): Likewise.
823         (cast::write_reproducer): Likewise.
824         (call::write_reproducer): Likewise.
825         (call_through_ptr::write_reproducer): Likewise.
826         (array_access::write_reproducer): Likewise.
827         (access_field_of_lvalue::write_reproducer): Likewise.
828         (access_field_rvalue::write_reproducer): Likewise.
829         (dereference_field_rvalue::write_reproducer): Likewise.
830         (dereference_rvalue::write_reproducer): Likewise.
831         (get_address_of_lvalue::write_reproducer): Likewise.
832         (local::write_reproducer): Likewise.
833         (eval::write_reproducer): Likewise.
834         (assignment::write_reproducer): Likewise.
835         (assignment_op::write_reproducer): Likewise.
836         (comment::write_reproducer): Likewise.
837         (conditional::write_reproducer): Likewise.
838         (jump::write_reproducer): Likewise.
839         (return_::write_reproducer): Likewise.
840         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
841         Within namespace ::gcc::jit::recording::...
842         (context::new_location): Add "created_by_user" param.
843         (context::dump_reproducer_to_file): New method.
844         (context::m_toplevel_ctxt): New field.
845         (memento::write_reproducer): New pure virtual function.
846         (memento::dyn_cast_location): New virtual function.
847         (string::write_reproducer):
848         (location::location): Add "created_by_user" param.
849         (location::dyn_cast_location): New function.
850         (location::created_by_user): New accessor.
851         (location::write_reproducer): New function.
852         (location::m_created_by_user): New field.
853         (type::access_as_type): New virtual function.
854         (location::write_reproducer): Likewise.
855         (type::access_as_type): Likewise.
856         (memento_of_get_type::write_reproducer): Likewise.
857         (memento_of_get_pointer::write_reproducer): Likewise.
858         (memento_of_get_const::write_reproducer): Likewise.
859         (memento_of_get_volatile::write_reproducer): Likewise.
860         (array_type::write_reproducer): Likewise.
861         (function_type::write_reproducer): Likewise.
862         (function_type::write_deferred_reproducer): Likewise.
863         (field::write_reproducer): Likewise.
864         (struct_::access_as_type): Likewise.
865         (struct_::write_reproducer): Likewise.
866         (union_::write_reproducer): Likewise.
867         (union_::m_fields): Remove stray unused field.
868         (fields::length): New accessor.
869         (fields::get_field): New accessor.
870         (fields::write_reproducer): New function.
871         (rvalue::access_as_rvalue): Likewise.
872         (lvalue::access_as_rvalue): Likewise.
873         (lvalue::access_as_lvalue): Likewise.
874         (param::access_as_rvalue): Likewise.
875         (param::access_as_lvalue): Likewise.
876         (param::write_reproducer): Likewise.
877         (function::write_reproducer): Likewise.
878         (block::write_reproducer): Likewise.
879         (global::write_reproducer): Likewise.
880         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
881         Likewise.
882         (memento_of_new_string_literal::write_reproducer): Likewise.
883         (unary_op::write_reproducer): Likewise.
884         (binary_op::write_reproducer): Likewise.
885         (comparison::write_reproducer): Likewise.
886         (cast::write_reproducer): Likewise.
887         (call::write_reproducer): Likewise.
888         (call_through_ptr::write_reproducer): Likewise.
889         (array_access::write_reproducer): Likewise.
890         (access_field_of_lvalue::write_reproducer): Likewise.
891         (access_field_rvalue::write_reproducer): Likewise.
892         (dereference_field_rvalue::write_reproducer): Likewise.
893         (dereference_rvalue::write_reproducer): Likewise.
894         (get_address_of_lvalue::write_reproducer): Likewise.
895         (local::write_reproducer): Likewise.
896         (eval::write_reproducer): Likewise.
897         (assignment::write_reproducer): Likewise.
898         (assignment_op::write_reproducer): Likewise.
899         (comment::write_reproducer): Likewise.
900         (conditional::write_reproducer): Likewise.
901         (jump::write_reproducer): Likewise.
902         (return_::write_reproducer): Likewise.
903         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
904         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
905         param "created_by_user".
906         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
907         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
908         entrypoint.
909         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
910         entrypoint.
912 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
914         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
915         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
916         ctor.
917         (gcc::jit::rvalue_usage_validator::visit): New function.
918         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
919         function.
920         (gcc::jit::recording::rvalue::set_scope): New function.
921         (gcc::jit::recording::function::function): Call set_scope on each
922         param, issuing errors for any params that already have a function.
923         (gcc::jit::recording::block::add_eval): Return the new statement;
924         update the comment given that some error-checking now happens after
925         this returns.
926         (gcc::jit::recording::block::add_assignment): Likewise.
927         (gcc::jit::recording::block::add_assignment_op): Likewise.
928         (gcc::jit::recording::block::add_comment): Likewise.
929         (gcc::jit::recording::block::end_with_conditional): Likewise.
930         (gcc::jit::recording::block::end_with_jump): Likewise.
931         (gcc::jit::recording::block::end_with_return): Likewise.
932         (gcc::jit::recording::block::validate): Add a comment.
933         (gcc::jit::recording::unary_op::visit_children): New function.
934         (gcc::jit::recording::binary_op::visit_children): New function.
935         (gcc::jit::recording::comparison::visit_children): New function.
936         (gcc::jit::recording::cast::visit_children): New function.
937         (gcc::jit::recording::call::visit_children): New function.
938         (gcc::jit::recording::call_through_ptr::visit_children): New function.
939         (gcc::jit::recording::array_access::visit_children): New function.
940         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
941         function.
942         (gcc::jit::recording::access_field_rvalue::visit_children): New
943         function.
944         (gcc::jit::recording::dereference_field_rvalue::visit_children):
945         New function.
946         (gcc::jit::recording::dereference_rvalue::visit_children): New
947         function.
948         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
949         function.
950         * jit-recording.h: Within namespace gcc::jit::recording...
951         (class rvalue_visitor): New.
952         (rvalue::rvalue): Initialize m_scope.
953         (rvalue::get_loc): New accessor.
954         (rvalue::verify_valid_within_stmt): New function.
955         (rvalue::visit_children): New pure virtual function.
956         (rvalue::set_scope): New function.
957         (rvalue::get_scope): New function.
958         (rvalue::dyn_cast_param): New function.
959         (rvalue::m_scope): New field.
960         (param::visit_children): New empty function.
961         (param::dyn_cast_param): New function.
962         (function::get_loc): New function.
963         (block::add_eval): Return the new statement.
964         (block::add_assignment): Likewise.
965         (block::add_assignment_op): Likewise.
966         (block::add_comment): Likewise.
967         (block::end_with_conditional): Likewise.
968         (block::end_with_jump): Likewise.
969         (block::end_with_return): Likewise.
970         (global::visit_children): New function.
971         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
972         New function.
973         (memento_of_new_string_literal::visit_children): New function.
974         (unary_op::visit_children): New function.
975         (binary_op::visit_children): New function.
976         (comparison::visit_children): New function.
977         (cast::visit_children): New function.
978         (call::visit_children): New function.
979         (call_through_ptr::visit_children): New function.
980         (array_access::visit_children): New function.
981         (access_field_of_lvalue::visit_children): New function.
982         (access_field_rvalue::visit_children): New function.
983         (dereference_field_rvalue::visit_children): New function.
984         (dereference_rvalue::visit_children): New function.
985         (get_address_of_lvalue::visit_children): New function.
986         (local::local): Call set_scope.
987         (local::visit_children): New function.
988         (statement::get_block): Make public.
989         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
990         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
991         (gcc_jit_context_new_function): Verify that each param has
992         not yet been used for creating another function.
993         (gcc_jit_block_add_eval): After creating the stmt, verify
994         that the rvalue expression tree is valid to use within it.
995         (gcc_jit_block_add_assignment): Likewise for the lvalue and
996         rvalue expression trees.
997         (gcc_jit_block_add_assignment_op): Likewise.
998         (gcc_jit_block_end_with_conditional): Likewise for the boolval
999         expression tree.
1000         (gcc_jit_block_end_with_return): Likewise for the rvalue
1001         expression tree.
1002         (gcc_jit_block_end_with_void_return): Remove return of "void",
1003         now that block::end_with_return is now non-void.
1005 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1007         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
1008         Add missing fclose on error-handling path.
1010 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1012         * docs/cp/topics/expressions.rst (Global variables): Add
1013         enum gcc_jit_global_kind param to gccjit::context::new_global.
1014         * docs/topics/expressions.rst (Global variables): Likewise.
1015         Document the new enum.
1016         * docs/topics/results.rst (Compilation results): Document
1017         globals-handling.
1018         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1019         * dummy-frontend.c (jit_langhook_write_globals): Call into the
1020         playback context's write_global_decls_1 and write_global_decls_2
1021         before and after calling symtab->finalize_compilation_unit ().
1022         * jit-playback.c: Include "debug.h".
1023         (gcc::jit::playback::context::new_global): Add "kind" param and
1024         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
1025         underlying VAR_DECL.  Call varpool_node::get_create on the
1026         VAR_DECL, and add it to m_globals.
1027         (gcc::jit::playback::context::write_global_decls_1): New function.
1028         (gcc::jit::playback::context::write_global_decls_2): New function.
1029         * jit-playback.h (gcc::jit::playback::context::context): Call
1030         create on m_globals.
1031         (gcc::jit::playback::context::new_global): Add "kind" param.
1032         (gcc::jit::playback::context::write_global_decls_1): New function.
1033         (gcc::jit::playback::context::write_global_decls_2): New function.
1034         (gcc::jit::playback::context::m_globals): New field.
1035         * jit-recording.c (gcc::jit::recording::context::context):
1036         Initialize m_globals.
1037         (gcc::jit::recording::context::new_global): Add param "kind".
1038         Add the new global to m_globals.
1039         (gcc::jit::recording::context::dump_to_file): Dump the globals.
1040         (gcc::jit::recording::global::replay_into): Add field m_kind.
1041         (gcc::jit::recording::global::write_to_dump): New override.
1042         * jit-recording.h (gcc::jit::recording::context::new_global): Add
1043         param "kind".
1044         (gcc::jit::recording::context::m_globals): New field.
1045         (gcc::jit::recording::global::global): Add param kind.
1046         (gcc::jit::recording::global::write_to_dump): New override.
1047         (gcc::jit::recording::global::m_kind): New field.
1048         * jit-result.c (gcc::jit::result::get_global): New function.
1049         * jit-result.h (gcc::jit::result::get_global): New function.
1050         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
1051         * libgccjit.c (gcc_jit_context_new_global): Likewise.
1052         (gcc_jit_result_get_global): New API entrypoint.
1053         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
1054         (enum gcc_jit_global_kind): New enum.
1055         (gcc_jit_context_new_global): API change: add "kind" param.
1056         * libgccjit.map (gcc_jit_result_get_global): New symbol.
1058 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1060         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
1061         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
1062         earlier.
1063         * jit-builtins.c: Remove redundant includes of "opts.h" and
1064         "tree.h".
1065         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
1066         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
1067         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
1068         "statistics.h", "vec.h", "double-int.h", "real.h",
1069         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
1070         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
1071         earlier.
1072         * jit-recording.c: Remove redundant includes of "opts.h" and
1073         "tree.h".
1075 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1077         * docs/cp/topics/expressions.rst (Simple expressions): Use
1078         ":c:type:" for C types.  Document new overload of
1079         gcc::jit::context::new_rvalue.
1080         * docs/topics/expressions.rst (Simple expressions): Use
1081         ":c:type:" for C types.  Document new entrypoint
1082         gcc_jit_context_new_rvalue_from_long.
1083         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1084         * jit-playback.c: Within namespace gcc::jit::playback...
1085         (context::new_rvalue_from_int): Eliminate in favor of...
1086         (context::new_rvalue_from_const <int>): ...this.
1087         (context::new_rvalue_from_double): Eliminate in favor of...
1088         (context::new_rvalue_from_const <double>): ...this.
1089         (context::new_rvalue_from_const <long>): New.
1090         (context::new_rvalue_from_ptr): Eliminate in favor of...
1091         (context::new_rvalue_from_const <void *>): ...this.
1092         * jit-playback.h: Within namespace gcc::jit::playback...
1093         (context::new_rvalue_from_int): Eliminate in favor of...
1094         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
1095         (context::new_rvalue_from_double): Likewise.
1096         (context::new_rvalue_from_ptr): Likewise.
1097         * jit-recording.c: Within namespace gcc::jit::recording...
1098         (context::new_rvalue_from_int): Eliminate.
1099         (context::new_rvalue_from_double): Likewise.
1100         (context::new_rvalue_from_ptr): Likewise.
1101         (class memento_of_new_rvalue_from_const <int>):
1102         Add explicit specialization.
1103         (class memento_of_new_rvalue_from_const <long>):
1104         Likewise.
1105         (class memento_of_new_rvalue_from_const <double>):
1106         Likewise.
1107         (class memento_of_new_rvalue_from_const <void *>):
1108         Likewise.
1109         (memento_of_new_rvalue_from_int::replay_into):
1110         Generalize into...
1111         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
1112         ...this...
1113         (memento_of_new_rvalue_from_double::replay_into):
1114         ...allowing this...
1115         (memento_of_new_rvalue_from_ptr::replay_into):
1116         ...and this to be deleted.
1117         (memento_of_new_rvalue_from_int::make_debug_string):
1118         Convert to...
1119         (memento_of_new_rvalue_from_const <int>::make_debug_string):
1120         ...this.
1121         (memento_of_new_rvalue_from_double::make_debug_string):
1122         Convert to...
1123         (memento_of_new_rvalue_from_const <double>::make_debug_string):
1124         ...this.
1125         (memento_of_new_rvalue_from_ptr::make_debug_string)
1126         Convert to...
1127         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
1128         ...this.
1129         (memento_of_new_rvalue_from_const <long>::make_debug_string):
1130         New function.
1131         * jit-recording.h: Within namespace gcc::jit::recording...
1132         (context::new_rvalue_from_int): Eliminate.
1133         (context::new_rvalue_from_double): Likewise.
1134         (context::new_rvalue_from_ptr): Likewise, all in favor of...
1135         (context::new_rvalue_from_const <HOST_TYPE>): New family of
1136         methods.
1137         (class memento_of_new_rvalue_from_int): Eliminate.
1138         (class memento_of_new_rvalue_from_double): Likewise.
1139         (class memento_of_new_rvalue_from_ptr): Likewise.
1140         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
1141         of rvalue subclasses.
1142         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
1143         "long".
1144         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
1145         rewriting of recording::context::new_rvalue_from_int to
1146         recording::context::new_rvalue_from_const <int>.
1147         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
1148         (gcc_jit_context_new_rvalue_from_double): Update for
1149         rewriting of recording::context::new_rvalue_from_double to
1150         recording::context::new_rvalue_from_const <double>.
1151         (gcc_jit_context_new_rvalue_from_ptr): Update for
1152         rewriting of recording::context::new_rvalue_from_ptr to
1153         recording::context::new_rvalue_from_const <void *>.
1154         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
1155         entrypoint.
1156         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
1158 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1160         PR jit/64206
1161         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
1162         shows tempdir creation/cleanup.
1163         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1164         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
1165         to the list of subclasses in the comment.
1166         * jit-playback.c (gcc::jit::playback::context::context): Add a
1167         comment clarifying when the tempdir gets cleaned up.
1168         (gcc::jit::playback::context::compile): Pass the context's logger,
1169         if any, to the tempdir.
1170         (gcc::jit::playback::context::dlopen_built_dso): When creating the
1171         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
1172         over ownership of the tempdir to it.
1173         * jit-result.c: Include "jit-tempdir.h".
1174         (gcc::jit::result::result): Add tempdir param, saving it as
1175         m_tempdir.
1176         (gcc::jit::result::~result): Delete m_tempdir.
1177         * jit-result.h (gcc::jit::result::result): Add tempdir param.
1178         (gcc::jit::result::m_tempdir): New field.
1179         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
1180         add JIT_LOG_SCOPE.
1181         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
1182         and log m_path_template and m_path_tempdir.
1183         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
1184         entry/exit, and log the unlink and rmdir calls.
1185         * jit-tempdir.h: Include "jit-logging.h".
1186         (class gcc::jit::tempdir): Make this be a subclass of log_user.
1187         (gcc::jit::tempdir::tempdir): Add logger param.
1188         * notes.txt: Update to show the two possible places where the
1189         tempdir can be cleaned up.
1191 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1193         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
1194         comment.
1196 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1198         * docs/topics/contexts.rst (Error-handling): Document new
1199         entrypoint gcc_jit_context_get_last_error.
1200         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1201         * jit-recording.c (gcc::jit::recording::context::context):
1202         Initialize new fields "m_last_error_str" and
1203         "m_owns_last_error_str".
1204         (gcc::jit::recording::context::~context): Clean up
1205         m_last_error_str, if needed.
1206         (gcc::jit::recording::context::add_error_va): Update
1207         m_last_error_str and m_owns_last_error_str, freeing the old
1208         value if appropriate.
1209         (gcc::jit::recording::context::get_last_error): New function.
1210         * jit-recording.h (gcc::jit::recording::context::get_last_error):
1211         New function.
1212         (gcc::jit::recording::context): New fields m_last_error_str and
1213         m_owns_last_error_str.
1214         * libgccjit.c (gcc_jit_context_get_last_error): New function.
1215         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1216         * libgccjit.map (gcc_jit_context_get_last_error): New function.
1218 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1220         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1221         * docs/internals/index.rst (Overview of code structure): Mention
1222         gcc_jit_context_set_logfile, and embed the example logfile.
1223         * docs/internals/test-hello-world.exe.log.txt: New file: example
1224         of a logfile.
1225         * docs/topics/contexts.rst (Debugging): Add documentation
1226         for gcc_jit_context_set_logfile.
1227         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1228         * dummy-frontend.c: Include "jit-logging.h".
1229         (jit_langhook_init): Assert that there is an active playback
1230         context.  If it has a logger, log entry/exit to this function.
1231         (jit_langhook_write_globals): Likewise.
1232         * jit-common.h (gcc::jit::logger): New forward declaration.
1233         * jit-logging.c: New file.
1234         * jit-logging.h: New file.
1235         * jit-playback.c: Include "jit-logging.h".
1236         (gcc::jit::playback::context::context): Initialize the log_user
1237         base class from the recording context's logger (if any).  Use
1238         JIT_LOG_SCOPE to log entry/exit from the function body.
1239         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1240         log entry/exit from the function body.
1241         (gcc::jit::playback::build_stmt_list): Likewise.
1242         (gcc::jit::playback::function::postprocess): Likewise.
1243         (gcc::jit::playback::context::compile): Likewise.  Log the
1244         entry/exit to toplev::main and toplev::finalize.  Log the
1245         fake argv passed to toplev::main.
1246         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1247         log entry/exit from the function body.
1248         (gcc::jit::playback::context::release_mutex): Likewise.
1249         (gcc::jit::playback::context::make_fake_args): Likewise.
1250         (gcc::jit::playback::context::extract_any_requested_dumps):
1251         Likewise.
1252         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1253         log the arguments that the driver is invoked with.
1254         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
1255         the logger to the result object.
1256         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1257         log entry/exit from the function body.
1258         (gcc::jit::playback::context::dump_generated_code): Likewise.
1259         (gcc::jit::playback::context::handle_locations): Likewise.
1260         * jit-playback.h (gcc::jit::playback::context): Make this be
1261         a subclass of gcc::jit::log_user.
1262         * jit-recording.c: Include "jit-logging.h".
1263         (gcc::jit::recording::context::context: Initialize the logger to
1264         NULL for root contexts, or to the parent's logger for child
1265         contexts.
1266         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1267         log entry/exit from the function body.
1268         (gcc::jit::recording::context::replay_into): Likewise.
1269         (gcc::jit::recording::context::disassociate_from_playback):
1270         Likewise.
1271         (gcc::jit::recording::context::compile): Likewise.
1272         (recording::context::add_error_va): Likewise.  Also, log the
1273         error.
1274         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1275         log entry/exit from the function body.
1276         * jit-recording.h: Include "jit-logging.h".
1277         (gcc::jit::recording::context): Make this be a subclass of
1278         gcc::jit::log_user.
1279         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1280         (gcc::jit::result::result): Add logger param, recording it.
1281         Use JIT_LOG_SCOPE to log entry/exit from the function body.
1282         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1283         log entry/exit from the function body.
1284         (gcc::jit::result::get_code): Likewise.
1285         * jit-result.h (gcc::jit::result): Make this be a subclass of
1286         gcc::jit::log_user.
1287         (gcc::jit::result::result): Add logger parameter.
1288         * libgccjit++.h (gccjit::context::set_logfile): New function.
1289         * libgccjit.c: Include "jit-logging.h".
1290         (gcc_jit_context_acquire): Log the context.
1291         (gcc_jit_context_release): Use JIT_LOG_FUNC to
1292         log entry/exit from the function body, and log the context.
1293         (gcc_jit_context_new_child_context): Likewise, logging both
1294         contexts.
1295         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1296         log entry/exit from the function body.
1297         (gcc_jit_context_get_type): Likewise.
1298         (gcc_jit_context_get_int_type): Likewise.
1299         (gcc_jit_context_new_array_type): Likewise.
1300         (gcc_jit_context_new_field): Likewise.
1301         (gcc_jit_context_new_struct_type): Likewise.
1302         (gcc_jit_context_new_opaque_struct): Likewise.
1303         (gcc_jit_struct_set_fields): Likewise.
1304         (gcc_jit_context_new_union_type): Likewise.
1305         (gcc_jit_context_new_function_ptr_type): Likewise.
1306         (gcc_jit_context_new_param): Likewise.
1307         (gcc_jit_context_new_function): Likewise.
1308         (gcc_jit_context_get_builtin_function): Likewise.
1309         (gcc_jit_function_get_param): Likewise.
1310         (gcc_jit_function_dump_to_dot): Likewise.
1311         (gcc_jit_function_new_block): Likewise.
1312         (gcc_jit_context_new_global): Likewise.
1313         (gcc_jit_context_new_rvalue_from_int): Likewise.
1314         (gcc_jit_context_zero): Likewise.
1315         (gcc_jit_context_one): Likewise.
1316         (gcc_jit_context_new_rvalue_from_double): Likewise.
1317         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1318         (gcc_jit_context_null): Likewise.
1319         (gcc_jit_context_new_string_literal): Likewise.
1320         (gcc_jit_context_new_unary_op): Likewise.
1321         (gcc_jit_context_new_binary_op): Likewise.
1322         (gcc_jit_context_new_comparison): Likewise.
1323         (gcc_jit_context_new_call): Likewise.
1324         (gcc_jit_context_new_call_through_ptr): Likewise.
1325         (gcc_jit_context_new_cast): Likewise.
1326         (gcc_jit_context_new_array_access): Likewise.
1327         (gcc_jit_lvalue_access_field): Likewise.
1328         (gcc_jit_rvalue_access_field): Likewise.
1329         (gcc_jit_rvalue_dereference_field): Likewise.
1330         (gcc_jit_rvalue_dereference): Likewise.
1331         (gcc_jit_lvalue_get_address): Likewise.
1332         (gcc_jit_function_new_local): Likewise.
1333         (gcc_jit_block_add_eval): Likewise.
1334         (gcc_jit_block_add_assignment): Likewise.
1335         (gcc_jit_block_add_assignment_op): Likewise.
1336         (gcc_jit_block_end_with_conditional): Likewise.
1337         (gcc_jit_block_add_comment): Likewise.
1338         (gcc_jit_block_end_with_jump): Likewise.
1339         (gcc_jit_block_end_with_return): Likewise.
1340         (gcc_jit_block_end_with_void_return): Likewise.
1341         (gcc_jit_context_set_str_option): Likewise.
1342         (gcc_jit_context_set_int_option): Likewise.
1343         (gcc_jit_context_set_bool_option): Likewise.
1344         (gcc_jit_context_enable_dump): Likewise.
1345         (gcc_jit_context_compile): Likewise.  Also log the context,
1346         and the result.
1347         (gcc_jit_context_dump_to_file): Likewise.
1348         (gcc_jit_context_set_logfile): New function.
1349         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
1350         log entry/exit from the function body.
1351         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
1352         and the ptr to be returned.
1353         (gcc_jit_result_release): Likewise.  Also log the result.
1354         * libgccjit.h: Include <stdio.h>, since we need FILE *.
1355         (gcc_jit_context_set_logfile): New declaration.
1356         * libgccjit.map (gcc_jit_context_set_logfile): New.
1358 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1360         * jit-recording.h (gcc::jit::recording::type::is_void): New
1361         virtual function.
1362         (gcc::jit::recording::memento_of_get_type::is_void): New
1363         function, overriding default implementation.
1364         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
1365         the underlying type is not "void".
1367 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1369         * docs/topics/expressions.rst (Unary Operations): Add
1370         GCC_JIT_UNARY_OP_ABS.
1371         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
1372         Likewise.
1373         * jit-recording.c (unary_op_strings): Likewise.
1374         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
1375         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
1376         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
1377         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1379 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1381         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
1382         typo in comment.
1384 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1386         * TODO.rst (Test suite): Remove item about running C++ testcases.
1387         * docs/internals/index.rst (Working on the JIT library): Add
1388         "c++" to the enabled languages in the suggested "configure"
1389         invocation, and add a description of why this is necessary.
1390         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1392 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1394         * docs/internals/index.rst: Update to reflect that built
1395         testcases are now test-foo.c.exe, rather than test-foo.exe.
1396         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1398 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
1400         Update copyright years.
1402 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1404         * jit-playback.c (gcc::jit::playback::context::build_cast): In
1405         case BOOLEAN_TYPE, don't assume that the source expression is
1406         of type "int".
1408 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1410         * jit-recording.c (gcc::jit::recording::context::context): When
1411         copying string options from a parent context, take a copy of the
1412         underlying buffers, rather than simply copying the pointer.
1414 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1416         * jit-recording.c (gcc::jit::recording::context::set_str_option):
1417         Handle NULL.
1419 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
1421         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
1422         Document new function.
1423         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1425 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
1427         Minor interface cleanups of libgccjit
1428         * jit-playback.c (convert_to_dso): Use auto_vec instead
1429         of automatic array to build up command line.
1430         * jit-recording.c (recording::context::set_str_option):
1431         Make copy of the string.
1432         (recording::context::~context): Free string options.
1433         * jit-recording.h (recording::context): Adjust type
1434         of m_str_options member.
1435         * libgccjit.h: Adjust comment about
1436         gcc_jit_context_set_str_option parameter being used after
1437         the call.
1438         Update comment now that all interfaces are copy strings
1439         if necessary.
1440         * libgccjit++.h (gccjit::context): Add set_str_option
1441         member function.
1443 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
1445         * docs/cp/index.rst: New file.
1446         * docs/cp/intro/index.rst: New file.
1447         * docs/cp/intro/tutorial01.rst: New file.
1448         * docs/cp/intro/tutorial02.rst: New file.
1449         * docs/cp/intro/tutorial03.rst: New file.
1450         * docs/cp/intro/tutorial04.rst: New file.
1451         * docs/cp/topics/contexts.rst: New file.
1452         * docs/cp/topics/expressions.rst: New file.
1453         * docs/cp/topics/functions.rst: New file.
1454         * docs/cp/topics/index.rst: New file.
1455         * docs/cp/topics/locations.rst: New file.
1456         * docs/cp/topics/objects.rst: New file.
1457         * docs/cp/topics/results.rst: New file.
1458         * docs/cp/topics/types.rst: New file.
1459         * docs/examples/tut01-hello-world.cc: New file.
1460         * docs/examples/tut02-square.c: Fix missing newline in output.
1461         * docs/examples/tut02-square.cc: New file.
1462         * docs/examples/tut03-sum-of-squares.cc: New file.
1463         * docs/examples/tut04-toyvm/toyvm.cc: New file.
1464         * docs/index.rst: Move summary to above the table of contents.
1465         Add text about the C vs C++ APIs.
1466         * docs/topics/contexts.rst: Fix a typo.
1468         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1469         * docs/_build/texinfo/factorial1.png: New file.
1470         * docs/_build/texinfo/sum-of-squares1.png: New file.
1472 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1474         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
1475         logic for determine "funcname" to new function...
1476         (get_function_name): ...here, adding logic to skip any leading
1477         path from the filename.
1478         (toyvm_function_parse): Use the filename for fn_filename, rather
1479         than "name", so that the debugger can locate the source .toy
1480         file.
1481         (toyvm_function_parse): Don't fclose a NULL FILE *.
1483 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1485         PR jit/63854
1486         * docs/internals/index.rst (Running under valgrind): New
1487         subsection.
1488         (docs/_build/texinfo/libgccjit.texi): Regenerate.
1490 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1492         PR jit/64206
1493         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
1494         * jit-common.h (gcc::jit::tempdir): New forward decl.
1495         * jit-playback.c: Include jit-tempdir.h.
1496         (gcc::jit::playback::context::context): Initialize m_tempdir.
1497         (gcc::jit::playback::context::~context): Move tempdir
1498         cleanup to new file jit-tempdir.c
1499         (make_tempdir_path_template): Move to new file jit-tempdir.c.
1500         (gcc::jit::playback::context::compile): Move tempdir creation
1501         to new tempdir object in new file jit-tempdir.c.
1502         (gcc::jit::playback::context::make_fake_args): Get path from
1503         tempdir object rather than from member data.
1504         (gcc::jit::playback::context::convert_to_dso): Likewise.
1505         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1506         (gcc::jit::playback::context::dump_generated_code): Likewise.
1507         (gcc::jit::playback::context::get_path_c_file): New function.
1508         (gcc::jit::playback::context::get_path_s_file): New function.
1509         (gcc::jit::playback::context::get_path_so_file): New function.
1510         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1511         New function.
1512         (gcc::jit::playback::context::get_path_s_file): New function.
1513         (gcc::jit::playback::context::get_path_so_file): New function.
1514         (gcc::jit::playback::context): Move fields "m_path_template",
1515         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1516         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1517         * jit-tempdir.c: New file.
1518         * jit-tempdir.h: New file.
1520 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1522         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1523         mutex here, immediately before using toplev, and release it here, on
1524         each exit path after acquisition.
1525         (jit_mutex): Move this variable here, from jit-recording.c.
1526         (gcc::jit::playback::context::acquire_mutex): New function, based on
1527         code in jit-recording.c.
1528         (gcc::jit::playback::context::release_mutex): Likewise.
1529         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1530         function.
1531         (gcc::jit::playback::context::release_mutex): New function.
1532         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1533         (gcc::jit::recording::context::compile): Move mutex-handling from
1534         here into jit-playback.c's gcc::jit::playback::context::compile.
1535         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1536         and RELEASE_MUTEX.
1538 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1540         * jit-playback.c (gcc::jit::playback::context::compile): Move the
1541         dlopen code into...
1542         (gcc::jit::playback::context::dlopen_built_dso): ...this new
1543         function.
1544         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1545         New function.
1547 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1549         PR jit/64166
1550         * docs/topics/contexts.rst (Debugging): Add description of
1551         gcc_jit_context_enable_dump.
1552         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1553         * jit-playback.c: Include context.h.
1554         (class auto_argvec): New class.
1555         (auto_argvec::~auto_argvec): New function.
1556         (gcc::jit::playback::context::compile): Convert fake_args to be
1557         an auto_argvec, so that it can contain dynamically-allocated
1558         strings.   Construct a vec of all requested dumps, and pass it to
1559         make_fake_args.  Extract requested dumps between the calls to
1560         toplev::main and toplev::finalize.
1561         (gcc::jit::playback::context::make_fake_args): Convert param
1562         "argvec" to be a vec <char *>, and gain a "requested_dumps"
1563         param.  Convert to dynamically-allocated arg strings by converting
1564         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1565         for args that are already a copy.  Add args for all requested dumps.
1566         (gcc::jit::playback::context::extract_any_requested_dumps): New
1567         function.
1568         (gcc::jit::playback::context::read_dump_file): New function.
1569         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1570         Convert param "argvec" to be a vec <char *>, and gain a
1571         "requested_dumps" param.
1572         (gcc::jit::playback::context::extract_any_requested_dumps): New
1573         function.
1574         (gcc::jit::playback::context::read_dump_file): New function.
1575         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
1576         function.
1577         (gcc::jit::recording::context::get_all_requested_dumps): New
1578         function.
1579         * jit-recording.h (gcc::jit::recording::requested_dump): New
1580         struct.
1581         (gcc::jit::recording::context::enable_dump): New function.
1582         (gcc::jit::recording::context::get_all_requested_dumps): New
1583         function.
1584         (gcc::jit::recording::context::m_requested_dumps): New field.
1585         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
1586         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
1587         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
1589 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
1591         * libgccjit++.h: Indent the forward declarations of the classes to
1592         show the inheritance hierarchy.
1594 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
1596         * notes.txt: Show the beginning and ending of
1597         recording::context::compile vs playback::context::compile.  Show
1598         the creation and unlinking of the tempdir.  Show toplev::finalize.
1599         Move "RELEASE MUTEX" to the correct location.  Show
1600         gcc_jit_result_release, and indicate where the
1601         dlopen/dlsym/dlclose occur.
1603 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1605         * docs/examples/tut02-square.c (main): Release the context
1606         earlier, to show that this is possible.  Update error-handling
1607         to avoid a double-release of the context, and to avoid
1608         releasing a NULL result.
1609         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
1610         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
1611         * docs/topics/results.rst (gcc_jit_result): Mention that this
1612         controls the lifetimes of machine code functions.
1613         (gcc_jit_result_get_code): Spell out the requirements for this
1614         to succeed, and the lifetime of the result.
1615         (gcc_jit_result_release): Mention that this invalidates any code
1616         that was obtained from the result.
1617         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1619 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1621         PR jit/64018
1622         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
1623         Add description of error-handling, taken in part from...
1624         * docs/topics/contexts.rst (Error-handling): Expand, and move some
1625         content to tutorial02.rst.
1626         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1628 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1630         PR jit/64020
1631         * docs/topics/types.rst (Standard types) Add new enum values to
1632         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1633         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1634         Widen the left-hand column so that
1635         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1636         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1638         * jit-builtins.c: Include stringpool.h and jit-playback.h.
1639         Move everything out of the gcc::jit::recording namespace into
1640         just gcc::jit.
1641         (struct builtin_data): Add fields "fnclass", "attr", and
1642         "implicit_p".
1643         (DEF_BUILTIN): Update macro so populate the new fields.
1644         (builtins_manager::builtins_manager): Update for move out of
1645         recording namespace.  Initialize the m_attributes array.
1646         (builtins_manager::get_builtin_function): Likewise.
1647         (builtins_manager::get_builtin_function_by_id): New function.
1648         (builtins_manager::make_builtin_function): Update for move out of
1649         recording namespace.  Add fix for PR jit/64020 by detecting
1650         specific builtin ids and having them ensure that builtins for
1651         other ids are created as necessary.
1652         (builtins_manager::get_type): Update for move out of recording
1653         namespace.
1654         (builtins_manager::make_type): Likewise.  Add some missing
1655         #undefs.
1656         (builtins_manager::make_primitive_type): Update for move out of
1657         recording namespace.  Implement the three BT_COMPLEX_ cases and
1658         BT_DOUBLE_PTR.
1659         (builtins_manager::make_fn_type): Update for move out of recording
1660         namespace.
1661         (builtins_manager::make_ptr_type): Likewise.
1662         (builtins_manager::finish_playback): New function.
1663         (builtins_manager::get_class): New function.
1664         (builtins_manager::implicit_p): New function.
1665         (builtins_manager::get_attrs_tree): Two new functions.
1666         (builtins_manager::make_attrs_tree): New function.
1668         * jit-builtins.h: Move everything out of the gcc::jit::recording
1669         namespace into just gcc::jit.
1670         (enum built_in_attribute): New.
1671         (builtins_manager::builtins_manager): Update decl for namespace
1672         change.
1673         (builtins_manager::get_builtin_function): Likewise.
1674         (builtins_manager::get_class): New.
1675         (builtins_manager::implicit_p): New.
1676         (builtins_manager::get_attrs_tree): Two new functions.
1677         (builtins_manager::make_attrs_tree): New function.
1678         (builtins_manager::finish_playback): New.
1679         (builtins_manager::get_builtin_function_by_id): New.
1680         (builtins_manager::make_builtin_function): Update decl for
1681         namespace change.
1682         (builtins_manager::get_type): Likewise.
1683         (builtins_manager::make_type): Likewise.
1684         (builtins_manager::make_primitive_type): Likewise.
1685         (builtins_manager::make_fn_type): Likewise.
1686         (builtins_manager::make_ptr_type): Likewise.
1687         (builtins_manager): Likewise for fields.  Add new field
1688         "m_attributes".
1690         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1691         (builtins_manager): Update forward decl to reflect namespace
1692         change.
1694         * jit-playback.c: Include attribs.h and jit-builtins.h.
1695         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1696         for the new COMPLEX_ types.
1697         (gcc::jit::playback::context::new_function): If creating a
1698         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1699         and call set_builtin_decl.
1700         (gcc::jit::playback::context::replay): If we have a
1701         builtins_manager, call its finish_playback method when we're done.
1703         * jit-playback.h:
1704         (gcc::jit::playback::context::get_builtins_manager): New function.
1706         * jit-recording.c
1707         (gcc::jit::recording::context::get_builtins_manager): New function.
1708         (gcc::jit::recording::get_builtin_function): Use
1709         get_builtins_manager, in case we're a child context.
1710         (gcc::jit::recording::memento_of_get_type::dereference): Add the
1711         COMPLEX_ types.
1712         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1713         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1714         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1715         (get_type_strings): Likewise.
1717         * jit-recording.h
1718         (gcc::jit::recording::context::get_builtins_manager): New.
1720         * libgccjit.h (enum gcc_jit_types): Add
1721         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1722         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1724 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1726         * jit-builtins.c
1727         (gcc::jit::recording::builtins_manager::get_builtin_function):
1728         Check for NULL return from make_builtin_function.
1729         (gcc::jit::recording::builtins_manager::make_builtin_function):
1730         Check for NULL return from get_type.
1732 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1734         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1735         creation code into...
1736         (gcc::jit::playback::context::convert_to_dso): New function.
1737         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1738         New function.
1740 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1742         * jit-playback.c (gcc::jit::playback::context::compile): Use an
1743         auto_vec<const char *> rather than a const char *[20] for the
1744         top-level argv, and move the logic to build it to...
1745         (gcc::jit::playback::context::make_fake_args): New function.
1746         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1747         New function.
1749 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1751         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1752         * jit-playback.c: Include new header jit-result.h.
1753         (gcc::jit::result::result): Move to new file jit-result.c.
1754         (gcc::jit::result::~result): Likewise.
1755         (gcc::jit::playback::result): Likewise.
1756         * jit-recording.h (class gcc::jit::result): Move to new
1757         header jit-result.h.
1758         * jit-result.c: New file, to contain...
1759         (gcc::jit::result::result): Move here from jit-playback.c,
1760         removing erroneous "playback" namespace from comment.
1761         (gcc::jit::result::~result): Likewise.
1762         (gcc::jit::playback::result): Likewise.
1763         * jit-result.h: New file, to contain...
1764         (class gcc::jit::result): Move from jit-recording.h.
1765         * libgccjit.c: Include jit-result.h.
1766         (gcc_jit_result_get_code): Update comment to reflect move
1767         of implementation.
1768         (gcc_jit_result_release): Likewise.
1770 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1772         PR jit/63854
1773         * docs/examples/tut04-toyvm/toyvm.c
1774         (toyvm_compiled_function): New typedef.
1775         (toyvm_compiled_func) Rename to...
1776         (toyvm_compiled_code) ...this.
1777         (struct toyvm_compiled_function): New struct.
1778         (toyvm_function_compile): Return a toyvm_compiled_function *
1779         rather than a toyvm_compiled_func, so that the caller can fully
1780         clean things up.  Free "funcname".
1781         (test_script): Update for change to toyvm_function_compile.
1782         Clean up the toyvm_compiled_function.
1783         (main): Likewise.
1784         (docs/intro/tutorial04.rst): Update to reflect the above changes,
1785         and to better spell out the lifetime of the compiled code.
1787 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1789         PR jit/63854
1790         * jit-builtins.c
1791         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1792         context's new_function_type method, rather than directly creating
1793         a function_type instance.
1794         * jit-recording.c
1795         (gcc::jit::recording::context::new_function_type): New method,
1796         adapted from part of...
1797         (gcc::jit::recording::context::new_function_ptr_type): ...this.
1798         Update to call new_function_type.
1799         * jit-recording.h
1800         (gcc::jit::recording::context::new_function_type): New method.
1802 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
1804         PR jit/63969
1805         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1807 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1809         PR jit/63854
1810         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1811         Convert param from const vec<playback::field *> & to
1812         const auto_vec<playback::field *> *.
1813         (gcc::jit::playback::context::new_function_type): Convert param
1814         "param_types" from vec<type *> * to const auto_vec<type *> *.
1815         (gcc::jit::playback::context::new_function): Convert param
1816         "params" from vec<param *> * to const auto_vec<param *> *.
1817         (gcc::jit::playback::context::build_call): Convert param "args"
1818         from vec<rvalue *> to const auto_vec<rvalue *> *.
1819         (gcc::jit::playback::context::new_call): Likewise.
1820         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1821         (wrapper_finalizer): New function.
1822         (gcc::jit::playback::wrapper::operator new): Call the finalizer
1823         variant of ggc_internal_cleared_alloc, supplying
1824         wrapper_finalizer.
1825         (gcc::jit::playback::function::finalizer): New.
1826         (gcc::jit::playback::block::finalizer): New.
1827         (gcc::jit::playback::source_file::finalizer): New.
1828         (gcc::jit::playback::source_line::finalizer): New.
1830         * jit-playback.h
1831         (gcc::jit::playback::context::new_function_type): Convert param
1832         "param_types" from vec<type *> * to const auto_vec<type *> *.
1833         (gcc::jit::playback::context::new_function): Convert param
1834         "params" from vec<param *> * to const auto_vec<param *> *.
1835         (gcc::jit::playback::context::new_call): Convert param
1836         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1837         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1838         (gcc::jit::playback::context::build_call): Likewise.
1839         (gcc::jit::playback::context): Convert fields "m_functions",
1840         "m_source_files", "m_cached_locations" from vec to auto_vec.
1841         (gcc::jit::playback::wrapper::finalizer): New virtual function.
1842         (gcc::jit::playback::compound_type::set_fields): Convert param fro
1843         const vec<playback::field *> & to
1844         const auto_vec<playback::field *> *.
1845         (gcc::jit::playback::function::finalizer): New.
1846         (gcc::jit::playback::block::finalizer): New.
1847         (gcc::jit::playback::source_file::finalizer): New.
1848         (gcc::jit::playback::source_line::finalizer): New.
1850         * jit-recording.c
1851         (gcc::jit::recording::function_type::replay_into): Convert local
1852         from a vec into an auto_vec.
1853         (gcc::jit::recording::fields::replay_into): Likewise.
1854         (gcc::jit::recording::function::replay_into): Likewise.
1855         (gcc::jit::recording::call::replay_into): Likewise.
1856         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1858         * jit-recording.h (gcc::jit::recording::context): Convert fields
1859         "m_mementos", "m_compound_types", "m_functions" from vec<> to
1860         auto_vec <>.
1861         (gcc::jit::recording::function_type::get_param_types): Convert
1862         return type from vec<type *> to const vec<type *> &.
1863         (gcc::jit::recording::function_type): Convert field
1864         "m_param_types" from a vec<> to an auto_vec<>.
1865         (gcc::jit::recording::fields): Likewise for field "m_fields".
1866         (gcc::jit::recording::function::get_params): Convert return type
1867         from vec <param *> to const vec<param *> &.
1868         (gcc::jit::recording::function): Convert fields "m_params",
1869         "m_locals", "m_blocks" from vec<> to auto_vec<>.
1870         (gcc::jit::recording::block): Likewise for field "m_statements".
1871         vec<> to auto_vec<>.
1872         (gcc::jit::recording::call): Likewise for field "m_args".
1873         (gcc::jit::recording::call_through_ptr): Likewise.
1875 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
1877         PR jit/63854
1878         * jit-recording.c (recording::function::validate): Convert
1879         "worklist" from vec<> to autovec<> to fix a leak.
1881 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
1883         * ChangeLog.jit: New.
1884         * ChangeLog: New.
1885         * Make-lang.in: New.
1886         * TODO.rst: New.
1887         * config-lang.in: New.
1888         * docs/Makefile: New.
1889         * docs/_build/texinfo/Makefile: New.
1890         * docs/_build/texinfo/factorial.png: New.
1891         * docs/_build/texinfo/libgccjit.texi: New.
1892         * docs/_build/texinfo/sum-of-squares.png: New.
1893         * docs/conf.py: New.
1894         * docs/examples/tut01-hello-world.c: New.
1895         * docs/examples/tut02-square.c: New.
1896         * docs/examples/tut03-sum-of-squares.c: New.
1897         * docs/examples/tut04-toyvm/Makefile: New.
1898         * docs/examples/tut04-toyvm/factorial.toy: New.
1899         * docs/examples/tut04-toyvm/fibonacci.toy: New.
1900         * docs/examples/tut04-toyvm/toyvm.c: New.
1901         * docs/index.rst: New.
1902         * docs/internals/index.rst: New.
1903         * docs/intro/factorial.png: New.
1904         * docs/intro/index.rst: New.
1905         * docs/intro/sum-of-squares.png: New.
1906         * docs/intro/tutorial01.rst: New.
1907         * docs/intro/tutorial02.rst: New.
1908         * docs/intro/tutorial03.rst: New.
1909         * docs/intro/tutorial04.rst: New.
1910         * docs/topics/contexts.rst: New.
1911         * docs/topics/expressions.rst: New.
1912         * docs/topics/functions.rst: New.
1913         * docs/topics/index.rst: New.
1914         * docs/topics/locations.rst: New.
1915         * docs/topics/objects.rst: New.
1916         * docs/topics/results.rst: New.
1917         * docs/topics/types.rst: New.
1918         * dummy-frontend.c: New.
1919         * jit-builtins.c: New.
1920         * jit-builtins.h: New.
1921         * jit-common.h: New.
1922         * jit-playback.c: New.
1923         * jit-playback.h: New.
1924         * jit-recording.c: New.
1925         * jit-recording.h: New.
1926         * libgccjit++.h: New.
1927         * libgccjit.c: New.
1928         * libgccjit.h: New.
1929         * libgccjit.map: New.
1930         * notes.txt: New.
1932 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
1934         * Initial creation
1936 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1938 Copying and distribution of this file, with or without modification,
1939 are permitted in any medium without royalty provided the copyright
1940 notice and this notice are preserved.