Daily bump.
[official-gcc.git] / gcc / jit / ChangeLog
blobf5a836ac62cee59d4c22dabf85eaa7b4b11398ae
1 2021-11-24  Martin Liska  <mliska@suse.cz>
3         * jit-playback.c (function): Initialize m_blocks vector.
5 2021-11-20  Antoni Boucher  <bouanto@zoho.com>
7         PR target/96889
8         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_16): New ABI tag.
9         * docs/topics/functions.rst: Add documentation for the
10         functions gcc_jit_function_get_return_type and
11         gcc_jit_function_get_param_count
12         * docs/topics/types.rst: Add documentation for the functions
13         gcc_jit_function_type_get_return_type,
14         gcc_jit_function_type_get_param_count,
15         gcc_jit_function_type_get_param_type,
16         gcc_jit_type_unqualified, gcc_jit_type_dyncast_array,
17         gcc_jit_type_is_bool,
18         gcc_jit_type_dyncast_function_ptr_type,
19         gcc_jit_type_is_integral, gcc_jit_type_is_pointer,
20         gcc_jit_type_dyncast_vector,
21         gcc_jit_vector_type_get_element_type,
22         gcc_jit_vector_type_get_num_units,
23         gcc_jit_struct_get_field, gcc_jit_type_is_struct,
24         and gcc_jit_struct_get_field_count
25         * libgccjit.c:
26         (gcc_jit_function_get_return_type, gcc_jit_function_get_param_count,
27         gcc_jit_function_type_get_return_type,
28         gcc_jit_function_type_get_param_count,
29         gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified,
30         gcc_jit_type_dyncast_array, gcc_jit_type_is_bool,
31         gcc_jit_type_dyncast_function_ptr_type, gcc_jit_type_is_integral,
32         gcc_jit_type_is_pointer, gcc_jit_type_dyncast_vector,
33         gcc_jit_vector_type_get_element_type,
34         gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field,
35         gcc_jit_type_is_struct, gcc_jit_struct_get_field_count): New
36         functions.
37         (struct gcc_jit_function_type, struct gcc_jit_vector_type):
38         New types.
39         * libgccjit.h:
40         (gcc_jit_function_get_return_type, gcc_jit_function_get_param_count,
41         gcc_jit_function_type_get_return_type,
42         gcc_jit_function_type_get_param_count,
43         gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified,
44         gcc_jit_type_dyncast_array, gcc_jit_type_is_bool,
45         gcc_jit_type_dyncast_function_ptr_type, gcc_jit_type_is_integral,
46         gcc_jit_type_is_pointer, gcc_jit_type_dyncast_vector,
47         gcc_jit_vector_type_get_element_type,
48         gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field,
49         gcc_jit_type_is_struct, gcc_jit_struct_get_field_count): New
50         function declarations.
51         (struct gcc_jit_function_type, struct gcc_jit_vector_type):
52         New types.
53         * jit-recording.h: New functions (is_struct and is_vector)
54         * libgccjit.map (LIBGCCJIT_ABI_16): New ABI tag.
56 2021-11-12  David Malcolm  <dmalcolm@redhat.com>
58         PR jit/103199
59         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile):
60         Increase size of buffer.
61         * docs/examples/tut04-toyvm/toyvm.cc
62         (compilation_state::create_function): Likewise.
64 2021-09-10  Petter Tomner  <tomner@kth.se>
66         * jit-playback.c: Moved global var processing to after loc handling.
67           Setting TYPE_NAME for fundamental types.
68           Using common functions for finalizing globals.
69         * jit-playback.h: New method init_types().
70           Changed get_tree_node_for_type() to method.
72 2021-08-19  Iain Sandoe  <iain@sandoe.co.uk>
74         * docs/examples/tut04-toyvm/toyvm.c: Include jit-dejagnu.h.
75         * docs/examples/tut04-toyvm/toyvm.cc: Likewise.
76         * jit-dejagnu.h: New file, imported from dejagnu-1.6.2 and
77         patched for this application.
79 2021-08-18  Iain Sandoe  <iain@sandoe.co.uk>
81         PR jit/100613
82         * Make-lang.in: Provide clauses for Darwin hosts.
84 2021-07-18  Antoni Boucher  <bouanto@zoho.com>
86         PR target/95498
87         * jit-playback.c (convert): Add support to handle truncation and
88         extension in the convert function.
90 2021-05-19  Martin Liska  <mliska@suse.cz>
92         PR testsuite/100658
93         * libgccjit.c (gcc_jit_context_new_function): Fix typos.
95 2021-03-24  Matthias Klose  <doko@ubuntu.com>
97         * Make-lang.in (jit.sphinx.html, jit.sphinx.pdf): Use $(mkinstalldirs),
98         (jit.install-headers): Depend on installdirs.
100 2021-02-19  David Malcolm  <dmalcolm@redhat.com>
102         PR jit/99126
103         * jit-builtins.c
104         (gcc::jit::builtins_manager::get_builtin_function_by_id):
105         Update assertion to reject BUILT_IN_NONE.
106         (gcc::jit::builtins_manager::ensure_optimization_builtins_exist):
107         New.
108         * jit-builtins.h
109         (gcc::jit::builtins_manager::ensure_optimization_builtins_exist):
110         New decl.
111         * jit-playback.c (gcc::jit::playback::context::replay): Call it.
112         Remove redundant conditional on bm.
114 2021-01-14  David Malcolm  <dmalcolm@redhat.com>
116         * docs/cp/index.rst: Remove "Alpha" warning.
117         * docs/index.rst: Likewise.
118         * docs/_build/texinfo/libgccjit.texi: Regenerate
120 2020-11-25  Martin Sebor  <msebor@redhat.com>
122         PR bootstrap/94982
123         * jit-recording.c (recording::function::dump_to_dot): Avoid
124         -Wformat-diag.
125         (recording::block::dump_to_dot): Same.
127 2020-11-20  Jakub Jelinek  <jakub@redhat.com>
129         PR other/97911
130         * Make-lang.in (jit.serial): Change from goal to a
131         variable.
132         (.PHONY): Drop jit.serial and jit.prev.
133         ($(LIBGCCJIT_FILENAME)): Depend on $(jit.serial) rather than
134         jit.serial.
136 2020-11-18  Jakub Jelinek  <jakub@redhat.com>
138         * Make-lang.in (jit.serial): New goal.
139         (.PHONY): Add jit.serial jit.prev.
140         ($(LIBGCCJIT_FILENAME)): Depend on jit.prev.  Call LINK_PROGRESS.
142 2020-11-12  David Malcolm  <dmalcolm@redhat.com>
144         PR jit/87291
145         * docs/cp/topics/asm.rst: New file.
146         * docs/cp/topics/index.rst (Topic Reference): Add it.
147         * docs/topics/asm.rst: New file.
148         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_15): New.
149         * docs/topics/functions.rst (Statements): Add link to extended
150         asm.
151         * docs/topics/index.rst (Topic Reference): Add asm.rst.
152         * docs/topics/objects.rst: Add gcc_jit_extended_asm to ASCII art.
153         * docs/_build/texinfo/Makefile: Regenerate.
154         * docs/_build/texinfo/libgccjit.texi: Regenerate.
155         * jit-common.h (gcc::jit::recording::extended_asm): New forward
156         decl.
157         (gcc::jit::recording::top_level_asm): Likewise.
158         * jit-playback.c: Include "stmt.h".
159         (build_string): New.
160         (gcc::jit::playback::context::new_string_literal): Disambiguate
161         build_string call.
162         (gcc::jit::playback::context::add_top_level_asm): New.
163         (build_operand_chain): New.
164         (build_clobbers): New.
165         (build_goto_operands): New.
166         (gcc::jit::playback::block::add_extended_asm): New.
167         * jit-playback.h (gcc::jit::playback::context::add_top_level_asm):
168         New decl.
169         (struct gcc::jit::playback::asm_operand): New struct.
170         (gcc::jit::playback::block::add_extended_asm): New decl.
171         * jit-recording.c (gcc::jit::recording::context::dump_to_file):
172         Dump top-level asms.
173         (gcc::jit::recording::context::add_top_level_asm): New.
174         (gcc::jit::recording::block::add_extended_asm): New.
175         (gcc::jit::recording::block::end_with_extended_asm_goto): New.
176         (gcc::jit::recording::asm_operand::asm_operand): New.
177         (gcc::jit::recording::asm_operand::print): New.
178         (gcc::jit::recording::asm_operand::make_debug_string): New.
179         (gcc::jit::recording::output_asm_operand::write_reproducer): New.
180         (gcc::jit::recording::output_asm_operand::print): New.
181         (gcc::jit::recording::input_asm_operand::write_reproducer): New.
182         (gcc::jit::recording::input_asm_operand::print): New.
183         (gcc::jit::recording::extended_asm::add_output_operand): New.
184         (gcc::jit::recording::extended_asm::add_input_operand): New.
185         (gcc::jit::recording::extended_asm::add_clobber): New.
186         (gcc::jit::recording::extended_asm::replay_into): New.
187         (gcc::jit::recording::extended_asm::make_debug_string): New.
188         (gcc::jit::recording::extended_asm::write_flags): New.
189         (gcc::jit::recording::extended_asm::write_clobbers): New.
190         (gcc::jit::recording::extended_asm_simple::write_reproducer): New.
191         (gcc::jit::recording::extended_asm::maybe_populate_playback_blocks):
192         New.
193         (gcc::jit::recording::extended_asm_goto::extended_asm_goto): New.
194         (gcc::jit::recording::extended_asm_goto::replay_into): New.
195         (gcc::jit::recording::extended_asm_goto::write_reproducer): New.
196         (gcc::jit::recording::extended_asm_goto::get_successor_blocks):
197         New.
198         (gcc::jit::recording::extended_asm_goto::maybe_print_gotos): New.
199         (gcc::jit::recording::extended_asm_goto::maybe_populate_playback_blocks):
200         New.
201         (gcc::jit::recording::top_level_asm::top_level_asm): New.
202         (gcc::jit::recording::top_level_asm::replay_into): New.
203         (gcc::jit::recording::top_level_asm::make_debug_string): New.
204         (gcc::jit::recording::top_level_asm::write_to_dump): New.
205         (gcc::jit::recording::top_level_asm::write_reproducer): New.
206         * jit-recording.h
207         (gcc::jit::recording::context::add_top_level_asm): New decl.
208         (gcc::jit::recording::context::m_top_level_asms): New field.
209         (gcc::jit::recording::block::add_extended_asm): New decl.
210         (gcc::jit::recording::block::end_with_extended_asm_goto): New
211         decl.
212         (gcc::jit::recording::asm_operand): New class.
213         (gcc::jit::recording::output_asm_operand): New class.
214         (gcc::jit::recording::input_asm_operand): New class.
215         (gcc::jit::recording::extended_asm): New class.
216         (gcc::jit::recording::extended_asm_simple): New class.
217         (gcc::jit::recording::extended_asm_goto): New class.
218         (gcc::jit::recording::top_level_asm): New class.
219         * libgccjit++.h (gccjit::extended_asm): New forward decl.
220         (gccjit::context::add_top_level_asm): New.
221         (gccjit::block::add_extended_asm): New.
222         (gccjit::block::end_with_extended_asm_goto): New.
223         (gccjit::extended_asm): New class.
224         (gccjit::extended_asm::extended_asm): New ctors.
225         (gccjit::extended_asm::set_volatile_flag): New.
226         (gccjit::extended_asm::set_inline_flag): New.
227         (gccjit::extended_asm::add_output_operand): New.
228         (gccjit::extended_asm::add_input_operand): New.
229         (gccjit::extended_asm::add_clobber): New.
230         (gccjit::extended_asm::get_inner_extended_asm): New.
231         * libgccjit.c (struct gcc_jit_extended_asm): New.
232         (jit_error): Make "loc" param take a gcc::jit::recording::location *
233         rather than a gcc_jit_location *.
234         (gcc_jit_block_add_extended_asm): New entrypoint.
235         (gcc_jit_block_end_with_extended_asm_goto): New entrypoint.
236         (gcc_jit_extended_asm_as_object): New entrypoint.
237         (gcc_jit_extended_asm_set_volatile_flag): New entrypoint.
238         (gcc_jit_extended_asm_set_inline_flag): New entrypoint.
239         (gcc_jit_extended_asm_add_output_operand): New entrypoint.
240         (gcc_jit_extended_asm_add_clobber): New entrypoint.
241         (gcc_jit_context_add_top_level_asm): New entrypoint.
242         * libgccjit.h: Add gcc_jit_extended_asm to ASCII art.
243         (gcc_jit_extended_asm): New typedef.
244         (LIBGCCJIT_HAVE_ASM_STATEMENTS): New define.
245         (gcc_jit_block_add_extended_asm): New entrypoint.
246         (gcc_jit_block_end_with_extended_asm_goto): New entrypoint.
247         (gcc_jit_extended_asm_as_object): New entrypoint.
248         (gcc_jit_extended_asm_set_volatile_flag): New entrypoint.
249         (gcc_jit_extended_asm_set_inline_flag): New entrypoint.
250         (gcc_jit_extended_asm_add_output_operand): New entrypoint.
251         (gcc_jit_extended_asm_add_input_operand): New entrypoint.
252         (gcc_jit_extended_asm_add_clobber): New entrypoint.
253         (gcc_jit_context_add_top_level_asm): New entrypoint.
254         * libgccjit.map (LIBGCCJIT_ABI_15): New.
256 2020-11-12  David Malcolm  <dmalcolm@redhat.com>
258         * jit-recording.c (recording::context::new_string): Add "escaped"
259         param and use it when creating the new recording::string instance.
260         (recording::string::string): Add "escaped" param and use it to
261         initialize m_escaped.
262         (recording::string::make_debug_string): Replace check that first
263         char is double-quote with use of m_escaped.  Fix escaping of
264         '\t' and '\n'.  Set "escaped" on the result.
265         * jit-recording.h (recording::context::new_string): Add "escaped"
266         param.
267         (recording::string::string): Add "escaped" param.
268         (recording::string::m_escaped): New field.
270 2020-11-12  David Malcolm  <dmalcolm@redhat.com>
272         * libgccjit.h: Fix typo in comment.
274 2020-09-14  Andrea Corallo  <andrea.corallo@arm.com>
276         * docs/_build/texinfo/libgccjit.texi: Regenerate.
278 2020-09-11  Andrea Corallo  <andrea.corallo@arm.com>
280         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_14): New ABI tag.
281         * docs/topics/expressions.rst (gcc_jit_global_set_initializer):
282         Document new entry point in section 'Global variables'.
283         * jit-playback.c (global_new_decl, global_finalize_lvalue): New
284         method.
285         (playback::context::new_global): Make use of global_new_decl,
286         global_finalize_lvalue.
287         (load_blob_in_ctor): New template function in use by the
288         following.
289         (playback::context::new_global_initialized): New method.
290         * jit-playback.h (class context): Decl 'new_global_initialized',
291         'global_new_decl', 'global_finalize_lvalue'.
292         (lvalue::set_initializer): Add implementation.
293         * jit-recording.c (recording::memento_of_get_pointer::get_size)
294         (recording::memento_of_get_type::get_size): Add implementation.
295         (recording::global::write_initializer_reproducer): New function in
296         use by 'recording::global::write_reproducer'.
297         (recording::global::replay_into)
298         (recording::global::write_to_dump)
299         (recording::global::write_reproducer): Handle
300         initialized case.
301         * jit-recording.h (class type): Decl 'get_size' and
302         'num_elements'.
303         * libgccjit++.h (class lvalue): Declare new 'set_initializer'
304         method.
305         (class lvalue): Decl 'is_global' and 'set_initializer'.
306         (class global) Decl 'write_initializer_reproducer'. Add
307         'm_initializer', 'm_initializer_num_bytes' fields.  Implement
308         'set_initializer'. Add a destructor to free 'm_initializer'.
309         * libgccjit.c (gcc_jit_global_set_initializer): New function.
310         * libgccjit.h (gcc_jit_global_set_initializer): New function
311         declaration.
312         * libgccjit.map (LIBGCCJIT_ABI_14): New ABI tag.
314 2020-08-28  Martin Sebor  <msebor@redhat.com>
316         * jit-recording.c (recording::switch_::make_debug_string): Add argument
317         to a call.
319 2020-08-22  Andrea Corallo  <andrea.corallo@arm.com>
321         * libgccjit.c:
322         (gcc_jit_context_new_rvalue_from_int)
323         (gcc_jit_context_new_rvalue_from_long)
324         (gcc_jit_context_new_rvalue_from_double)
325         (gcc_jit_context_new_rvalue_from_ptr): Update function heading
326         comments.
328 2020-06-16  Nicolas Bértolo  <nicolasbertolo@gmail.com>
330         * Make-lang.in: Always define version, minor and release
331         numbers. Create the Windows shared library as
332         libgccjit-$(LIBGCCJIT_VERSION_NUM).dll.
334 2020-06-03  David Malcolm  <dmalcolm@redhat.com>
336         PR jit/95306
337         * jit-builtins.c (builtins_manager::make_primitive_type):
338         Implement BT_CONST_VOLATILE_PTR.
340 2020-06-02  David Malcolm  <dmalcolm@redhat.com>
342         PR jit/95426
343         * dummy-frontend.c: Include "options.h", "stringpool.h", and
344         "attribs.h".
345         (ATTR_EXCL): New, copied from lto/lto-lang.c.
346         (attr_noreturn_exclusions): Likewise.
347         (attr_returns_twice_exclusions): Likewise.
348         (attr_const_pure_exclusions): Likewise.
349         (jit_attribute_table): Likewise, copied from lto_attribute_table.
350         (jit_format_attribute_table): Likewise, copied from
351         lto_format_attribute_table.
352         (handle_noreturn_attribute): New, copied from lto/lto-lang.c.
353         (handle_leaf_attribute): Likewise.
354         (handle_const_attribute): Likewise.
355         (handle_malloc_attribute): Likewise.
356         (handle_pure_attribute): Likewise.
357         (handle_novops_attribute): Likewise.
358         (get_nonnull_operand): Likewise.
359         (handle_nonnull_attribute): Likewise.
360         (handle_nothrow_attribute): Likewise.
361         (handle_sentinel_attribute): Likewise.
362         (handle_type_generic_attribute): Likewise.
363         (handle_transaction_pure_attribute): Likewise.
364         (handle_returns_twice_attribute): Likewise.
365         (handle_patchable_function_entry_attribute): Likewise.
366         (ignore_attribute): Likewise.
367         (handle_format_attribute): Likewise.
368         (handle_format_arg_attribute): Likewise.
369         (handle_fnspec_attribute): Likewise.
370         (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Define.
371         (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Define.
373 2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>
375         * Make-lang.in: Remove extra slash. Build libgccjit.dll and its
376         import library in Windows.
377         * config-lang.in: Update comment about --enable-host-shared.
378         * jit-w32.h: New file.
379         * jit-w32.c: New file.
380         (print_last_error): New function that prints the error
381         string corresponding to GetLastError().
382         (get_TOKEN_USER_current_user): Helper function used for getting
383         the SID belonging to the current user.
384         (create_directory_for_current_user): Helper function to create
385         a directory with permissions such that only the current user can
386         access it.
387         (win_mkdtemp): Create a temporary directory using Windows APIs.
388         * jit-playback.c: Do not chmod files in Windows. Use LoadLibrary,
389         FreeLibrary and GetProcAddress instead of libdl.
390         * jit-result.h, jit-result.c: Introduce result::handle_t to
391         abstract over the types used for dynamic library handles.
392         * jit-tempdir.c: Do not use mkdtemp() in Windows, use
393         win_mkdtemp().
395 2020-05-27  David Malcolm  <dmalcolm@redhat.com>
397         PR jit/95314
398         * dummy-frontend.c (LANG_HOOKS_DEEP_UNSHARING): Define to be true.
399         * jit-playback.h (gcc::jit::playback::rvalue): Mark tree node with
400         TREE_VISITED.
402 2020-05-27  Tom Tromey  <tromey@gcc.gnu.org>
404         PR jit/91330
405         * docs/conf.py (texinfo_documents): Set description.
406         * docs/_build/texinfo/libgccjit.texi: Regenerate.
408 2020-05-26  David Malcolm  <dmalcolm@redhat.com>
410         PR jit/95306
411         * docs/topics/functions.rst
412         (gcc_jit_context_get_builtin_function): Document.
413         * docs/_build/texinfo/libgccjit.texi: Regenerate.
414         * dummy-frontend.c (jit_langhook_global_bindings_p): Remove
415         gcc_unreachable.
416         * jit-builtins.c (type_names): New array.
417         (get_string_for_type_id): New function.
418         (gcc::jit::builtins_manager::make_primitive_type): Show name of
419         type in error messages.  Update cases to reflect the order in
420         builtin-types.def.  Implement cases for BT_INT8, BT_INT16,
421         BT_UINT8, BT_CONST_PTR, BT_VOLATILE_PTR, BT_INT_PTR, BT_FLOAT_PTR,
422         BT_CONST_DOUBLE_PTR, BT_SIZE, BT_CONST_SIZE.
424 2020-05-26  David Malcolm  <dmalcolm@redhat.com>
426         * docs/topics/compatibility.rst: Fix underline.
427         Fix missing labels.
428         * docs/topics/types.rst: Fix missing blank line.
429         * docs/_build/texinfo/libgccjit.texi: Regenerate.
431 2020-05-26  David Malcolm  <dmalcolm@redhat.com>
433         PR jit/95296
434         * docs/topics/expressions.rst (Unary Operations): Document that
435         result_type of gcc_jit_context_new_unary_op must be a numeric type.
436         (Binary Operations): Likewise for gcc_jit_context_new_binary_op.
437         (Global variables): Document that "type" of
438         gcc_jit_context_new_global must be non-`void`.
439         * docs/topics/function-pointers.rst
440         (gcc_jit_context_new_function_ptr_type): Document that the
441         param_types must be non-void, but that return_type may be.
442         * docs/topics/functions.rst (Params): Document that
443         gcc_jit_context_new_param's type must be non-void.
444         (Functions): Likewise for gcc_jit_function_new_local.
445         * docs/topics/types.rst (gcc_jit_context_new_array_type): Document
446         that the type must be non-void.
447         (gcc_jit_context_new_field): Likewise.
448         * docs/_build/texinfo/Makefile: Regenerate.
449         * docs/_build/texinfo/libgccjit.texi: Regenerate.
450         * libgccjit.c (gcc_jit_context_new_array_type): Fail if
451         element_type is void.
452         (gcc_jit_context_new_field): Likewise for "type".
453         (gcc_jit_context_new_function_ptr_type): Likewise for each
454         element of param_types.
455         (gcc_jit_context_new_param): Likewise for "type".
456         (gcc_jit_context_new_global): Likewise.
457         (gcc_jit_function_new_local): Likewise.
458         (gcc_jit_type_get_aligned): Likewise.
460 2020-03-31  Andrea Corallo  <andrea.corallo@arm.com>
461             David Malcolm  <dmalcolm@redhat.com>
463         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_13): New ABI tag
464         plus add version paragraph.
465         * libgccjit++.h (namespace gccjit::version): Add new namespace.
466         * libgccjit.c (gcc_jit_version_major, gcc_jit_version_minor)
467         (gcc_jit_version_patchlevel): New functions.
468         * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_version): New macro.
469         (gcc_jit_version_major, gcc_jit_version_minor)
470         (gcc_jit_version_patchlevel): New functions.
471         * libgccjit.map (LIBGCCJIT_ABI_13) New ABI tag.
473 2020-03-23  Andrea Corallo  <andrea.corallo@arm.com>
475         * jit-playback.h
476         (gcc::jit::playback::context m_recording_ctxt): Remove
477         m_char_array_type_node field.
478         * jit-playback.c
479         (playback::context::context) Remove m_char_array_type_node from member
480         initializer list.
481         (playback::context::new_string_literal) Fix logic to handle string
482         length > 200.
484 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
486         Update copyright years.
488 2019-11-29  Julian Brown  <julian@codesourcery.com>
490         * jit-builtins.c (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR):
491         Remove commented-out cases.
493 2019-11-20  David Malcolm  <dmalcolm@redhat.com>
495         PR jit/92483
496         * jit-playback.c (gcc::jit::playback::context::make_fake_args):
497         Update GCC_JIT_BOOL_OPTION_SELFCHECK_GC for new --param syntax.
499 2019-08-13  Richard Sandiford  <richard.sandiford@arm.com>
501         PR middle-end/91421
502         * jit-playback.c (new_function): Use set_decl_built_in_function.
504 2019-07-22  Andrea Corallo  <andrea.corallo@arm.com>
506         * jit-recording.c (unary_op_reproducer_strings): Make it extern.
507         (binary_op_reproducer_strings): Likewise.
508         * jit-recording.h (unary_op_reproducer_strings): Likewise.
509         (binary_op_reproducer_strings): Likewise.
510         * libgccjit.c (gcc_jit_context_new_unary_op): Check result_type to be a
511         numeric type.
512         * libgccjit.c (gcc_jit_context_new_binary_op): Improve error message.
514 2019-07-04  Andrea Corallo  <andrea.corallo@arm.com>
516         * libgccjit.c (gcc_jit_context_new_binary_op): Check result_type to be a
517         numeric type.
519 2019-07-04  Andrea Corallo  <andrea.corallo@arm.com>
521         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_12): New ABI tag.
522         * docs/topics/types.rst: Add gcc_jit_context_new_bitfield.
523         * jit-common.h (namespace recording): Add class bitfield.
524         * jit-playback.c:
525         (DECL_C_BIT_FIELD, SET_DECL_C_BIT_FIELD): Add macros.
526         (playback::context::new_bitfield): New method.
527         (playback::compound_type::set_fields): Add bitfield support.
528         (playback::lvalue::mark_addressable): Was jit_mark_addressable make this
529         a method of lvalue plus return a bool to communicate success.
530         (playback::lvalue::get_address): Check for jit_mark_addressable return
531         value.
532         * jit-playback.h (new_bitfield): New method.
533         (class bitfield): New class.
534         (class lvalue): Add jit_mark_addressable method.
535         * jit-recording.c (recording::context::new_bitfield): New method.
536         (recording::bitfield::replay_into): New method.
537         (recording::bitfield::write_to_dump): Likewise.
538         (recording::bitfield::make_debug_string): Likewise.
539         (recording::bitfield::write_reproducer): Likewise.
540         * jit-recording.h (class context): Add new_bitfield method.
541         (class field): Make it derivable by class bitfield.
542         (class bitfield): Add new class.
543         * libgccjit++.h (class context): Add new_bitfield method.
544         * libgccjit.c (struct gcc_jit_bitfield): New structure.
545         (gcc_jit_context_new_bitfield): New function.
546         * libgccjit.h
547         (LIBGCCJIT_HAVE_gcc_jit_context_new_bitfield) New macro.
548         (gcc_jit_context_new_bitfield): New function.
549         * libgccjit.map (LIBGCCJIT_ABI_12) New ABI tag.
551 2019-03-21  Jakub Jelinek  <jakub@redhat.com>
553         * jit-recording.c (reproducer::m_set_identifiers): Use false as Lazy
554         in hash_set template param.
556 2019-02-05  Andrea Corallo  <andrea.corallo@arm.com>
558         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_11): New ABI tag.
559         * docs/topics/contexts.rst (Additional driver options): New
560         section.
561         * jit-playback.c (invoke_driver): Add call to append_driver_options.
562         * jit-recording.c: Within namespace gcc::jit...
563         (recording::context::~context): Free the optnames within
564         m_driver_options.
565         (recording::context::add_driver_option): New method.
566         (recording::context::append_driver_options): New method.
567         (recording::context::dump_reproducer_to_file): Add driver
568         options.
569         * jit-recording.h: Within namespace gcc::jit...
570         (recording::context::add_driver_option): New method.
571         (recording::context::append_driver_options): New method.
572         (recording::context::m_driver_options): New field.
573         * libgccjit++.h (gccjit::context::add_driver_option): New
574         method.
575         * libgccjit.c (gcc_jit_context_add_driver_option): New API
576         entrypoint.
577         * libgccjit.h (gcc_jit_context_add_driver_option): New API
578         entrypoint.
579         (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option): New
580         macro.
581         * libgccjit.map (LIBGCCJIT_ABI_11): New ABI tag.
583 2019-01-01  Jakub Jelinek  <jakub@redhat.com>
585         Update copyright years.
587 2018-11-15  David Malcolm  <dmalcolm@redhat.com>
589         PR other/19165
590         * dummy-frontend.c (jit_begin_diagnostic): Add diagnostic_t param.
592 2018-11-13  David Malcolm  <dmalcolm@redhat.com>
594         * jit-playback.c: Replace "source_location" with "location_t".
596 2018-10-17  David Malcolm  <dmalcolm@redhat.com>
598         * Make-lang.in (selftest-jit): New.
600 2018-06-28  Martin Liska  <mliska@suse.cz>
602         * jit-playback.c: Include opt-suggestions.h.
604 2018-06-28  Martin Liska  <mliska@suse.cz>
606         * jit-playback.c (class auto_argvec): Moved to vec.h.
607         (auto_argvec::~auto_argvec): Likewise.
608         (compile): Use the renamed name.
609         (invoke_driver): Likewise.
611 2018-03-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
613         PR jit/84288
614         * Make-lang.in ($(LIBGCCJIT_FILENAME)): Add $(EXTRA_GCC_LIBS).
616 2018-03-09  David Malcolm  <dmalcolm@redhat.com>
617             Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
619         PR jit/64089
620         PR jit/84288
621         * Make-lang.in (COMMA): New.
622         (LIBGCCJIT_VERSION_SCRIPT_OPTION): New.
623         (LIBGCCJIT_SONAME_OPTION): New.
624         (jit): Move --version-script and -soname linker options to the
625         above.
627 2018-01-25  David Malcolm  <dmalcolm@redhat.com>
629         PR jit/81672
630         * jit-recording.h (gcc::jit::recording::union_): Remove fields
631         "m_loc" and "m_name".
633 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
635         Update copyright years.
637 2017-12-19  Jakub Jelinek  <jakub@redhat.com>
639         * jit-playback.c (get_type, playback::compile_to_file::copy_file,
640         playback::context::acquire_mutex): Replace Yoda conditions with
641         typical order conditions.
642         * libgccjit.c (gcc_jit_context_new_struct_type,
643         gcc_jit_struct_set_fields, gcc_jit_context_new_union_type,
644         gcc_jit_context_new_function, gcc_jit_timer_pop): Likewise.
645         * jit-builtins.c (matches_builtin): Likewise.
646         * jit-recording.c (recording::compound_type::set_fields,
647         recording::fields::write_reproducer, recording::rvalue::set_scope,
648         recording::function::validate): Likewise.
649         * jit-logging.c (logger::decref): Likewise.
651 2017-11-30  Jakub Jelinek  <jakub@redhat.com>
653         * jit-recording.c
654         (recording::memento_of_new_rvalue_from_const <long>::write_reproducer):
655         Use ; instead of ;;.
657 2017-11-28  Jakub Jelinek  <jakub@redhat.com>
659         * jit-playback.c (add_switch): Build SWITCH_EXPR using build2 instead
660         of build3.  Formatting fixes.  Adjust funciton comment.
662 2017-11-23  Tom de Vries  <tom@codesourcery.com>
664         * libgccjit.c (RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE): Wrap in
665         JIT_{BEGIN,END}_STMT.
667 2017-10-31  David Malcolm  <dmalcolm@redhat.com>
669         * docs/internals/index.rst (Running the test suite): Document
670         PRESERVE_EXECUTABLES.
671         (Running under valgrind): Add markup to RUN_UNDER_VALGRIND.
672         * docs/_build/texinfo/libgccjit.texi: Regenerate.
674 2017-10-04  David Malcolm  <dmalcolm@redhat.com>
676         * docs/cp/topics/expressions.rst (Vector expressions): New
677         section.
678         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_10): New ABI tag.
679         * docs/topics/expressions.rst (Vector expressions): New section.
680         * docs/topics/types.rst (gcc_jit_type_get_vector): Add link to
681         gcc_jit_context_new_rvalue_from_vector.
682         * docs/_build/texinfo/libgccjit.texi: Regenerate.
683         * jit-common.h (gcc::jit:recording::vector_type): New forward
684         decl.
685         * jit-playback.c
686         (gcc::jit::playback::context::new_rvalue_from_vector): New method.
687         * jit-playback.h
688         (gcc::jit::playback::context::new_rvalue_from_vector): New method.
689         * jit-recording.c: In namespace gcc::jit::
690         (class comma_separated_string): New class.
691         (comma_separated_string::comma_separated_string): New ctor,
692         adapted from recording::call::make_debug_string.
693         (comma_separated_string::~comma_separated_string): New dtor.
694         In namespace gcc::jit::recording::
695         (context::new_rvalue_from_vector): New method.
696         (type::get_vector): Update for renaming of memento_of_get_vector.
697         (class memento_of_get_vector): Rename to...
698         (class vector_type): ..this.
699         (memento_of_new_rvalue_from_vector::memento_of_new_rvalue_from_vector):
700         New ctor.
701         (memento_of_new_rvalue_from_vector::replay_into): New method.
702         (memento_of_new_rvalue_from_vector::visit_children): New method.
703         (memento_of_new_rvalue_from_vector::make_debug_string): New
704         method.
705         (memento_of_new_rvalue_from_vector::write_reproducer): New method.
706         (call::make_debug_string): Split out arg-printing code into ctor
707         for comma_separated_string.
708         * jit-recording.h: In namespace gcc::jit::recording::
709         (context::new_rvalue_from_vector): New method.
710         (type::dyn_cast_vector_type): New virtual function.
711         (class memento_of_get_vector): Rename to...
712         (class vector_type): ...this.
713         (vector_type::unqualified): Remove this vfunc override in favor
714         of...
715         (vector_type::get_element_type): ...this new method.
716         (vector_type::get_num_units): New method.
717         (vector_type::dyn_cast_vector_type): New vfunc override.
718         (class memento_of_new_rvalue_from_vector): New class.
719         * libgccjit++.h (gccjit::context::new_rvalue): Add overload for
720         vector of rvalue.
721         * libgccjit.c (gcc_jit_context_new_binary_op): Strip off type
722         qualifications when checking that both operands have same type.
723         (gcc_jit_context_new_rvalue_from_vector): New API entrypoint.
724         * libgccjit.h
725         (LIBGCCJIT_HAVE_gcc_jit_context_new_rvalue_from_vector): New
726         macro.
727         (gcc_jit_context_new_rvalue_from_vector): New API entrypoint.
728         * libgccjit.map (LIBGCCJIT_ABI_10): New ABI tag.
730 2017-09-28  David Malcolm  <dmalcolm@redhat.com>
732         * docs/topics/expressions.rst (Function calls): Add link to
733         gcc_jit_context_new_function_ptr_type.
734         (Function pointers): Convert to cross-references to
735         function-pointers.rst, moving material there.
736         * docs/topics/function-pointers.rst: New page.
737         * docs/topics/index.rst: Add function-pointers.rst.
738         * docs/topics/types.rst (Function pointer types): New section.
739         * docs/_build/texinfo/libgccjit.texi: Regenerate.
741 2017-09-28  David Malcolm  <dmalcolm@redhat.com>
743         * jit-recording.c
744         (gcc::jit::recording::function_type::is_same_type_as): New function.
745         * jit-recording.h: In namespace gcc::jit::recording::
746         (type::accepts_writes_from): Use is_same_type_as rather than pointer
747         equality.
748         (type::is_same_type_as): New virtual function.
749         (function_type::is_same_type_as): New override.
751 2017-09-27  David Malcolm  <dmalcolm@redhat.com>
753         * docs/cp/topics/expressions.rst (Function pointers): New section.
754         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_9): New tag.
755         * docs/topics/expressions.rst (Function pointers): New section.
756         * docs/_build/texinfo/libgccjit.texi: Regenerate.
757         * jit-common.h (class gcc::jit::recording::function_pointer): New
758         forward decl.
759         * jit-playback.c (gcc::jit::playback::function::get_address): New
760         method.
761         * jit-playback.h (gcc::jit::playback::function::get_address): New
762         method decl.
763         * jit-recording.c: Within namespace gcc::jit::recording...
764         (function::function): Initialize new field "m_fn_ptr_type".
765         (function::get_address): New method.
766         (function_pointer::replay_into): New method.
767         (function_pointer::visit_children): New method.
768         (function_pointer::make_debug_string): New method.
769         (function_pointer::write_reproducer): New method.
770         * jit-recording.h: Within namespace gcc::jit::recording...
771         (function::get_address): New method.
772         (function): Add field "m_fn_ptr_type".
773         (class function_pointer): New subclass of rvalue.
774         * libgccjit++.h (gccjit::function::get_address): New method.
775         * libgccjit.c (gcc_jit_function_get_address): New function.
776         * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_function_get_address): New
777         macro.
778         (gcc_jit_function_get_address): New API entrypoint.
779         * libgccjit.map (LIBGCCJIT_ABI_9): New tag.
781 2017-09-14  David Malcolm  <dmalcolm@redhat.com>
783         PR jit/82174
784         * jit-builtins.c (matches_builtin): Ignore entries with a NULL
785         name.
787 2017-08-18  David Malcolm  <dmalcolm@redhat.com>
789         PR tree-optimization/46805
790         * dummy-frontend.c (jit_langhook_parse_file): Handle vector types.
792 2017-08-18  David Malcolm  <dmalcolm@redhat.com>
794         * jit-recording.c (class gcc::jit::reproducer): Rename field
795         "m_identifiers" to "m_map_memento_to_identifier".  Add field
796         "m_set_identifiers" and struct hash_traits for it.
797         (gcc::jit::reproducer::reproducer): Update for above.
798         (convert_to_identifier): New function.
799         (gcc::jit::reproducer::ensure_identifier_is_unique): New method.
800         (gcc::jit::reproducer::make_identifier): Avoid appending the %p
801         unless necessary for uniqueness.  Update for field renaming.
802         (gcc::jit::reproducer::get_identifier): Update for field renaming.
804 2017-08-09  David Malcolm  <dmalcolm@redhat.com>
806         * docs/cp/topics/types.rst (Vector types): New section.
807         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_8): New tag.
808         * docs/topics/types.rst (gcc_jit_context_get_type): Fix typo in
809         example.
810         (Vector types): New section.
811         * docs/_build/texinfo/libgccjit.texi: Regenerate.
812         * jit-playback.c (gcc::jit::playback::type::get_vector): New
813         method.
814         * jit-playback.h (gcc::jit::playback::type::get_vector): New
815         method.
816         * jit-recording.c: In namespace gcc::jit::recording::
817         (type::get_vector): New method.
818         (memento_of_get_aligned::write_reproducer): Fix typo
819         in leading comment.
820         (memento_of_get_vector::replay_into): New method.
821         (memento_of_get_vector::make_debug_string): New method.
822         (memento_of_get_vector::write_reproducer): New method.
823         * jit-recording.h: In namespace gcc::jit::recording::
824         (type::get_vector): New
825          method.
826         (class memento_of_get_vector): New class.
827         * libgccjit++.h (gccjit::type::get_vector): New method.
828         * libgccjit.c (gcc_jit_type_get_vector): New public entrypoint.
829         * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_type_get_vector): New
830         define.
831         (gcc_jit_type_get_vector): New decl.
832         * libgccjit.map (LIBGCCJIT_ABI_8): New ABI tag.
834 2017-07-05  Richard Sandiford  <richard.sandiford@linaro.org>
835             Alan Hayward  <alan.hayward@arm.com>
836             David Sherwood  <david.sherwood@arm.com>
838         * dummy-frontend.c (jit_langhook_type_for_mode): Remove "enum" before
839         "machine_mode".
841 2017-04-24  David Malcolm  <dmalcolm@redhat.com>
843         * docs/cp/topics/types.rst (gccjit::type::get_const): Remove
844         comment.
845         (gccjit::type::get_aligned): Add.
846         * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_7.
847         * docs/topics/types.rst: Add gcc_jit_type_get_aligned.
848         * docs/_build/texinfo/libgccjit.texi: Regenerate.
849         * jit-playback.c (gcc::jit::playback::type::get_aligned): New
850         method.
851         * jit-playback.h (gcc::jit::playback::type::get_aligned): New
852         method.
853         * jit-recording.c: Within namespace gcc::jit::recording...
854         (type::get_aligned): New method.
855         (memento_of_get_aligned::replay_into): New method.
856         (memento_of_get_aligned::make_debug_string): New method.
857         (memento_of_get_aligned::write_reproducer): New method.
858         * jit-recording.h: Within namespace gcc::jit::recording...
859         (type::get_aligned): New method.
860         (type::accepts_writes_from): Strip off qualifications from
861         this when comparing pointer equality.
862         (decorated_type): New subclass of type, subsuming the
863         commonality between memento_of_get_const and
864         memento_of_get_volatile.
865         (memento_of_get_const): Make a subclass of decorated_type,
866         rather than type.
867         (memento_of_get_volatile): Likewise.
868         (memento_of_get_aligned): Likewise.
869         * libgccjit++.h: Within namespace gccjit...
870         (type::get_const): New method.
871         (type::get_aligned): New method.
872         * libgccjit.c (gcc_jit_type_get_aligned): New function.
873         * libgccjit.h (gcc_jit_type_get_aligned): New decl.
874         * libgccjit.map (LIBGCCJIT_ABI_7): New
875         (gcc_jit_type_get_aligned): Add.
877 2017-01-19  David Malcolm  <dmalcolm@redhat.com>
879         * dummy-frontend.c (jit_langhook_type_for_size): Delete.
880         (LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine.
882 2017-01-18  David Malcolm  <dmalcolm@redhat.com>
884         * dummy-frontend.c (jit_langhook_type_for_size): Implement, using
885         lto's lto_type_for_size.
887 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
889         Update copyright years.
891 2016-05-20  David Malcolm  <dmalcolm@redhat.com>
893         * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_6.
894         * docs/topics/expressions.rst (Function calls): Add documentation
895         of gcc_jit_rvalue_set_bool_require_tail_call.
896         * docs/_build/texinfo/libgccjit.texi: Regenerate.
897         * jit-common.h (gcc::jit::recording::base_call): Add forward decl.
898         * jit-playback.c: Within namespace gcc::jit::playback...
899         (context::build_call) Add "require_tail_call" param and use it
900         to set CALL_EXPR_MUST_TAIL_CALL.
901         (context::new_call): Add "require_tail_call" param.
902         (context::new_call_through_ptr): Likewise.
903         * jit-playback.h: Within namespace gcc::jit::playback...
904         (context::new_call: Add "require_tail_call" param.
905         (context::new_call_through_ptr): Likewise.
906         (context::build_call): Likewise.
907         * jit-recording.c: Within namespace gcc::jit::recording...
908         (base_call::base_call): New constructor.
909         (base_call::write_reproducer_tail_call): New method.
910         (call::call): Update for inheritance from base_call.
911         (call::replay_into): Provide m_require_tail_call to call
912         to new_call.
913         (call::write_reproducer): Call write_reproducer_tail_call.
914         (call_through_ptr::call_through_ptr): Update for inheritance from
915         base_call.
916         (call_through_ptr::replay_into): Provide m_require_tail_call to call
917         to new_call_through_ptr.
918         (recording::call_through_ptr::write_reproducer): Call
919         write_reproducer_tail_call.
920         * jit-recording.h: Within namespace gcc::jit::recording...
921         (rvalue::dyn_cast_base_call): New virtual function.
922         (class base_call): New subclass of class rvalue.
923         (class call): Inherit from base_call rather than directly from
924         rvalue, moving get_precedence and m_args to base_call.
925         (class call_through_ptr): Likewise.
926         * libgccjit.c (gcc_jit_rvalue_set_bool_require_tail_call): New
927         function.
928         * libgccjit.h
929         (LIBGCCJIT_HAVE_gcc_jit_rvalue_set_bool_require_tail_call): New
930         macro.
931         (gcc_jit_rvalue_set_bool_require_tail_call): New function.
932         * libgccjit.map (LIBGCCJIT_ABI_6): New.
933         (gcc_jit_rvalue_set_bool_require_tail_call): Add.
935 2016-05-17  David Malcolm  <dmalcolm@redhat.com>
937         * dummy-frontend.c: Include diagnostic.h.
938         (jit_begin_diagnostic): New function.
939         (jit_end_diagnostic): New function.
940         (jit_langhook_init): Register jit_begin_diagnostic
941         and jit_end_diagnostic with the global_dc.
942         * jit-playback.c: Include diagnostic.h.
943         (gcc::jit::playback::context::add_diagnostic): New method.
944         * jit-playback.h (struct diagnostic_context): Add forward
945         declaration.
946         (gcc::jit::playback::context::add_diagnostic): New method.
948 2016-05-17  David Malcolm  <dmalcolm@redhat.com>
950         * docs/topics/expressions.rst (Function calls): Document
951         gcc_jit_context_new_call_through_ptr.
952         * docs/_build/texinfo/libgccjit.texi: Regenerate.
954 2016-05-13  David Malcolm  <dmalcolm@redhat.com>
956         * jit-playback.h: Within namespace gcc:jit::playback...
957         (compile_to_memory::postprocess): Mark with FINAL OVERRIDE.
958         (compile_to_file::postprocess): Likewise.
959         (function::finalizer): Likewise.
960         (block::finalizer): Likewise.
961         (source_file::finalizer): Likewise.
962         (source_line::finalizer): Likewise.
963         * jit-recording.c (gcc::jit::rvalue_usage_validator):: Likewise.
964         * jit-recording.h: Within namespace gcc::jit::recording...
965         (string::replay_into): Mark with FINAL OVERRIDE.
966         (string::make_debug_string): Likewise.
967         (string::write_reproducer): Likewise.
968         (location::replay_into): Likewise.
969         (location::dyn_cast_location): Likewise.
970         (location::make_debug_string): Likewise.
971         (location::write_reproducer): Likewise.
972         (memento_of_get_type::dereference): Likewise.
973         (memento_of_get_type::accepts_writes_from): Likewise.
974         (memento_of_get_type::is_int): Likewise.
975         (memento_of_get_type::is_float): Likewise.
976         (memento_of_get_type::is_bool): Likewise.
977         (memento_of_get_type::is_pointer): Likewise.
978         (memento_of_get_type::is_array): Likewise.
979         (memento_of_get_type::is_void): Likewise.
980         (memento_of_get_type::replay_into): Likewise.
981         (memento_of_get_type::make_debug_string): Likewise.
982         (memento_of_get_type::write_reproducer): Likewise.
983         (memento_of_get_pointer::dereference): Likewise.
984         (memento_of_get_pointer::accepts_writes_from): Likewise.
985         (memento_of_get_pointer::replay_into): Likewise.
986         (memento_of_get_pointer::is_int): Likewise.
987         (memento_of_get_pointer::is_float): Likewise.
988         (memento_of_get_pointer::is_bool): Likewise.
989         (memento_of_get_pointer::is_pointer): Likewise.
990         (memento_of_get_pointer::is_array): Likewise.
991         (memento_of_get_pointer::make_debug_string): Likewise.
992         (memento_of_get_pointer::write_reproducer): Likewise.
993         (memento_of_get_const::dereference): Likewise.
994         (memento_of_get_const::accepts_writes_from): Likewise.
995         (memento_of_get_const::unqualified): Likewise.
996         (memento_of_get_const::is_int): Likewise.
997         (memento_of_get_const::is_float): Likewise.
998         (memento_of_get_const::is_bool): Likewise.
999         (memento_of_get_const::is_pointer): Likewise.
1000         (memento_of_get_const::is_array): Likewise.
1001         (memento_of_get_const::void replay_into): Likewise;
1002         (memento_of_get_const::make_debug_string): Likewise.
1003         (memento_of_get_const::write_reproducer): Likewise.
1004         (memento_of_get_volatile::dereference): Likewise.
1005         (memento_of_get_volatile::unqualified): Likewise.
1006         (memento_of_get_volatile::is_int): Likewise.
1007         (memento_of_get_volatile::is_float): Likewise.
1008         (memento_of_get_volatile::is_bool): Likewise.
1009         (memento_of_get_volatile::is_pointer): Likewise.
1010         (memento_of_get_volatile::is_array): Likewise.
1011         (memento_of_get_volatile::replay_into): Likewise;
1012         (memento_of_get_volatile::make_debug_string): Likewise.
1013         (memento_of_get_volatile::write_reproducer): Likewise.
1014         (array_type::dereference): Likewise.
1015         (array_type::is_int): Likewise.
1016         (array_type::is_float): Likewise.
1017         (array_type::is_bool): Likewise.
1018         (array_type::is_pointer): Likewise.
1019         (array_type::is_array): Likewise.
1020         (array_type::replay_into): Likewise;
1021         (array_type::make_debug_string): Likewise.
1022         (array_type::write_reproducer): Likewise.
1023         (function_type::dereference): Likewise.
1024         (function_type::function_dyn_cast_function_type): Likewise.
1025         (function_type::function_as_a_function_type): Likewise.
1026         (function_type::is_int): Likewise.
1027         (function_type::is_float): Likewise.
1028         (function_type::is_bool): Likewise.
1029         (function_type::is_pointer): Likewise.
1030         (function_type::is_array): Likewise.
1031         (function_type::replay_into): Likewise;
1032         (function_type::make_debug_string): Likewise.
1033         (function_type::write_reproducer): Likewise.
1034         (field::replay_into): Likewise;
1035         (field::write_to_dump): Likewise.
1036         (field::make_debug_string): Likewise.
1037         (field::write_reproducer): Likewise.
1038         (compound_type::dereference): Likewise.
1039         (compound_type::is_int): Likewise.
1040         (compound_type::is_float): Likewise.
1041         (compound_type::is_bool): Likewise.
1042         (compound_type::is_pointer): Likewise.
1043         (compound_type::is_array): Likewise.
1044         (compound_type::has_known_size): Likewise.
1045         (struct_::dyn_cast_struct): Likewise.
1046         (struct_::replay_into): Likewise.
1047         (struct_::access_as_type): Likewise.
1048         (struct_::make_debug_string): Likewise.
1049         (struct_::write_reproducer): Likewise.
1050         (fields::replay_into): Likewise.
1051         (fields::write_to_dump): Likewise.
1052         (fields::make_debug_string): Likewise.
1053         (fields::write_reproducer): Likewise.
1054         (union_::replay_into): Likewise.
1055         (union_::make_debug_string): Likewise.
1056         (union_::write_reproducer): Likewise.
1057         (lvalue::access_as_rvalue): Mark with OVERRIDE.
1058         (param::replay_into): Mark with FINAL OVERRIDE.
1059         (param::visit_children): Likewise.
1060         (param::dyn_cast_param): Likewise.
1061         (param::access_as_rvalue): Likewise.
1062         (param::access_as_lvalue): Likewise.
1063         (param::make_debug_string): Likewise.
1064         (param::write_reproducer): Likewise.
1065         (param::get_precedence): Likewise.
1066         (function::replay_into): Likewise.
1067         (function::write_to_dump): Likewise.
1068         (function::make_debug_string): Likewise.
1069         (function::write_reproducer): Likewise.
1070         (block::write_to_dump): Likewise.
1071         (block::make_debug_string): Likewise.
1072         (block::write_reproducer): Likewise.
1073         (block::replay_into): Likewise.
1074         (global::replay_into): Likewise;
1075         (global::visit_children): Likewise.
1076         (global::write_to_dump): Likewise.
1077         (global::make_debug_string): Likewise.
1078         (global::write_reproducer): Likewise.
1079         (global::get_precedence): Likewise.
1080         (memento_of_new_rvalue_from_const::replay_into): Likewise.
1081         (memento_of_new_rvalue_from_const::visit_children): Likewise.
1082         (memento_of_new_rvalue_from_const::is_constant): Likewise.
1083         (memento_of_new_rvalue_from_const::get_wide_int): Likewise.
1084         (memento_of_new_rvalue_from_const::make_debug_string): Likewise.
1085         (memento_of_new_rvalue_from_const::write_reproducer): Likewise.
1086         (memento_of_new_rvalue_from_const::get_precedence): Likewise.
1087         (memento_of_new_string_literal::replay_into): Likewise.
1088         (memento_of_new_string_literal::visit_children): Likewise.
1089         (memento_of_new_string_literal::make_debug_string): Likewise.
1090         (memento_of_new_string_literal::write_reproducer): Likewise.
1091         (memento_of_new_string_literal::get_precedence): Likewise.
1092         (unary_op::replay_into): Likewise.
1093         (unary_op::visit_children): Likewise.
1094         (unary_op::make_debug_string): Likewise.
1095         (unary_op::write_reproducer): Likewise.
1096         (unary_op::get_precedence): Likewise.
1097         (binary_op::replay_into): Likewise.
1098         (binary_op::visit_children): Likewise.
1099         (binary_op::make_debug_string): Likewise.
1100         (binary_op::write_reproducer): Likewise.
1101         (binary_op::get_precedence): Likewise.
1102         (comparison::replay_into): Likewise.
1103         (comparison::visit_children): Likewise.
1104         (comparison::make_debug_string): Likewise.
1105         (comparison::write_reproducer): Likewise.
1106         (comparison::get_precedence): Likewise.
1107         (cast::replay_into): Likewise.
1108         (cast::visit_children): Likewise.
1109         (cast::make_debug_string): Likewise.
1110         (cast::write_reproducer): Likewise.
1111         (cast::get_precedence): Likewise.
1112         (call::replay_into): Likewise.
1113         (call::visit_children): Likewise.
1114         (call::make_debug_string): Likewise.
1115         (call::write_reproducer): Likewise.
1116         (call::get_precedence): Likewise.
1117         (call_through_ptr::replay_into): Likewise.
1118         (call_through_ptr::visit_children): Likewise.
1119         (call_through_ptr::make_debug_string): Likewise.
1120         (call_through_ptr::write_reproducer): Likewise.
1121         (call_through_ptr::get_precedence): Likewise.
1122         (array_access::replay_into): Likewise.
1123         (array_access::visit_children): Likewise.
1124         (array_access::make_debug_string): Likewise.
1125         (array_access::write_reproducer): Likewise.
1126         (array_access::get_precedence): Likewise.
1127         (access_field_of_lvalue::replay_into): Likewise.
1128         (access_field_of_lvalue::visit_children): Likewise.
1129         (access_field_of_lvalue::make_debug_string): Likewise.
1130         (access_field_of_lvalue::write_reproducer): Likewise.
1131         (access_field_of_lvalue::get_precedence): Likewise.
1132         (access_field_rvalue::replay_into): Likewise.
1133         (access_field_rvalue::visit_children): Likewise.
1134         (access_field_rvalue::make_debug_string): Likewise.
1135         (access_field_rvalue::write_reproducer): Likewise.
1136         (access_field_rvalue::get_precedence): Likewise.
1137         (dereference_field_rvalue::replay_into): Likewise.
1138         (dereference_field_rvalue::visit_children): Likewise.
1139         (dereference_field_rvalue::make_debug_string): Likewise.
1140         (dereference_field_rvalue::write_reproducer): Likewise.
1141         (dereference_field_rvalue::get_precedence): Likewise.
1142         (dereference_rvalue::replay_into): Likewise.
1143         (dereference_rvalue::visit_children): Likewise.
1144         (dereference_rvalue::make_debug_string): Likewise.
1145         (dereference_rvalue::write_reproducer): Likewise.
1146         (dereference_rvalue::get_precedence): Likewise.
1147         (get_address_of_lvalue::replay_into): Likewise.
1148         (get_address_of_lvalue::visit_children): Likewise.
1149         (get_address_of_lvalue::make_debug_string): Likewise.
1150         (get_address_of_lvalue::write_reproducer): Likewise.
1151         (get_address_of_lvalue::get_precedence): Likewise.
1152         (local::replay_into): Likewise.
1153         (local::visit_children): Likewise.
1154         (local::write_to_dump): Likewise.
1155         (local::make_debug_string): Likewise.
1156         (local::write_reproducer): Likewise.
1157         (local::get_precedence): Likewise.
1158         (statement::write_to_dump): Likewise.
1159         (eval::replay_into): Likewise.
1160         (eval::make_debug_string): Likewise.
1161         (eval::write_reproducer): Likewise.
1162         (assignment::replay_into): Likewise.
1163         (assignment::make_debug_string): Likewise.
1164         (assignment::write_reproducer): Likewise.
1165         (assignment_op::replay_into): Likewise.
1166         (assignment_op::make_debug_string): Likewise.
1167         (assignment_op::write_reproducer): Likewise.
1168         (comment::replay_into): Likewise.
1169         (comment::make_debug_string): Likewise.
1170         (comment::write_reproducer): Likewise.
1171         (conditional::replay_into): Likewise.
1172         (conditional::get_successor_blocks): Likewise.
1173         (conditional::make_debug_string): Likewise.
1174         (conditional::write_reproducer): Likewise.
1175         (jump::replay_into): Likewise.
1176         (jump::get_successor_blocks): Likewise.
1177         (jump::make_debug_string): Likewise.
1178         (jump::write_reproducer): Likewise.
1179         (return_::replay_into): Likewise.
1180         (return_::get_successor_blocks): Likewise.
1181         (return_::make_debug_string): Likewise.
1182         (return_::write_reproducer): Likewise.
1183         (case_::replay_into): Likewise.
1184         (case_::write_reproducer): Likewise.
1185         (case_::make_debug_string): Likewise.
1186         (switch_::replay_into): Likewise.
1187         (switch_::get_successor_blocks): Likewise.
1188         (switch_::make_debug_string): Likewise.
1189         (switch_::write_reproducer): Likewise.
1191 2016-02-08  David Malcolm  <dmalcolm@redhat.com>
1193         * dummy-frontend.c (jit_langhook_init): Remove
1194         second argument to build_common_tree_nodes to
1195         track r233218.
1197 2016-01-23  Iain Buclaw  <ibuclaw@gdcproject.org>
1199         * jit-playback.c: Include pthread.h.
1201 2016-01-19  David Malcolm  <dmalcolm@redhat.com>
1203         PR jit/69144
1204         * jit-playback.c (gcc::jit::playback::compile_to_file::postprocess):
1205         Potentially add the temporary artifact to the tempdir's list of
1206         tempfiles needing additional cleanup.
1207         (gcc::jit::playback::context::extract_any_requested_dumps): Likewise
1208         for the dumpfile.
1209         * jit-tempdir.c (gcc::jit::tempdir::~tempdir): Clean up additional
1210         tempfiles.
1211         * jit-tempdir.h (gcc::jit::tempdir::add_temp_file): New method.
1212         (gcc::jit::tempdir::m_tempfiles): New field.
1213         * docs/cp/intro/tutorial04.rst: Update for changes to toyvm.cc.
1214         * docs/examples/tut04-toyvm/toyvm.cc (class compilation_result):
1215         New.
1216         (toyvm_function::compile): Change return type from function ptr
1217         to a compilation_result.
1218         (toyvm_function::get_function_name): New accessor.
1219         (toyvm_function::m_funcname): New field.
1220         (get_function_name): Convert to...
1221         (toyvm_function::make_function_name): ...this new method.
1222         (toyvm_function::parse): Call make_function_name.
1223         (toyvm_function::compile): Convert return type from function ptr
1224         to a compilation_result.  Use get_function_name.
1225         (compilation_state::compile): Convert return type from
1226         gcc_jit_result * to a compilation_result.
1227         (test_script): Update for above changes, extracting the code from
1228         the compilation_result.
1229         (main): Likewise.
1230         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1232 2016-01-04  Jakub Jelinek  <jakub@redhat.com>
1234         Update copyright years.
1236 2015-11-11  Andrew MacLeod  <amacleod@redhat.com>
1238         * dummy-frontend.c: Remove unused header files.
1239         * jit-builtins.c: Likewise.
1240         * jit-playback.c: Likewise.
1241         * jit-recording.c: Likewise.
1242         * jit-spec.c: Likewise.
1243         * libgccjit.c: Likewise.
1245 2015-11-07  Richard Sandiford  <richard.sandiford@arm.com>
1247         * jit-builtins.c: Don't undef DEF_BUILTIN.
1249 2015-10-29  Andrew MacLeod  <amacleod@redhat.com>
1251         * dummy-frontend.c: Reorder #include's and remove duplicates.
1252         * jit-builtins.c: Likewise.
1253         * jit-playback.c: Likewise.
1254         * jit-recording.c: Likewise.
1255         * libgccjit.c: Likewise.
1257 2015-10-13  Jakub Jelinek  <jakub@redhat.com>
1259         * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
1260         DEF_FUNCTION_TYPE_11): Define.
1261         * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
1262         DEF_FUNCTION_TYPE_11): Define.
1264 2015-09-30  Thomas Schwinge  <thomas@codesourcery.com>
1265             Ulrich Drepper  <drepper@gmail.com>
1267         * jit-builtins.h: Undefine DEF_FUNCTION_TYPE_VAR_6 after use.
1269 2015-09-30  Matthias Klose  <doko@ubuntu.com>
1271         * jit-builtins.h Define DEF_FUNCTION_TYPE_VAR_6,
1272         remove DEF_FUNCTION_TYPE_VAR_11.
1273         * jit-builtins.c (builtins_manager::make_type): Define and handle
1274         DEF_FUNCTION_TYPE_VAR_6, remove DEF_FUNCTION_TYPE_VAR_11.
1276 2015-08-25  David Malcolm  <dmalcolm@redhat.com>
1278         * docs/cp/topics/contexts.rst
1279         (gccjit::context::set_bool_use_external_driver): New.
1280         * docs/internals/test-hello-world.exe.log.txt: Update.
1281         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_5): New.
1282         * docs/topics/contexts.rst
1283         (gcc_jit_context_set_bool_use_external_driver): New.
1284         * jit-common.h (enum inner_bool_option): Add
1285         INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
1286         * jit-playback.c (gcc_driver_name): New global.
1287         (gcc:jit::playback::context::invoke_driver): Split out second
1288         half into...
1289         (gcc::jit::playback::context::invoke_embedded_driver): ...this new
1290         function, and...
1291         (gcc::jit::playback::context::invoke_external_driver): ...this new
1292         function.
1293         * jit-playback.h
1294         (gcc::jit::playback::context::get_inner_bool_option): New.
1295         (gcc::jit::playback::context::invoke_embedded_driver): New.
1296         (gcc::jit::playback::context::invoke_external_driver): New.
1297         * jit-recording.c (inner_bool_option_reproducer_strings):
1298         Add entry for INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
1299         * libgccjit++.h
1300         (gccjit::context::set_bool_use_external_driver): New.
1301         * libgccjit.c (gcc_jit_context_set_bool_use_external_driver): New.
1302         * libgccjit.h (gcc_jit_context_set_bool_use_external_driver): New.
1303         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_use_external_driver):
1304         New.
1305         * libgccjit.map (LIBGCCJIT_ABI_5): New.
1306         * notes.txt: Show invocation of embedded copy of driver.
1307         * docs/internals/test-hello-world.exe.log.txt: Update
1309 2015-08-13  David Malcolm  <dmalcolm@redhat.com>
1311         * jit-playback.c (invoke_driver): On OS X, add
1312         "-Wl,-undefined,dynamic_lookup" to the driver arguments.
1314 2015-08-03  David Malcolm  <dmalcolm@redhat.com>
1316         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_4): New.
1317         * docs/topics/contexts.rst (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY):
1318         We no longer show a profile.
1319         * docs/topics/index.rst (Topic Reference): Add performance.rst.
1320         * docs/topics/performance.rst: New file.
1321         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1322         * jit-playback.c (gcc::jit::playback::context::compile): Add timer
1323         param when constructing the "toplev" instance.
1324         (gcc::jit::playback::context::acquire_mutex): Add timer param when
1325         constructing auto_timevar instance.
1326         (gcc::jit::playback::context::make_fake_args): If we have a timer,
1327         add "-ftime-report".
1328         (gcc::jit::playback::context::invoke_driver): Add timer param when
1329         constructing auto_timevar instance.
1330         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1331         * jit-playback.h (gcc::jit::playback::context::get_timer): New accessor.
1332         * jit-recording.c: Include timevar.h.
1333         (gcc::jit::recording::context::context): Initialize field "m_timer".
1334         * jit-recording.h: Add forward declaration of class timer.
1335         (gcc::jit::recording::context::set_timer): New method.
1336         (gcc::jit::recording::context::get_timer): New method.
1337         (gcc::jit::recording::context::m_timer): New field.
1338         * libgccjit++.h (gccjit::timer): New class.
1339         (gccjit::auto_time): New class.
1340         (gccjit::context::set_timer): New method.
1341         (gccjit::context::get_timer): New.
1342         (gccjit::timer::timer): New.
1343         (gccjit::timer::push): New.
1344         (gccjit::timer::pop): New.
1345         (timer::print): New.
1346         (timer::get_inner_timer): New.
1347         (timer::release): New.
1348         (auto_time::auto_time): New.
1349         (auto_time::~auto_time): New.
1350         * libgccjit.c: Include timevar.h.
1351         (struct gcc_jit_timer): New.
1352         (gcc_jit_timer_new): New function.
1353         (gcc_jit_timer_release): New function.
1354         (gcc_jit_context_set_timer): New function.
1355         (gcc_jit_context_get_timer): New function.
1356         (gcc_jit_timer_push): New function.
1357         (gcc_jit_timer_pop): New function.
1358         (gcc_jit_timer_print): New function.
1359         * libgccjit.h (LIBGCCJIT_HAVE_TIMING_API): New macro.
1360         (gcc_jit_timer): New typedef.
1361         (gcc_jit_timer_new): New function.
1362         (gcc_jit_timer_release): New function.
1363         (gcc_jit_context_set_timer): New function.
1364         (gcc_jit_context_get_timer): New function.
1365         (gcc_jit_timer_push): New function.
1366         (gcc_jit_timer_pop): New function.
1367         (gcc_jit_timer_print): New function.
1368         * libgccjit.map (LIBGCCJIT_ABI_4): New.
1369         (gcc_jit_timer_new): New function.
1370         (gcc_jit_timer_release): New function.
1371         (gcc_jit_context_set_timer): New function.
1372         (gcc_jit_context_get_timer): New function.
1373         (gcc_jit_timer_push): New function.
1374         (gcc_jit_timer_pop): New function.
1375         (gcc_jit_timer_print): New function.
1377 2015-07-23  David Malcolm  <dmalcolm@redhat.com>
1379         * jit-playback.c (invoke_driver): Convert local "argvec"
1380         to an auto_argvec, so that it owns copies of the strings,
1381         rather than borrows them, updating ADD_ARG to use xstrdup
1382         and special-casing the NULL terminator to avoid
1383         xstrdup (NULL).  Call add_multilib_driver_arguments at the front
1384         of the arguments.
1385         (MULTILIB_DEFAULTS): Provide a default definition.
1386         (multilib_defaults_raw): New constant array.
1387         (gcc::jit::playback::context::add_multilib_driver_arguments): New
1388         method.
1389         * jit-playback.h
1390         (gcc::jit::playback::context::add_multilib_driver_arguments): New
1391         method.
1392         * docs/internals/test-hello-world.exe.log.txt: Update.
1393         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1395 2015-07-16  David Malcolm  <dmalcolm@redhat.com>
1397         * docs/internals/index.rst (Overview of code structure): Add note
1398         that the implementation is in C++, despite the .c extension.
1399         (Submitting patches): New subsection.
1400         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1402 2015-07-09  Andrew MacLeod  <amacleod@redhat.com>
1404         * dummy-frontend.c: Adjust includes for flags.h changes.
1405         * jit-common.h: Likewise.
1406         * jit-playback.c: Likewise.
1408 2015-07-08  David Malcolm  <dmalcolm@redhat.com>
1410         PR jit/66783
1411         * libgccjit.c (gcc_jit_context_new_field): Show name of field in
1412         "unknown size" error message.
1413         (gcc_jit_struct_set_fields): Show name of struct in error message.
1414         (gcc_jit_context_new_global): Show name of global in
1415         "unknown size" error message.
1416         (gcc_jit_function_new_local): Likewise for local.
1418 2015-07-07  Andrew MacLeod  <amacleod@redhat.com>
1420         * dummy-frontend.c: Adjust includes.
1421         * jit-common.h: Likewise.
1422         * jit-playback.c: Likewise.
1424 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
1426         PR jit/66783
1427         * jit-recording.h: Within namespace gcc:jit::recording...
1428         (type::has_known_size): New virtual function.
1429         (struct_has_known_size): New function.
1430         * libgccjit.c (gcc_jit_context_new_field): Verify that the type
1431         has a known size.
1432         (gcc_jit_context_new_global): Likewise.
1433         (gcc_jit_function_new_local): Likewise.
1435 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
1437         PR jit/66779
1438         * dummy-frontend.c (jit_langhook_type_for_mode): Ensure that we
1439         handle modes QI, HI, SI, DI, TI.
1441 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
1443         PR jit/66700
1444         * jit-playback.c (jit_mark_addressable): New function.
1445         (gcc::jit::playback::lvalue::get_address): Call
1446         jit_mark_addressable on the underlying tree.
1448 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
1450         * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
1451         documentation.
1452         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1454 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
1456         * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
1457         Clarify lack of lifetime requirements on (const char *) parameter.
1458         * docs/topics/expressions.rst
1459         (gcc_jit_context_new_string_literal): Likewise.
1460         (gcc_jit_context_new_global): Likewise.
1461         * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
1462         (gcc_jit_context_new_function): Likewise.
1463         (gcc_jit_function_new_block): Likewise.
1464         (gcc_jit_block_add_comment): Likewise.
1465         * docs/topics/locations.rst (gcc_jit_context_new_location):
1466         Likewise.
1467         * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
1468         (gcc_jit_context_new_struct_type): Likewise.
1469         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1471 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1473         * docs/cp/topics/functions.rst (Blocks): Add switch statements to
1474         list of ways to terminate a block.
1475         (gccjit::block::end_with_switch): Add function description.
1476         (gccjit::case_): Add class.
1477         (gccjit::context::new_case): Add function description.
1478         * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
1479         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
1480         * docs/topics/functions.rst (Blocks): Add switch statements to
1481         list of ways to terminate a block.
1482         (gcc_jit_block_end_with_switch): Add function description.
1483         (gcc_jit_case): Add type.
1484         (gcc_jit_context_new_case): Add function description.
1485         (gcc_jit_case_as_object): Add function description.
1486         * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
1487         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1488         * jit-common.h (gcc::jit::recording::case_): Add forward decl.
1489         (gcc::jit::playback::case_): Add forward decl.
1490         * jit-playback.c (add_case): New function.
1491         (gcc::jit::playback::block::add_switch): New function.
1492         * jit-playback.h (gcc::jit::playback::case_): New struct.
1493         (gcc::jit::playback::block::get_function): New method.
1494         (gcc::jit::playback::block::add_switch): New method.
1495         * jit-recording.c: Within namespace gcc::jit...
1496         (recording::context::new_case): New method.
1497         (recording::function::validate): Update for change to
1498         get_successor_blocks.
1499         (recording::block::end_with_switch): New method.
1500         (recording::block::get_successor_blocks): Update to support an
1501         arbitrary number of successor blocks.
1502         (recording::block::dump_edges_to_dot): Likewise.
1503         (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
1504         (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
1505         (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
1506         (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
1507         (recording::statement::get_successor_blocks): Update to support an
1508         arbitrary number of successor blocks.
1509         (recording::conditional::get_successor_blocks): Likewise.
1510         (recording::jump::get_successor_blocks): Likewise.
1511         (recording::return_::get_successor_blocks): Likewise.
1512         (recording::case_::write_reproducer): New.
1513         (recording::case_::make_debug_string): New.
1514         (recording::switch_::switch_): New.
1515         (recording::switch_::replay_into): New.
1516         (recording::switch_::get_successor_blocks): New.
1517         (recording::switch_::make_debug_string): New.
1518         (recording::switch_::write_reproducer): New.
1519         * jit-recording.h: Within namespace gcc::jit::recording...
1520         (context::new_case): New.
1521         (rvalue::is_constant): New.
1522         (rvalue::get_wide_int): New.
1523         (block::end_with_switch): New.
1524         (block::get_successor_blocks): Update to support an arbitrary
1525         number of successor blocks.
1526         (memento_of_new_rvalue_from_const::is_constant): New.
1527         (memento_of_new_rvalue_from_const::get_wide_int): New.
1528         (statement::get_successor_blocks): Update to support an arbitrary
1529         number of successor blocks.
1530         (conditional::get_successor_blocks): Likewise.
1531         (jump::get_successor_blocks): Likewise.
1532         (return_::get_successor_blocks): Likewise.
1533         (case_): New subclass of memento.
1534         (switch_): New subclass of statement.
1535         * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
1536         (gccjit::context::new_case): New method.
1537         (gccjit::block::end_with_switch): New method.
1538         (gccjit::case_::case): New ctors.
1539         (gccjit::case_::get_inner_case): New method.
1540         * libgccjit.c: Include "typed-splay-tree.h"
1541         (struct gcc_jit_case): New.
1542         (gcc_jit_context_new_case): New function.
1543         (gcc_jit_case_as_object): New function.
1544         (valid_dest_for_switch): New function.
1545         (valid_case_for_switch): New function.
1546         (class api_call_validator): New class.
1547         (class case_range_validator): New class.
1548         (case_range_validator::case_range_validator): New.
1549         (case_range_validator::validate): New.
1550         (case_range_validator::case_compare): New.
1551         (case_range_validator::get_wide_int): new.
1552         (gcc_jit_block_end_with_switch): New.
1553         * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
1554         (gcc_jit_case): New typedef.
1555         (gcc_jit_context_new_case): New function.
1556         (gcc_jit_case_as_object): New function.
1557         (gcc_jit_block_end_with_switch): New function.
1558         (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
1559         * libgccjit.map: Add gcc_jit_block_end_with_switch,
1560         gcc_jit_case_as_object and gcc_jit_context_new_case.
1562 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1564         PR jit/66546
1565         * docs/cp/topics/contexts.rst
1566         (gccjit::context::set_bool_allow_unreachable_blocks): New.
1567         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
1568         * docs/topics/contexts.rst (Options): Add notes discussing the
1569         transition from enums to entrypoints for new options.
1570         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
1571         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1572         * jit-common.h (gcc::jit::inner_bool_option): New enum.
1573         * jit-recording.c: Within namespace gcc::jit...
1574         (recording::context::context): Handle m_inner_bool_options.
1575         (recording::context::set_inner_bool_option): New.
1576         (inner_bool_option_reproducer_strings): New.
1577         (recording::context::log_all_options): Log the "inner" bool
1578         options.
1579         (recording::context::log_inner_bool_option): New.
1580         (recording::context::dump_reproducer_to_file): Write initializers
1581         for "inner" bool options.
1582         (recording::function::validate): Don't check for block
1583         reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
1584         * jit-recording.h: Within namespace gcc::jit...
1585         (recording::context::set_inner_bool_option): New.
1586         (recording::context::get_inner_bool_option): New.
1587         (recording::context::log_inner_bool_option): New.
1588         (recording::context::m_inner_bool_options): New.
1589         * libgccjit++.h
1590         (gccjit::context::set_bool_allow_unreachable_blocks): New.
1591         * libgccjit.c
1592         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
1593         * libgccjit.h: Add note about options present in the
1594         initial release of libgccjit.
1595         (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
1596         entrypoint.
1597         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
1598         New macro.
1599         * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
1600         (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
1601         entrypoint.
1603 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1605         PR jit/66628
1606         * docs/cp/topics/contexts.rst (Additional command-line options):
1607         New section.
1608         * docs/topics/compatibility.rst: New file.
1609         * docs/topics/contexts.rst (Additional command-line options): New
1610         section.
1611         * docs/topics/index.rst: Add compatibility.rst.
1612         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1613         * jit-playback.c (make_fake_args): Add call to
1614         append_command_line_options.
1615         * jit-recording.c: Within namespace gcc::jit...
1616         (recording::context::~context): Free the optnames within
1617         m_command_line_options.
1618         (recording::context::set_bool_option): Likewise.
1619         (recording::context::add_command_line_option): New method.
1620         (recording::context::append_command_line_options): New method.
1621         (recording::context::dump_reproducer_to_file): Add command-line
1622         options.
1623         * jit-recording.h: Within namespace gcc::jit...
1624         (recording::context::add_command_line_option): New method.
1625         (recording::context::append_command_line_options): New method.
1626         (recording::context::m_command_line_options): New field.
1627         * libgccjit++.h (gccjit::context::add_command_line_option): New
1628         method.
1629         * libgccjit.c (gcc_jit_context_add_command_line_option): New API
1630         entrypoint.
1631         * libgccjit.h (gcc_jit_context_add_command_line_option): New API
1632         entrypoint.
1633         (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
1634         macro.
1635         * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
1636         LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
1638 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1640         * jit-recording.c
1641         (gcc::jit::recording::context::dump_reproducer_to_file):
1642         Add pragma to generated reproducers to disable -Wunused-variable.
1643         Fix handling of NULL string options.
1645 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
1647         * docs/cp/topics/expressions.rst: Remove stray semicolon.
1648         * docs/cp/topics/functions.rst: Remove stray backslash.
1649         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1651 2015-06-25  Andrew MacLeod  <amacleod@redhat.com>
1653         * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
1654         * jit-playback.c: Likewise.
1656 2015-06-25  Andrew Macleod  <amacleod@redhat.com>
1658         * jit-common.h: Don't include alias.h.
1660 2015-06-17  David Malcolm  <dmalcolm@redhat.com>
1662         * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
1663         is for the correct struct.
1664         (gcc_jit_rvalue_access_field): Likewise.
1666 2015-06-17  Andrew MacLeod  <amacleod@redhat.com>
1668         * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
1669         * jit-common.h: Likewise.
1670         * jit-playback.c: Likewise.
1672 2015-06-16  David Malcolm  <dmalcolm@redhat.com>
1674         PR jit/66539
1675         * jit-recording.c: Within namespace gcc::jit::recording::
1676         (rvalue::get_debug_string_parens): New function.
1677         (binary_op::make_debug_string): Update to mimic C precedence
1678         rules.
1679         (binary_op_precedence): New array.
1680         (binary_op::get_precedence): New function.
1681         (comparison::make_debug_string): Update to mimic C precedence
1682         rules.
1683         (comparison_precedence): New array.
1684         (comparison::get_precedence): New function.
1685         (cast::make_debug_string): Update to mimic C precedence rules.
1686         (call::make_debug_string): Likewise.
1687         (call_through_ptr::make_debug_string): Likewise.
1688         (array_access::make_debug_string): Likewise.
1689         (access_field_of_lvalue::make_debug_string): Likewise.
1690         (access_field_rvalue::make_debug_string): Likewise.
1691         (dereference_field_rvalue::make_debug_string): Likewise.
1692         (dereference_rvalue::make_debug_string): Likewise.
1693         (get_address_of_lvalue::make_debug_string): Likewise.
1694         * jit-recording.h: Within namespace gcc::jit::recording::
1695         (precedence): New enum.
1696         (rvalue::rvalue): Initialize field "m_parenthesized_string".
1697         (rvalue::get_debug_string_parens): New method.
1698         (rvalue::get_precedence): New pure virtual function.
1699         (rvalue::m_parenthesized_string): New field.
1700         (param::get_precedence): New function.
1701         (global::get_precedence): New function.
1702         (memento_of_new_rvalue_from_const::get_precedence): New function.
1703         (memento_of_new_string_literal::get_precedence): New function.
1704         (unary_op::get_precedence): New function.
1705         (binary_op::get_precedence): New function.
1706         (comparison::get_precedence): New function.
1707         (cast::get_precedence): New function.
1708         (call::get_precedence): New function.
1709         (call_through_ptr::get_precedence): New function.
1710         (array_access::get_precedence): New function.
1711         (access_field_of_lvalue::get_precedence): New function.
1712         (access_field_rvalue::get_precedence): New function.
1713         (dereference_field_rvalue::get_precedence): New function.
1714         (dereference_rvalue::get_precedence): New function.
1715         (get_address_of_lvalue::get_precedence): New function.
1716         (local::get_precedence): New function.
1718 2015-06-09  Matthias Klose  <doko@ubuntu.com>
1720         * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
1722 2015-06-08  Andrew MacLeod  <amacleod@redhat.com>
1724         * dummy-frontend.c : Adjust include files.
1725         * jit-common.h : Likewise.
1726         * jit-playback.c : Likewise.
1728 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
1730         * dummy-frontend.c
1731         (jit_langhook_post_compilation_parsing_cleanups): Remove.
1732         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
1733         * jit-playback.c (gcc::jit::playback::context::new_global): Add
1734         call to varpool_node::finalize_decl.
1735         (gcc::jit::playback::context::finalize_global_decls): Remove.
1736         * jit-playback.h
1737         (gcc::jit::playback::context::finalize_global_decls): Remove.
1739 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
1741         * dummy-frontend.c (jit_langhook_write_globals): Rename to...
1742         (jit_langhook_post_compilation_parsing_cleanups): ...this, and
1743         eliminate calls to finalize_compilation_unit and
1744         write_global_decls_2.
1745         (LANG_HOOKS_WRITE_GLOBALS): Rename to...
1746         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
1747         redirect from jit_langhook_write_globals to
1748         jit_langhook_post_compilation_parsing_cleanups.
1749         * jit-playback.c
1750         (gcc::jit::playback::context::write_global_decls_1): Rename to...
1751         (gcc::jit::playback::context::finalize_global_decls): ...this.
1752         (gcc::jit::playback::context::write_global_decls_1): Delete.
1753         * jit-playback.h
1754         (gcc::jit::playback::context::write_global_decls_1): Rename to...
1755         (gcc::jit::playback::context::finalize_global_decls): ...this.
1756         (gcc::jit::playback::context::write_global_decls_1): Delete.
1758 2015-06-04  Andrew MacLeod  <amacleod@redhat.com>
1760         * dummy-frontend.c: Adjust includes for restructured coretypes.h.
1761         * jit-common.h: Likewise.
1762         * jit-playback.c: Likewise.
1764 2015-05-12  David Malcolm  <dmalcolm@redhat.com>
1766         * jit-builtins.c: Include vec.h before target.h.
1768 2015-04-27  Jim Wilson  <jim.wilson@linaro.org>
1770         * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
1771         files.
1773 2015-04-09  David Malcolm  <dmalcolm@redhat.com>
1775         PR jit/65691
1776         * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
1777         and paste error in description of gccjit::context::one.
1778         * docs/topics/expressions.rst (Simple expressions): Likewise in
1779         description of gcc_jit_context_one.
1780         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1782 2015-03-13  Uros Bizjak  <ubizjak@gmail.com>
1784         * jit-recording.c (dump::write): Also check vasprintf return value.
1785         (recording::context::add_error_va): Ditto.
1786         (recording::string::from_printf): Ditto.
1788 2015-03-13  David Malcolm  <dmalcolm@redhat.com>
1790         * docs/internals/index.rst (Packaging notes): New section.
1791         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1793 2015-03-05  David Malcolm  <dmalcolm@redhat.com>
1795         * docs/cp/intro/tutorial03.rst: Add missing arguments to
1796         gccjit::block::end_with_conditional call.  Add on_true/on_false
1797         comments.  Tweak the wording.
1798         * docs/intro/tutorial03.rst: Add missing arguments to
1799         gcc_jit_block_end_with_conditional call.  Add some clarifying
1800         comments.
1801         * docs/topics/compilation.rst: Tweak the wording to avoid an
1802         ambiguous use of "this".
1803         * docs/topics/contexts.rst: Fix a typo.
1804         * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
1805         a stray backtick.
1806         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1808 2015-02-24  Thomas Schwinge  <thomas@codesourcery.com>
1810         PR libgomp/64625
1811         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
1812         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
1813         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
1814         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
1815         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
1816         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
1818 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
1820         PR jit/64257
1821         * docs/conf.py (html_theme): Change from 'pyramid'
1822         to 'sphinxdoc'.
1824 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
1826         * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
1827         typo.
1828         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1830 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
1832         * jit-logging.h (gcc::jit::log_user::log): Make const.
1833         * jit-recording.c (gcc::jit::recording::context::set_str_option):
1834         Log the new value of the option.
1835         (gcc::jit::recording::context::set_int_option): Likewise.
1836         (gcc::jit::recording::context::set_bool_option): Likewise.
1837         (gcc::jit::recording::context::compile): Log the value of all
1838         options.
1839         (gcc::jit::recording::context::compile_to_file): Likewise.
1840         (gcc::jit::recording::context::log_all_options): New function.
1841         (gcc::jit::recording::context::log_str_option): New function.
1842         (gcc::jit::recording::context::log_int_option): New function.
1843         (gcc::jit::recording::context::log_bool_option): New function.
1844         * jit-recording.h (gcc::jit::recording::context::log_all_options):
1845         New function.
1846         (gcc::jit::recording::context::log_str_option): New function.
1847         (gcc::jit::recording::context::log_int_option): New function.
1848         (gcc::jit::recording::context::log_bool_option): New function.
1849         * docs/internals/test-hello-world.exe.log.txt: Update for above
1850         changes.
1851         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1853 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
1855         PR jit/64810
1856         * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
1857         (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
1858         * jit-playback.c: Include gcc.h.
1859         (gcc::jit::playback::context::compile): Move mutex acquisition
1860         to before the call to make_fake_args.
1861         (append_arg_from_driver): New function.
1862         (gcc::jit::playback::context::make_fake_args): On the first call,
1863         call into driver_get_configure_time_options to get configure-time
1864         default options and cache them.  Add them to the args for
1865         toplev::main.
1866         * jit-spec.c: New source file.
1867         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
1868         above changes.
1869         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1871 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
1873         PR jit/64810
1874         * dummy-frontend.c (jit_langhook_type_for_mode): Support
1875         TYPE_MODE (long_long_integer_type_node).
1877 2015-01-27  David Malcolm  <dmalcolm@redhat.com>
1879         * docs/internals/test-hello-world.exe.log.txt: Add example version
1880         lines.
1881         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1882         * jit-common.h (gcc::jit::dump::get_file): New accessor.
1883         * jit-logging.c: Include toplev.h.
1884         (gcc::jit::logger::logger): Log the GCC version.
1885         * jit-recording.c: Include toplev.h.
1886         (gcc:jit::recording::context::dump_reproducer_to_file): Log the
1887         GCC version.
1889 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
1891         * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
1892         * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
1893         error buffer is only valid until the next call to the context.
1894         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1895         * libgccjit.h (gcc_jit_context_get_first_error): Reword the
1896         comment to omit mention of compiling.
1897         (gcc_jit_context_get_last_error): The error buffer is only valid
1898         until the next call to the context.
1900 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
1902         PR jit/64708
1903         * config-lang.in (compilers): Drop "libgccjit.so".
1905 2015-01-23  David Malcolm  <dmalcolm@redhat.com>
1907         PR jit/64721
1908         * jit-playback.c (gcc::jit::playback::context::compile): Construct
1909         toplev instances with init_signals=false.
1911 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
1913         * docs/cp/topics/results.rst: Rename to...
1914         * docs/cp/topics/compilation.rst: ...this, and add section on
1915         ahead-of-time compilation.
1916         * docs/cp/topics/index.rst: Update for renaming of results.rst
1917         to compilation.rst.
1918         * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
1919         script.
1920         * docs/examples/tut05-bf.c: New file, implementing a compiler
1921         for "brainf".
1922         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
1923         changes to logger output.
1924         * docs/intro/index.rst: Add tutorial05.rst
1925         * docs/intro/tutorial05.rst: New file.
1926         * docs/topics/results.rst: Rename to...
1927         * docs/topics/compilation.rst: ...this, and add section on
1928         ahead-of-time compilation.
1929         * docs/topics/index.rst: Update for renaming of results.rst to
1930         compilation.rst.
1931         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1932         * jit-playback.c (gcc::jit::playback::context::compile): Convert
1933         return type from result * to void.  Move the code to convert to
1934         dso and dlopen the result to a new pure virtual "postprocess"
1935         method.
1936         (gcc::jit::playback::compile_to_memory::compile_to_memory): New
1937         function.
1938         (gcc::jit::playback::compile_to_memory::postprocess): New
1939         function, based on playback::context::compile.
1940         (gcc::jit::playback::compile_to_file::compile_to_file): New
1941         function.
1942         (gcc::jit::playback::compile_to_file::postprocess): New function.
1943         (gcc::jit::playback::compile_to_file::copy_file): New function.
1944         (gcc::jit::playback::context::convert_to_dso): Move internals
1945         to...
1946         (gcc::jit::playback::context::invoke_driver): New method.  Add
1947         "-shared" and "-c" options to driver's argv as needed.
1948         * jit-playback.h: Include "timevar.h".
1949         (gcc::jit::playback::context::compile): Convert return type from
1950         result * to void.
1951         (gcc::jit::playback::context::postprocess): New pure virtual
1952         function, making this an abstract base class.
1953         (gcc::jit::playback::context::get_tempdir): New accessor.
1954         (gcc::jit::playback::context::invoke_driver): New function.
1955         (class gcc::jit::playback::compile_to_memory): New subclass of
1956         playback::context.
1957         (class gcc::jit::playback::compile_to_file): Likewise.
1958         * jit-recording.c (gcc::jit::recording::context::compile): Use a
1959         playback::compile_to_memory, and extract its result.
1960         (gcc::jit::recording::context::compile_to_file): New function.
1961         * jit-recording.h (gcc::jit::recording::context::compile_to_file):
1962         New function.
1963         * libgccjit++.h (gccjit::context::compile_to_file): New method.
1964         * libgccjit.c (gcc_jit_context_compile): Update log message to
1965         clarify that this is an in-memory compile.
1966         (gcc_jit_context_compile_to_file): New function.
1967         * libgccjit.h (gcc_jit_context): Clarify that you can compile
1968         a context more than once, and that you can compile to a file
1969         as well as to memory.
1970         (gcc_jit_result): Clarify that this is the result of an
1971         in-memory compilation.
1972         (gcc_jit_context_compile): Clarify that you can compile, and that
1973         this is an in-memory compilation.
1974         (enum gcc_jit_output_kind): New enum.
1975         (gcc_jit_context_compile_to_file): New function.
1976         (gcc_jit_context_enable_dump): Clarify comment to cover both forms
1977         of compilation.
1978         * libgccjit.map (gcc_jit_context_compile_to_file): New API
1979         entrypoint.
1980         * notes.txt: Update to show the playback::context::postprocess
1981         virtual function.
1983 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
1985         * jit-recording.c
1986         (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
1987         Add missing format string.
1989 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
1991         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
1992         (check_jit_parallelize): Set this to an arbitrary value (10).
1994 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
1996         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
1997         last argument.
1998         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
1999         undef afterwards.
2000         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
2001         Likewise.
2003 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
2005         Update copyright years in docs/.
2007 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
2009         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
2010         lvalue and the rvalue are of compatible type.
2012 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
2014         * docs/cp/topics/contexts.rst (Debugging): Add
2015         gccjit::context::dump_reproducer_to_file.
2016         * docs/internals/index.rst (Design notes): New section,
2017         discussing input validation and
2018         gcc_jit_context_dump_reproducer_to_file.
2019         * docs/topics/contexts.rst (Debugging): Add
2020         gcc_jit_context_dump_reproducer_to_file.
2021         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2022         * jit-common.h (gcc::jit::dump::get_context): New accessor.
2023         * jit-recording.c: Include "hash-map.h".
2024         Within namespace ::gcc::jit...
2025         (dump::write): Flush each line.
2026         (dump::make_location): Pass false for new param "created_by_user".
2027         (class allocator): New class.
2028         (allocator::~allocator): New function.
2029         (allocator::xstrdup_printf): New function.
2030         (allocator::xstrdup_printf_va): New function.
2031         (class reproducer): New subclass of dump.
2032         (reproducer::reproducer): New function.
2033         (reproducer::write_params): New function.
2034         (reproducer::write_args): New function.
2035         (reproducer::make_identifier): New function.
2036         (reproducer::make_tmp_identifier): New function.
2037         (reproducer::get_identifier): New pair of functions.
2038         (reproducer::get_identifier_as_rvalue): New function.
2039         (reproducer::get_identifier_as_lvalue): New function.
2040         (reproducer::get_identifier_as_type): New function.
2041         (reproducer::xstrdup_printf): New function.
2042         (recording::context::context): Initialize m_toplevel_ctxt.
2043         (recording::context::new_location): Add param created_by_user.
2044         (str_option_reproducer_strings): New table of strings.
2045         (int_option_reproducer_strings): Likewise.
2046         (bool_option_reproducer_strings): Likewise.
2047         (get_type_enum_strings): Likewise.
2048         (names_of_function_kinds): Likewise.
2049         (global_kind_reproducer_strings): Likewise.
2050         (unary_op_reproducer_strings): Likewise.
2051         (binary_op_reproducer_strings): Likewise.
2052         (comparison_reproducer_strings): Likewise.
2053         Within namespace ::gcc::jit::recording::...
2054         (context::dump_reproducer_to_file): New function.
2055         (string::write_reproducer): Likewise.
2056         (location::write_reproducer): Likewise.
2057         (type::access_as_type): Likewise.
2058         (memento_of_get_type::write_reproducer): Likewise.
2059         (memento_of_get_pointer::write_reproducer): Likewise.
2060         (memento_of_get_const::write_reproducer): Likewise.
2061         (memento_of_get_volatile::write_reproducer): Likewise.
2062         (array_type::write_reproducer): Likewise.
2063         (function_type::write_reproducer): Likewise.
2064         (function_type::write_deferred_reproducer): Likewise.
2065         (field::write_reproducer): Likewise.
2066         (struct_::access_as_type): Likewise.
2067         (struct_::write_reproducer): Likewise.
2068         (union_::write_reproducer): Likewise.
2069         (fields::write_reproducer): Likewise.
2070         (rvalue::access_as_rvalue): Likewise.
2071         (lvalue::access_as_rvalue): Likewise.
2072         (lvalue::access_as_lvalue): Likewise.
2073         (param::access_as_rvalue): Likewise.
2074         (param::access_as_lvalue): Likewise.
2075         (param::write_reproducer): Likewise.
2076         (function::write_reproducer): Likewise.
2077         (block::write_reproducer): Likewise.
2078         (global::write_reproducer): Likewise.
2079         (memento_of_new_rvalue_from_const <int>::write_reproducer):
2080         Likewise.
2081         (memento_of_new_rvalue_from_const <long>::write_reproducer):
2082         Likewise.
2083         (memento_of_new_rvalue_from_const <double>::write_reproducer):
2084         Likewise.
2085         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
2086         Likewise.
2087         (memento_of_new_string_literal::write_reproducer): Likewise.
2088         (unary_op::write_reproducer): Likewise.
2089         (binary_op::write_reproducer): Likewise.
2090         (comparison::write_reproducer): Likewise.
2091         (cast::write_reproducer): Likewise.
2092         (call::write_reproducer): Likewise.
2093         (call_through_ptr::write_reproducer): Likewise.
2094         (array_access::write_reproducer): Likewise.
2095         (access_field_of_lvalue::write_reproducer): Likewise.
2096         (access_field_rvalue::write_reproducer): Likewise.
2097         (dereference_field_rvalue::write_reproducer): Likewise.
2098         (dereference_rvalue::write_reproducer): Likewise.
2099         (get_address_of_lvalue::write_reproducer): Likewise.
2100         (local::write_reproducer): Likewise.
2101         (eval::write_reproducer): Likewise.
2102         (assignment::write_reproducer): Likewise.
2103         (assignment_op::write_reproducer): Likewise.
2104         (comment::write_reproducer): Likewise.
2105         (conditional::write_reproducer): Likewise.
2106         (jump::write_reproducer): Likewise.
2107         (return_::write_reproducer): Likewise.
2108         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
2109         Within namespace ::gcc::jit::recording::...
2110         (context::new_location): Add "created_by_user" param.
2111         (context::dump_reproducer_to_file): New method.
2112         (context::m_toplevel_ctxt): New field.
2113         (memento::write_reproducer): New pure virtual function.
2114         (memento::dyn_cast_location): New virtual function.
2115         (string::write_reproducer):
2116         (location::location): Add "created_by_user" param.
2117         (location::dyn_cast_location): New function.
2118         (location::created_by_user): New accessor.
2119         (location::write_reproducer): New function.
2120         (location::m_created_by_user): New field.
2121         (type::access_as_type): New virtual function.
2122         (location::write_reproducer): Likewise.
2123         (type::access_as_type): Likewise.
2124         (memento_of_get_type::write_reproducer): Likewise.
2125         (memento_of_get_pointer::write_reproducer): Likewise.
2126         (memento_of_get_const::write_reproducer): Likewise.
2127         (memento_of_get_volatile::write_reproducer): Likewise.
2128         (array_type::write_reproducer): Likewise.
2129         (function_type::write_reproducer): Likewise.
2130         (function_type::write_deferred_reproducer): Likewise.
2131         (field::write_reproducer): Likewise.
2132         (struct_::access_as_type): Likewise.
2133         (struct_::write_reproducer): Likewise.
2134         (union_::write_reproducer): Likewise.
2135         (union_::m_fields): Remove stray unused field.
2136         (fields::length): New accessor.
2137         (fields::get_field): New accessor.
2138         (fields::write_reproducer): New function.
2139         (rvalue::access_as_rvalue): Likewise.
2140         (lvalue::access_as_rvalue): Likewise.
2141         (lvalue::access_as_lvalue): Likewise.
2142         (param::access_as_rvalue): Likewise.
2143         (param::access_as_lvalue): Likewise.
2144         (param::write_reproducer): Likewise.
2145         (function::write_reproducer): Likewise.
2146         (block::write_reproducer): Likewise.
2147         (global::write_reproducer): Likewise.
2148         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
2149         Likewise.
2150         (memento_of_new_string_literal::write_reproducer): Likewise.
2151         (unary_op::write_reproducer): Likewise.
2152         (binary_op::write_reproducer): Likewise.
2153         (comparison::write_reproducer): Likewise.
2154         (cast::write_reproducer): Likewise.
2155         (call::write_reproducer): Likewise.
2156         (call_through_ptr::write_reproducer): Likewise.
2157         (array_access::write_reproducer): Likewise.
2158         (access_field_of_lvalue::write_reproducer): Likewise.
2159         (access_field_rvalue::write_reproducer): Likewise.
2160         (dereference_field_rvalue::write_reproducer): Likewise.
2161         (dereference_rvalue::write_reproducer): Likewise.
2162         (get_address_of_lvalue::write_reproducer): Likewise.
2163         (local::write_reproducer): Likewise.
2164         (eval::write_reproducer): Likewise.
2165         (assignment::write_reproducer): Likewise.
2166         (assignment_op::write_reproducer): Likewise.
2167         (comment::write_reproducer): Likewise.
2168         (conditional::write_reproducer): Likewise.
2169         (jump::write_reproducer): Likewise.
2170         (return_::write_reproducer): Likewise.
2171         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
2172         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
2173         param "created_by_user".
2174         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
2175         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
2176         entrypoint.
2177         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
2178         entrypoint.
2180 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
2182         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
2183         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
2184         ctor.
2185         (gcc::jit::rvalue_usage_validator::visit): New function.
2186         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
2187         function.
2188         (gcc::jit::recording::rvalue::set_scope): New function.
2189         (gcc::jit::recording::function::function): Call set_scope on each
2190         param, issuing errors for any params that already have a function.
2191         (gcc::jit::recording::block::add_eval): Return the new statement;
2192         update the comment given that some error-checking now happens after
2193         this returns.
2194         (gcc::jit::recording::block::add_assignment): Likewise.
2195         (gcc::jit::recording::block::add_assignment_op): Likewise.
2196         (gcc::jit::recording::block::add_comment): Likewise.
2197         (gcc::jit::recording::block::end_with_conditional): Likewise.
2198         (gcc::jit::recording::block::end_with_jump): Likewise.
2199         (gcc::jit::recording::block::end_with_return): Likewise.
2200         (gcc::jit::recording::block::validate): Add a comment.
2201         (gcc::jit::recording::unary_op::visit_children): New function.
2202         (gcc::jit::recording::binary_op::visit_children): New function.
2203         (gcc::jit::recording::comparison::visit_children): New function.
2204         (gcc::jit::recording::cast::visit_children): New function.
2205         (gcc::jit::recording::call::visit_children): New function.
2206         (gcc::jit::recording::call_through_ptr::visit_children): New function.
2207         (gcc::jit::recording::array_access::visit_children): New function.
2208         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
2209         function.
2210         (gcc::jit::recording::access_field_rvalue::visit_children): New
2211         function.
2212         (gcc::jit::recording::dereference_field_rvalue::visit_children):
2213         New function.
2214         (gcc::jit::recording::dereference_rvalue::visit_children): New
2215         function.
2216         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
2217         function.
2218         * jit-recording.h: Within namespace gcc::jit::recording...
2219         (class rvalue_visitor): New.
2220         (rvalue::rvalue): Initialize m_scope.
2221         (rvalue::get_loc): New accessor.
2222         (rvalue::verify_valid_within_stmt): New function.
2223         (rvalue::visit_children): New pure virtual function.
2224         (rvalue::set_scope): New function.
2225         (rvalue::get_scope): New function.
2226         (rvalue::dyn_cast_param): New function.
2227         (rvalue::m_scope): New field.
2228         (param::visit_children): New empty function.
2229         (param::dyn_cast_param): New function.
2230         (function::get_loc): New function.
2231         (block::add_eval): Return the new statement.
2232         (block::add_assignment): Likewise.
2233         (block::add_assignment_op): Likewise.
2234         (block::add_comment): Likewise.
2235         (block::end_with_conditional): Likewise.
2236         (block::end_with_jump): Likewise.
2237         (block::end_with_return): Likewise.
2238         (global::visit_children): New function.
2239         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
2240         New function.
2241         (memento_of_new_string_literal::visit_children): New function.
2242         (unary_op::visit_children): New function.
2243         (binary_op::visit_children): New function.
2244         (comparison::visit_children): New function.
2245         (cast::visit_children): New function.
2246         (call::visit_children): New function.
2247         (call_through_ptr::visit_children): New function.
2248         (array_access::visit_children): New function.
2249         (access_field_of_lvalue::visit_children): New function.
2250         (access_field_rvalue::visit_children): New function.
2251         (dereference_field_rvalue::visit_children): New function.
2252         (dereference_rvalue::visit_children): New function.
2253         (get_address_of_lvalue::visit_children): New function.
2254         (local::local): Call set_scope.
2255         (local::visit_children): New function.
2256         (statement::get_block): Make public.
2257         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
2258         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
2259         (gcc_jit_context_new_function): Verify that each param has
2260         not yet been used for creating another function.
2261         (gcc_jit_block_add_eval): After creating the stmt, verify
2262         that the rvalue expression tree is valid to use within it.
2263         (gcc_jit_block_add_assignment): Likewise for the lvalue and
2264         rvalue expression trees.
2265         (gcc_jit_block_add_assignment_op): Likewise.
2266         (gcc_jit_block_end_with_conditional): Likewise for the boolval
2267         expression tree.
2268         (gcc_jit_block_end_with_return): Likewise for the rvalue
2269         expression tree.
2270         (gcc_jit_block_end_with_void_return): Remove return of "void",
2271         now that block::end_with_return is now non-void.
2273 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
2275         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
2276         Add missing fclose on error-handling path.
2278 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
2280         * docs/cp/topics/expressions.rst (Global variables): Add
2281         enum gcc_jit_global_kind param to gccjit::context::new_global.
2282         * docs/topics/expressions.rst (Global variables): Likewise.
2283         Document the new enum.
2284         * docs/topics/results.rst (Compilation results): Document
2285         globals-handling.
2286         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2287         * dummy-frontend.c (jit_langhook_write_globals): Call into the
2288         playback context's write_global_decls_1 and write_global_decls_2
2289         before and after calling symtab->finalize_compilation_unit ().
2290         * jit-playback.c: Include "debug.h".
2291         (gcc::jit::playback::context::new_global): Add "kind" param and
2292         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
2293         underlying VAR_DECL.  Call varpool_node::get_create on the
2294         VAR_DECL, and add it to m_globals.
2295         (gcc::jit::playback::context::write_global_decls_1): New function.
2296         (gcc::jit::playback::context::write_global_decls_2): New function.
2297         * jit-playback.h (gcc::jit::playback::context::context): Call
2298         create on m_globals.
2299         (gcc::jit::playback::context::new_global): Add "kind" param.
2300         (gcc::jit::playback::context::write_global_decls_1): New function.
2301         (gcc::jit::playback::context::write_global_decls_2): New function.
2302         (gcc::jit::playback::context::m_globals): New field.
2303         * jit-recording.c (gcc::jit::recording::context::context):
2304         Initialize m_globals.
2305         (gcc::jit::recording::context::new_global): Add param "kind".
2306         Add the new global to m_globals.
2307         (gcc::jit::recording::context::dump_to_file): Dump the globals.
2308         (gcc::jit::recording::global::replay_into): Add field m_kind.
2309         (gcc::jit::recording::global::write_to_dump): New override.
2310         * jit-recording.h (gcc::jit::recording::context::new_global): Add
2311         param "kind".
2312         (gcc::jit::recording::context::m_globals): New field.
2313         (gcc::jit::recording::global::global): Add param kind.
2314         (gcc::jit::recording::global::write_to_dump): New override.
2315         (gcc::jit::recording::global::m_kind): New field.
2316         * jit-result.c (gcc::jit::result::get_global): New function.
2317         * jit-result.h (gcc::jit::result::get_global): New function.
2318         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
2319         * libgccjit.c (gcc_jit_context_new_global): Likewise.
2320         (gcc_jit_result_get_global): New API entrypoint.
2321         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
2322         (enum gcc_jit_global_kind): New enum.
2323         (gcc_jit_context_new_global): API change: add "kind" param.
2324         * libgccjit.map (gcc_jit_result_get_global): New symbol.
2326 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
2328         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
2329         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
2330         earlier.
2331         * jit-builtins.c: Remove redundant includes of "opts.h" and
2332         "tree.h".
2333         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
2334         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
2335         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
2336         "statistics.h", "vec.h", "double-int.h", "real.h",
2337         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
2338         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
2339         earlier.
2340         * jit-recording.c: Remove redundant includes of "opts.h" and
2341         "tree.h".
2343 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
2345         * docs/cp/topics/expressions.rst (Simple expressions): Use
2346         ":c:type:" for C types.  Document new overload of
2347         gcc::jit::context::new_rvalue.
2348         * docs/topics/expressions.rst (Simple expressions): Use
2349         ":c:type:" for C types.  Document new entrypoint
2350         gcc_jit_context_new_rvalue_from_long.
2351         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2352         * jit-playback.c: Within namespace gcc::jit::playback...
2353         (context::new_rvalue_from_int): Eliminate in favor of...
2354         (context::new_rvalue_from_const <int>): ...this.
2355         (context::new_rvalue_from_double): Eliminate in favor of...
2356         (context::new_rvalue_from_const <double>): ...this.
2357         (context::new_rvalue_from_const <long>): New.
2358         (context::new_rvalue_from_ptr): Eliminate in favor of...
2359         (context::new_rvalue_from_const <void *>): ...this.
2360         * jit-playback.h: Within namespace gcc::jit::playback...
2361         (context::new_rvalue_from_int): Eliminate in favor of...
2362         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
2363         (context::new_rvalue_from_double): Likewise.
2364         (context::new_rvalue_from_ptr): Likewise.
2365         * jit-recording.c: Within namespace gcc::jit::recording...
2366         (context::new_rvalue_from_int): Eliminate.
2367         (context::new_rvalue_from_double): Likewise.
2368         (context::new_rvalue_from_ptr): Likewise.
2369         (class memento_of_new_rvalue_from_const <int>):
2370         Add explicit specialization.
2371         (class memento_of_new_rvalue_from_const <long>):
2372         Likewise.
2373         (class memento_of_new_rvalue_from_const <double>):
2374         Likewise.
2375         (class memento_of_new_rvalue_from_const <void *>):
2376         Likewise.
2377         (memento_of_new_rvalue_from_int::replay_into):
2378         Generalize into...
2379         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
2380         ...this...
2381         (memento_of_new_rvalue_from_double::replay_into):
2382         ...allowing this...
2383         (memento_of_new_rvalue_from_ptr::replay_into):
2384         ...and this to be deleted.
2385         (memento_of_new_rvalue_from_int::make_debug_string):
2386         Convert to...
2387         (memento_of_new_rvalue_from_const <int>::make_debug_string):
2388         ...this.
2389         (memento_of_new_rvalue_from_double::make_debug_string):
2390         Convert to...
2391         (memento_of_new_rvalue_from_const <double>::make_debug_string):
2392         ...this.
2393         (memento_of_new_rvalue_from_ptr::make_debug_string)
2394         Convert to...
2395         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
2396         ...this.
2397         (memento_of_new_rvalue_from_const <long>::make_debug_string):
2398         New function.
2399         * jit-recording.h: Within namespace gcc::jit::recording...
2400         (context::new_rvalue_from_int): Eliminate.
2401         (context::new_rvalue_from_double): Likewise.
2402         (context::new_rvalue_from_ptr): Likewise, all in favor of...
2403         (context::new_rvalue_from_const <HOST_TYPE>): New family of
2404         methods.
2405         (class memento_of_new_rvalue_from_int): Eliminate.
2406         (class memento_of_new_rvalue_from_double): Likewise.
2407         (class memento_of_new_rvalue_from_ptr): Likewise.
2408         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
2409         of rvalue subclasses.
2410         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
2411         "long".
2412         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
2413         rewriting of recording::context::new_rvalue_from_int to
2414         recording::context::new_rvalue_from_const <int>.
2415         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
2416         (gcc_jit_context_new_rvalue_from_double): Update for
2417         rewriting of recording::context::new_rvalue_from_double to
2418         recording::context::new_rvalue_from_const <double>.
2419         (gcc_jit_context_new_rvalue_from_ptr): Update for
2420         rewriting of recording::context::new_rvalue_from_ptr to
2421         recording::context::new_rvalue_from_const <void *>.
2422         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
2423         entrypoint.
2424         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
2426 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
2428         PR jit/64206
2429         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
2430         shows tempdir creation/cleanup.
2431         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2432         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
2433         to the list of subclasses in the comment.
2434         * jit-playback.c (gcc::jit::playback::context::context): Add a
2435         comment clarifying when the tempdir gets cleaned up.
2436         (gcc::jit::playback::context::compile): Pass the context's logger,
2437         if any, to the tempdir.
2438         (gcc::jit::playback::context::dlopen_built_dso): When creating the
2439         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
2440         over ownership of the tempdir to it.
2441         * jit-result.c: Include "jit-tempdir.h".
2442         (gcc::jit::result::result): Add tempdir param, saving it as
2443         m_tempdir.
2444         (gcc::jit::result::~result): Delete m_tempdir.
2445         * jit-result.h (gcc::jit::result::result): Add tempdir param.
2446         (gcc::jit::result::m_tempdir): New field.
2447         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
2448         add JIT_LOG_SCOPE.
2449         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
2450         and log m_path_template and m_path_tempdir.
2451         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
2452         entry/exit, and log the unlink and rmdir calls.
2453         * jit-tempdir.h: Include "jit-logging.h".
2454         (class gcc::jit::tempdir): Make this be a subclass of log_user.
2455         (gcc::jit::tempdir::tempdir): Add logger param.
2456         * notes.txt: Update to show the two possible places where the
2457         tempdir can be cleaned up.
2459 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
2461         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
2462         comment.
2464 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
2466         * docs/topics/contexts.rst (Error-handling): Document new
2467         entrypoint gcc_jit_context_get_last_error.
2468         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2469         * jit-recording.c (gcc::jit::recording::context::context):
2470         Initialize new fields "m_last_error_str" and
2471         "m_owns_last_error_str".
2472         (gcc::jit::recording::context::~context): Clean up
2473         m_last_error_str, if needed.
2474         (gcc::jit::recording::context::add_error_va): Update
2475         m_last_error_str and m_owns_last_error_str, freeing the old
2476         value if appropriate.
2477         (gcc::jit::recording::context::get_last_error): New function.
2478         * jit-recording.h (gcc::jit::recording::context::get_last_error):
2479         New function.
2480         (gcc::jit::recording::context): New fields m_last_error_str and
2481         m_owns_last_error_str.
2482         * libgccjit.c (gcc_jit_context_get_last_error): New function.
2483         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
2484         * libgccjit.map (gcc_jit_context_get_last_error): New function.
2486 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
2488         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
2489         * docs/internals/index.rst (Overview of code structure): Mention
2490         gcc_jit_context_set_logfile, and embed the example logfile.
2491         * docs/internals/test-hello-world.exe.log.txt: New file: example
2492         of a logfile.
2493         * docs/topics/contexts.rst (Debugging): Add documentation
2494         for gcc_jit_context_set_logfile.
2495         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2496         * dummy-frontend.c: Include "jit-logging.h".
2497         (jit_langhook_init): Assert that there is an active playback
2498         context.  If it has a logger, log entry/exit to this function.
2499         (jit_langhook_write_globals): Likewise.
2500         * jit-common.h (gcc::jit::logger): New forward declaration.
2501         * jit-logging.c: New file.
2502         * jit-logging.h: New file.
2503         * jit-playback.c: Include "jit-logging.h".
2504         (gcc::jit::playback::context::context): Initialize the log_user
2505         base class from the recording context's logger (if any).  Use
2506         JIT_LOG_SCOPE to log entry/exit from the function body.
2507         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
2508         log entry/exit from the function body.
2509         (gcc::jit::playback::build_stmt_list): Likewise.
2510         (gcc::jit::playback::function::postprocess): Likewise.
2511         (gcc::jit::playback::context::compile): Likewise.  Log the
2512         entry/exit to toplev::main and toplev::finalize.  Log the
2513         fake argv passed to toplev::main.
2514         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
2515         log entry/exit from the function body.
2516         (gcc::jit::playback::context::release_mutex): Likewise.
2517         (gcc::jit::playback::context::make_fake_args): Likewise.
2518         (gcc::jit::playback::context::extract_any_requested_dumps):
2519         Likewise.
2520         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
2521         log the arguments that the driver is invoked with.
2522         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
2523         the logger to the result object.
2524         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
2525         log entry/exit from the function body.
2526         (gcc::jit::playback::context::dump_generated_code): Likewise.
2527         (gcc::jit::playback::context::handle_locations): Likewise.
2528         * jit-playback.h (gcc::jit::playback::context): Make this be
2529         a subclass of gcc::jit::log_user.
2530         * jit-recording.c: Include "jit-logging.h".
2531         (gcc::jit::recording::context::context: Initialize the logger to
2532         NULL for root contexts, or to the parent's logger for child
2533         contexts.
2534         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
2535         log entry/exit from the function body.
2536         (gcc::jit::recording::context::replay_into): Likewise.
2537         (gcc::jit::recording::context::disassociate_from_playback):
2538         Likewise.
2539         (gcc::jit::recording::context::compile): Likewise.
2540         (recording::context::add_error_va): Likewise.  Also, log the
2541         error.
2542         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
2543         log entry/exit from the function body.
2544         * jit-recording.h: Include "jit-logging.h".
2545         (gcc::jit::recording::context): Make this be a subclass of
2546         gcc::jit::log_user.
2547         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
2548         (gcc::jit::result::result): Add logger param, recording it.
2549         Use JIT_LOG_SCOPE to log entry/exit from the function body.
2550         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
2551         log entry/exit from the function body.
2552         (gcc::jit::result::get_code): Likewise.
2553         * jit-result.h (gcc::jit::result): Make this be a subclass of
2554         gcc::jit::log_user.
2555         (gcc::jit::result::result): Add logger parameter.
2556         * libgccjit++.h (gccjit::context::set_logfile): New function.
2557         * libgccjit.c: Include "jit-logging.h".
2558         (gcc_jit_context_acquire): Log the context.
2559         (gcc_jit_context_release): Use JIT_LOG_FUNC to
2560         log entry/exit from the function body, and log the context.
2561         (gcc_jit_context_new_child_context): Likewise, logging both
2562         contexts.
2563         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
2564         log entry/exit from the function body.
2565         (gcc_jit_context_get_type): Likewise.
2566         (gcc_jit_context_get_int_type): Likewise.
2567         (gcc_jit_context_new_array_type): Likewise.
2568         (gcc_jit_context_new_field): Likewise.
2569         (gcc_jit_context_new_struct_type): Likewise.
2570         (gcc_jit_context_new_opaque_struct): Likewise.
2571         (gcc_jit_struct_set_fields): Likewise.
2572         (gcc_jit_context_new_union_type): Likewise.
2573         (gcc_jit_context_new_function_ptr_type): Likewise.
2574         (gcc_jit_context_new_param): Likewise.
2575         (gcc_jit_context_new_function): Likewise.
2576         (gcc_jit_context_get_builtin_function): Likewise.
2577         (gcc_jit_function_get_param): Likewise.
2578         (gcc_jit_function_dump_to_dot): Likewise.
2579         (gcc_jit_function_new_block): Likewise.
2580         (gcc_jit_context_new_global): Likewise.
2581         (gcc_jit_context_new_rvalue_from_int): Likewise.
2582         (gcc_jit_context_zero): Likewise.
2583         (gcc_jit_context_one): Likewise.
2584         (gcc_jit_context_new_rvalue_from_double): Likewise.
2585         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
2586         (gcc_jit_context_null): Likewise.
2587         (gcc_jit_context_new_string_literal): Likewise.
2588         (gcc_jit_context_new_unary_op): Likewise.
2589         (gcc_jit_context_new_binary_op): Likewise.
2590         (gcc_jit_context_new_comparison): Likewise.
2591         (gcc_jit_context_new_call): Likewise.
2592         (gcc_jit_context_new_call_through_ptr): Likewise.
2593         (gcc_jit_context_new_cast): Likewise.
2594         (gcc_jit_context_new_array_access): Likewise.
2595         (gcc_jit_lvalue_access_field): Likewise.
2596         (gcc_jit_rvalue_access_field): Likewise.
2597         (gcc_jit_rvalue_dereference_field): Likewise.
2598         (gcc_jit_rvalue_dereference): Likewise.
2599         (gcc_jit_lvalue_get_address): Likewise.
2600         (gcc_jit_function_new_local): Likewise.
2601         (gcc_jit_block_add_eval): Likewise.
2602         (gcc_jit_block_add_assignment): Likewise.
2603         (gcc_jit_block_add_assignment_op): Likewise.
2604         (gcc_jit_block_end_with_conditional): Likewise.
2605         (gcc_jit_block_add_comment): Likewise.
2606         (gcc_jit_block_end_with_jump): Likewise.
2607         (gcc_jit_block_end_with_return): Likewise.
2608         (gcc_jit_block_end_with_void_return): Likewise.
2609         (gcc_jit_context_set_str_option): Likewise.
2610         (gcc_jit_context_set_int_option): Likewise.
2611         (gcc_jit_context_set_bool_option): Likewise.
2612         (gcc_jit_context_enable_dump): Likewise.
2613         (gcc_jit_context_compile): Likewise.  Also log the context,
2614         and the result.
2615         (gcc_jit_context_dump_to_file): Likewise.
2616         (gcc_jit_context_set_logfile): New function.
2617         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
2618         log entry/exit from the function body.
2619         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
2620         and the ptr to be returned.
2621         (gcc_jit_result_release): Likewise.  Also log the result.
2622         * libgccjit.h: Include <stdio.h>, since we need FILE *.
2623         (gcc_jit_context_set_logfile): New declaration.
2624         * libgccjit.map (gcc_jit_context_set_logfile): New.
2626 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2628         * jit-recording.h (gcc::jit::recording::type::is_void): New
2629         virtual function.
2630         (gcc::jit::recording::memento_of_get_type::is_void): New
2631         function, overriding default implementation.
2632         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
2633         the underlying type is not "void".
2635 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2637         * docs/topics/expressions.rst (Unary Operations): Add
2638         GCC_JIT_UNARY_OP_ABS.
2639         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
2640         Likewise.
2641         * jit-recording.c (unary_op_strings): Likewise.
2642         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
2643         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
2644         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
2645         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2647 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2649         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
2650         typo in comment.
2652 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2654         * TODO.rst (Test suite): Remove item about running C++ testcases.
2655         * docs/internals/index.rst (Working on the JIT library): Add
2656         "c++" to the enabled languages in the suggested "configure"
2657         invocation, and add a description of why this is necessary.
2658         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2660 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
2662         * docs/internals/index.rst: Update to reflect that built
2663         testcases are now test-foo.c.exe, rather than test-foo.exe.
2664         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2666 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
2668         Update copyright years.
2670 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
2672         * jit-playback.c (gcc::jit::playback::context::build_cast): In
2673         case BOOLEAN_TYPE, don't assume that the source expression is
2674         of type "int".
2676 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
2678         * jit-recording.c (gcc::jit::recording::context::context): When
2679         copying string options from a parent context, take a copy of the
2680         underlying buffers, rather than simply copying the pointer.
2682 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
2684         * jit-recording.c (gcc::jit::recording::context::set_str_option):
2685         Handle NULL.
2687 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
2689         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
2690         Document new function.
2691         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2693 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
2695         Minor interface cleanups of libgccjit
2696         * jit-playback.c (convert_to_dso): Use auto_vec instead
2697         of automatic array to build up command line.
2698         * jit-recording.c (recording::context::set_str_option):
2699         Make copy of the string.
2700         (recording::context::~context): Free string options.
2701         * jit-recording.h (recording::context): Adjust type
2702         of m_str_options member.
2703         * libgccjit.h: Adjust comment about
2704         gcc_jit_context_set_str_option parameter being used after
2705         the call.
2706         Update comment now that all interfaces are copy strings
2707         if necessary.
2708         * libgccjit++.h (gccjit::context): Add set_str_option
2709         member function.
2711 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
2713         * docs/cp/index.rst: New file.
2714         * docs/cp/intro/index.rst: New file.
2715         * docs/cp/intro/tutorial01.rst: New file.
2716         * docs/cp/intro/tutorial02.rst: New file.
2717         * docs/cp/intro/tutorial03.rst: New file.
2718         * docs/cp/intro/tutorial04.rst: New file.
2719         * docs/cp/topics/contexts.rst: New file.
2720         * docs/cp/topics/expressions.rst: New file.
2721         * docs/cp/topics/functions.rst: New file.
2722         * docs/cp/topics/index.rst: New file.
2723         * docs/cp/topics/locations.rst: New file.
2724         * docs/cp/topics/objects.rst: New file.
2725         * docs/cp/topics/results.rst: New file.
2726         * docs/cp/topics/types.rst: New file.
2727         * docs/examples/tut01-hello-world.cc: New file.
2728         * docs/examples/tut02-square.c: Fix missing newline in output.
2729         * docs/examples/tut02-square.cc: New file.
2730         * docs/examples/tut03-sum-of-squares.cc: New file.
2731         * docs/examples/tut04-toyvm/toyvm.cc: New file.
2732         * docs/index.rst: Move summary to above the table of contents.
2733         Add text about the C vs C++ APIs.
2734         * docs/topics/contexts.rst: Fix a typo.
2736         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2737         * docs/_build/texinfo/factorial1.png: New file.
2738         * docs/_build/texinfo/sum-of-squares1.png: New file.
2740 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2742         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
2743         logic for determine "funcname" to new function...
2744         (get_function_name): ...here, adding logic to skip any leading
2745         path from the filename.
2746         (toyvm_function_parse): Use the filename for fn_filename, rather
2747         than "name", so that the debugger can locate the source .toy
2748         file.
2749         (toyvm_function_parse): Don't fclose a NULL FILE *.
2751 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2753         PR jit/63854
2754         * docs/internals/index.rst (Running under valgrind): New
2755         subsection.
2756         (docs/_build/texinfo/libgccjit.texi): Regenerate.
2758 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2760         PR jit/64206
2761         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
2762         * jit-common.h (gcc::jit::tempdir): New forward decl.
2763         * jit-playback.c: Include jit-tempdir.h.
2764         (gcc::jit::playback::context::context): Initialize m_tempdir.
2765         (gcc::jit::playback::context::~context): Move tempdir
2766         cleanup to new file jit-tempdir.c
2767         (make_tempdir_path_template): Move to new file jit-tempdir.c.
2768         (gcc::jit::playback::context::compile): Move tempdir creation
2769         to new tempdir object in new file jit-tempdir.c.
2770         (gcc::jit::playback::context::make_fake_args): Get path from
2771         tempdir object rather than from member data.
2772         (gcc::jit::playback::context::convert_to_dso): Likewise.
2773         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
2774         (gcc::jit::playback::context::dump_generated_code): Likewise.
2775         (gcc::jit::playback::context::get_path_c_file): New function.
2776         (gcc::jit::playback::context::get_path_s_file): New function.
2777         (gcc::jit::playback::context::get_path_so_file): New function.
2778         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
2779         New function.
2780         (gcc::jit::playback::context::get_path_s_file): New function.
2781         (gcc::jit::playback::context::get_path_so_file): New function.
2782         (gcc::jit::playback::context): Move fields "m_path_template",
2783         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
2784         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
2785         * jit-tempdir.c: New file.
2786         * jit-tempdir.h: New file.
2788 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2790         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
2791         mutex here, immediately before using toplev, and release it here, on
2792         each exit path after acquisition.
2793         (jit_mutex): Move this variable here, from jit-recording.c.
2794         (gcc::jit::playback::context::acquire_mutex): New function, based on
2795         code in jit-recording.c.
2796         (gcc::jit::playback::context::release_mutex): Likewise.
2797         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
2798         function.
2799         (gcc::jit::playback::context::release_mutex): New function.
2800         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
2801         (gcc::jit::recording::context::compile): Move mutex-handling from
2802         here into jit-playback.c's gcc::jit::playback::context::compile.
2803         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
2804         and RELEASE_MUTEX.
2806 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2808         * jit-playback.c (gcc::jit::playback::context::compile): Move the
2809         dlopen code into...
2810         (gcc::jit::playback::context::dlopen_built_dso): ...this new
2811         function.
2812         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
2813         New function.
2815 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
2817         PR jit/64166
2818         * docs/topics/contexts.rst (Debugging): Add description of
2819         gcc_jit_context_enable_dump.
2820         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2821         * jit-playback.c: Include context.h.
2822         (class auto_argvec): New class.
2823         (auto_argvec::~auto_argvec): New function.
2824         (gcc::jit::playback::context::compile): Convert fake_args to be
2825         an auto_argvec, so that it can contain dynamically-allocated
2826         strings.   Construct a vec of all requested dumps, and pass it to
2827         make_fake_args.  Extract requested dumps between the calls to
2828         toplev::main and toplev::finalize.
2829         (gcc::jit::playback::context::make_fake_args): Convert param
2830         "argvec" to be a vec <char *>, and gain a "requested_dumps"
2831         param.  Convert to dynamically-allocated arg strings by converting
2832         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
2833         for args that are already a copy.  Add args for all requested dumps.
2834         (gcc::jit::playback::context::extract_any_requested_dumps): New
2835         function.
2836         (gcc::jit::playback::context::read_dump_file): New function.
2837         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
2838         Convert param "argvec" to be a vec <char *>, and gain a
2839         "requested_dumps" param.
2840         (gcc::jit::playback::context::extract_any_requested_dumps): New
2841         function.
2842         (gcc::jit::playback::context::read_dump_file): New function.
2843         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
2844         function.
2845         (gcc::jit::recording::context::get_all_requested_dumps): New
2846         function.
2847         * jit-recording.h (gcc::jit::recording::requested_dump): New
2848         struct.
2849         (gcc::jit::recording::context::enable_dump): New function.
2850         (gcc::jit::recording::context::get_all_requested_dumps): New
2851         function.
2852         (gcc::jit::recording::context::m_requested_dumps): New field.
2853         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
2854         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
2855         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
2857 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
2859         * libgccjit++.h: Indent the forward declarations of the classes to
2860         show the inheritance hierarchy.
2862 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
2864         * notes.txt: Show the beginning and ending of
2865         recording::context::compile vs playback::context::compile.  Show
2866         the creation and unlinking of the tempdir.  Show toplev::finalize.
2867         Move "RELEASE MUTEX" to the correct location.  Show
2868         gcc_jit_result_release, and indicate where the
2869         dlopen/dlsym/dlclose occur.
2871 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2873         * docs/examples/tut02-square.c (main): Release the context
2874         earlier, to show that this is possible.  Update error-handling
2875         to avoid a double-release of the context, and to avoid
2876         releasing a NULL result.
2877         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
2878         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
2879         * docs/topics/results.rst (gcc_jit_result): Mention that this
2880         controls the lifetimes of machine code functions.
2881         (gcc_jit_result_get_code): Spell out the requirements for this
2882         to succeed, and the lifetime of the result.
2883         (gcc_jit_result_release): Mention that this invalidates any code
2884         that was obtained from the result.
2885         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2887 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2889         PR jit/64018
2890         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
2891         Add description of error-handling, taken in part from...
2892         * docs/topics/contexts.rst (Error-handling): Expand, and move some
2893         content to tutorial02.rst.
2894         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2896 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2898         PR jit/64020
2899         * docs/topics/types.rst (Standard types) Add new enum values to
2900         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
2901         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2902         Widen the left-hand column so that
2903         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
2904         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2906         * jit-builtins.c: Include stringpool.h and jit-playback.h.
2907         Move everything out of the gcc::jit::recording namespace into
2908         just gcc::jit.
2909         (struct builtin_data): Add fields "fnclass", "attr", and
2910         "implicit_p".
2911         (DEF_BUILTIN): Update macro so populate the new fields.
2912         (builtins_manager::builtins_manager): Update for move out of
2913         recording namespace.  Initialize the m_attributes array.
2914         (builtins_manager::get_builtin_function): Likewise.
2915         (builtins_manager::get_builtin_function_by_id): New function.
2916         (builtins_manager::make_builtin_function): Update for move out of
2917         recording namespace.  Add fix for PR jit/64020 by detecting
2918         specific builtin ids and having them ensure that builtins for
2919         other ids are created as necessary.
2920         (builtins_manager::get_type): Update for move out of recording
2921         namespace.
2922         (builtins_manager::make_type): Likewise.  Add some missing
2923         #undefs.
2924         (builtins_manager::make_primitive_type): Update for move out of
2925         recording namespace.  Implement the three BT_COMPLEX_ cases and
2926         BT_DOUBLE_PTR.
2927         (builtins_manager::make_fn_type): Update for move out of recording
2928         namespace.
2929         (builtins_manager::make_ptr_type): Likewise.
2930         (builtins_manager::finish_playback): New function.
2931         (builtins_manager::get_class): New function.
2932         (builtins_manager::implicit_p): New function.
2933         (builtins_manager::get_attrs_tree): Two new functions.
2934         (builtins_manager::make_attrs_tree): New function.
2936         * jit-builtins.h: Move everything out of the gcc::jit::recording
2937         namespace into just gcc::jit.
2938         (enum built_in_attribute): New.
2939         (builtins_manager::builtins_manager): Update decl for namespace
2940         change.
2941         (builtins_manager::get_builtin_function): Likewise.
2942         (builtins_manager::get_class): New.
2943         (builtins_manager::implicit_p): New.
2944         (builtins_manager::get_attrs_tree): Two new functions.
2945         (builtins_manager::make_attrs_tree): New function.
2946         (builtins_manager::finish_playback): New.
2947         (builtins_manager::get_builtin_function_by_id): New.
2948         (builtins_manager::make_builtin_function): Update decl for
2949         namespace change.
2950         (builtins_manager::get_type): Likewise.
2951         (builtins_manager::make_type): Likewise.
2952         (builtins_manager::make_primitive_type): Likewise.
2953         (builtins_manager::make_fn_type): Likewise.
2954         (builtins_manager::make_ptr_type): Likewise.
2955         (builtins_manager): Likewise for fields.  Add new field
2956         "m_attributes".
2958         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
2959         (builtins_manager): Update forward decl to reflect namespace
2960         change.
2962         * jit-playback.c: Include attribs.h and jit-builtins.h.
2963         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
2964         for the new COMPLEX_ types.
2965         (gcc::jit::playback::context::new_function): If creating a
2966         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
2967         and call set_builtin_decl.
2968         (gcc::jit::playback::context::replay): If we have a
2969         builtins_manager, call its finish_playback method when we're done.
2971         * jit-playback.h:
2972         (gcc::jit::playback::context::get_builtins_manager): New function.
2974         * jit-recording.c
2975         (gcc::jit::recording::context::get_builtins_manager): New function.
2976         (gcc::jit::recording::get_builtin_function): Use
2977         get_builtins_manager, in case we're a child context.
2978         (gcc::jit::recording::memento_of_get_type::dereference): Add the
2979         COMPLEX_ types.
2980         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
2981         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
2982         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
2983         (get_type_strings): Likewise.
2985         * jit-recording.h
2986         (gcc::jit::recording::context::get_builtins_manager): New.
2988         * libgccjit.h (enum gcc_jit_types): Add
2989         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
2990         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2992 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2994         * jit-builtins.c
2995         (gcc::jit::recording::builtins_manager::get_builtin_function):
2996         Check for NULL return from make_builtin_function.
2997         (gcc::jit::recording::builtins_manager::make_builtin_function):
2998         Check for NULL return from get_type.
3000 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
3002         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
3003         creation code into...
3004         (gcc::jit::playback::context::convert_to_dso): New function.
3005         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
3006         New function.
3008 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
3010         * jit-playback.c (gcc::jit::playback::context::compile): Use an
3011         auto_vec<const char *> rather than a const char *[20] for the
3012         top-level argv, and move the logic to build it to...
3013         (gcc::jit::playback::context::make_fake_args): New function.
3014         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
3015         New function.
3017 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
3019         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
3020         * jit-playback.c: Include new header jit-result.h.
3021         (gcc::jit::result::result): Move to new file jit-result.c.
3022         (gcc::jit::result::~result): Likewise.
3023         (gcc::jit::playback::result): Likewise.
3024         * jit-recording.h (class gcc::jit::result): Move to new
3025         header jit-result.h.
3026         * jit-result.c: New file, to contain...
3027         (gcc::jit::result::result): Move here from jit-playback.c,
3028         removing erroneous "playback" namespace from comment.
3029         (gcc::jit::result::~result): Likewise.
3030         (gcc::jit::playback::result): Likewise.
3031         * jit-result.h: New file, to contain...
3032         (class gcc::jit::result): Move from jit-recording.h.
3033         * libgccjit.c: Include jit-result.h.
3034         (gcc_jit_result_get_code): Update comment to reflect move
3035         of implementation.
3036         (gcc_jit_result_release): Likewise.
3038 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
3040         PR jit/63854
3041         * docs/examples/tut04-toyvm/toyvm.c
3042         (toyvm_compiled_function): New typedef.
3043         (toyvm_compiled_func) Rename to...
3044         (toyvm_compiled_code) ...this.
3045         (struct toyvm_compiled_function): New struct.
3046         (toyvm_function_compile): Return a toyvm_compiled_function *
3047         rather than a toyvm_compiled_func, so that the caller can fully
3048         clean things up.  Free "funcname".
3049         (test_script): Update for change to toyvm_function_compile.
3050         Clean up the toyvm_compiled_function.
3051         (main): Likewise.
3052         (docs/intro/tutorial04.rst): Update to reflect the above changes,
3053         and to better spell out the lifetime of the compiled code.
3055 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
3057         PR jit/63854
3058         * jit-builtins.c
3059         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
3060         context's new_function_type method, rather than directly creating
3061         a function_type instance.
3062         * jit-recording.c
3063         (gcc::jit::recording::context::new_function_type): New method,
3064         adapted from part of...
3065         (gcc::jit::recording::context::new_function_ptr_type): ...this.
3066         Update to call new_function_type.
3067         * jit-recording.h
3068         (gcc::jit::recording::context::new_function_type): New method.
3070 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
3072         PR jit/63969
3073         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
3075 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
3077         PR jit/63854
3078         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
3079         Convert param from const vec<playback::field *> & to
3080         const auto_vec<playback::field *> *.
3081         (gcc::jit::playback::context::new_function_type): Convert param
3082         "param_types" from vec<type *> * to const auto_vec<type *> *.
3083         (gcc::jit::playback::context::new_function): Convert param
3084         "params" from vec<param *> * to const auto_vec<param *> *.
3085         (gcc::jit::playback::context::build_call): Convert param "args"
3086         from vec<rvalue *> to const auto_vec<rvalue *> *.
3087         (gcc::jit::playback::context::new_call): Likewise.
3088         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
3089         (wrapper_finalizer): New function.
3090         (gcc::jit::playback::wrapper::operator new): Call the finalizer
3091         variant of ggc_internal_cleared_alloc, supplying
3092         wrapper_finalizer.
3093         (gcc::jit::playback::function::finalizer): New.
3094         (gcc::jit::playback::block::finalizer): New.
3095         (gcc::jit::playback::source_file::finalizer): New.
3096         (gcc::jit::playback::source_line::finalizer): New.
3098         * jit-playback.h
3099         (gcc::jit::playback::context::new_function_type): Convert param
3100         "param_types" from vec<type *> * to const auto_vec<type *> *.
3101         (gcc::jit::playback::context::new_function): Convert param
3102         "params" from vec<param *> * to const auto_vec<param *> *.
3103         (gcc::jit::playback::context::new_call): Convert param
3104         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
3105         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
3106         (gcc::jit::playback::context::build_call): Likewise.
3107         (gcc::jit::playback::context): Convert fields "m_functions",
3108         "m_source_files", "m_cached_locations" from vec to auto_vec.
3109         (gcc::jit::playback::wrapper::finalizer): New virtual function.
3110         (gcc::jit::playback::compound_type::set_fields): Convert param fro
3111         const vec<playback::field *> & to
3112         const auto_vec<playback::field *> *.
3113         (gcc::jit::playback::function::finalizer): New.
3114         (gcc::jit::playback::block::finalizer): New.
3115         (gcc::jit::playback::source_file::finalizer): New.
3116         (gcc::jit::playback::source_line::finalizer): New.
3118         * jit-recording.c
3119         (gcc::jit::recording::function_type::replay_into): Convert local
3120         from a vec into an auto_vec.
3121         (gcc::jit::recording::fields::replay_into): Likewise.
3122         (gcc::jit::recording::function::replay_into): Likewise.
3123         (gcc::jit::recording::call::replay_into): Likewise.
3124         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
3126         * jit-recording.h (gcc::jit::recording::context): Convert fields
3127         "m_mementos", "m_compound_types", "m_functions" from vec<> to
3128         auto_vec <>.
3129         (gcc::jit::recording::function_type::get_param_types): Convert
3130         return type from vec<type *> to const vec<type *> &.
3131         (gcc::jit::recording::function_type): Convert field
3132         "m_param_types" from a vec<> to an auto_vec<>.
3133         (gcc::jit::recording::fields): Likewise for field "m_fields".
3134         (gcc::jit::recording::function::get_params): Convert return type
3135         from vec <param *> to const vec<param *> &.
3136         (gcc::jit::recording::function): Convert fields "m_params",
3137         "m_locals", "m_blocks" from vec<> to auto_vec<>.
3138         (gcc::jit::recording::block): Likewise for field "m_statements".
3139         vec<> to auto_vec<>.
3140         (gcc::jit::recording::call): Likewise for field "m_args".
3141         (gcc::jit::recording::call_through_ptr): Likewise.
3143 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
3145         PR jit/63854
3146         * jit-recording.c (recording::function::validate): Convert
3147         "worklist" from vec<> to autovec<> to fix a leak.
3149 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
3151         * ChangeLog.jit: New.
3152         * ChangeLog: New.
3153         * Make-lang.in: New.
3154         * TODO.rst: New.
3155         * config-lang.in: New.
3156         * docs/Makefile: New.
3157         * docs/_build/texinfo/Makefile: New.
3158         * docs/_build/texinfo/factorial.png: New.
3159         * docs/_build/texinfo/libgccjit.texi: New.
3160         * docs/_build/texinfo/sum-of-squares.png: New.
3161         * docs/conf.py: New.
3162         * docs/examples/tut01-hello-world.c: New.
3163         * docs/examples/tut02-square.c: New.
3164         * docs/examples/tut03-sum-of-squares.c: New.
3165         * docs/examples/tut04-toyvm/Makefile: New.
3166         * docs/examples/tut04-toyvm/factorial.toy: New.
3167         * docs/examples/tut04-toyvm/fibonacci.toy: New.
3168         * docs/examples/tut04-toyvm/toyvm.c: New.
3169         * docs/index.rst: New.
3170         * docs/internals/index.rst: New.
3171         * docs/intro/factorial.png: New.
3172         * docs/intro/index.rst: New.
3173         * docs/intro/sum-of-squares.png: New.
3174         * docs/intro/tutorial01.rst: New.
3175         * docs/intro/tutorial02.rst: New.
3176         * docs/intro/tutorial03.rst: New.
3177         * docs/intro/tutorial04.rst: New.
3178         * docs/topics/contexts.rst: New.
3179         * docs/topics/expressions.rst: New.
3180         * docs/topics/functions.rst: New.
3181         * docs/topics/index.rst: New.
3182         * docs/topics/locations.rst: New.
3183         * docs/topics/objects.rst: New.
3184         * docs/topics/results.rst: New.
3185         * docs/topics/types.rst: New.
3186         * dummy-frontend.c: New.
3187         * jit-builtins.c: New.
3188         * jit-builtins.h: New.
3189         * jit-common.h: New.
3190         * jit-playback.c: New.
3191         * jit-playback.h: New.
3192         * jit-recording.c: New.
3193         * jit-recording.h: New.
3194         * libgccjit++.h: New.
3195         * libgccjit.c: New.
3196         * libgccjit.h: New.
3197         * libgccjit.map: New.
3198         * notes.txt: New.
3200 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
3202         * Initial creation
3204 Copyright (C) 2013-2021 Free Software Foundation, Inc.
3206 Copying and distribution of this file, with or without modification,
3207 are permitted in any medium without royalty provided the copyright
3208 notice and this notice are preserved.