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