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