1 2015-07-01 David Malcolm <dmalcolm@redhat.com>
4 * jit-playback.c (jit_mark_addressable): New function.
5 (gcc::jit::playback::lvalue::get_address): Call
6 jit_mark_addressable on the underlying tree.
8 2015-07-01 David Malcolm <dmalcolm@redhat.com>
10 * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
12 * docs/_build/texinfo/libgccjit.texi: Regenerate.
14 2015-07-01 David Malcolm <dmalcolm@redhat.com>
16 * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
17 Clarify lack of lifetime requirements on (const char *) parameter.
18 * docs/topics/expressions.rst
19 (gcc_jit_context_new_string_literal): Likewise.
20 (gcc_jit_context_new_global): Likewise.
21 * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
22 (gcc_jit_context_new_function): Likewise.
23 (gcc_jit_function_new_block): Likewise.
24 (gcc_jit_block_add_comment): Likewise.
25 * docs/topics/locations.rst (gcc_jit_context_new_location):
27 * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
28 (gcc_jit_context_new_struct_type): Likewise.
29 * docs/_build/texinfo/libgccjit.texi: Regenerate.
31 2015-06-30 David Malcolm <dmalcolm@redhat.com>
33 * docs/cp/topics/functions.rst (Blocks): Add switch statements to
34 list of ways to terminate a block.
35 (gccjit::block::end_with_switch): Add function description.
36 (gccjit::case_): Add class.
37 (gccjit::context::new_case): Add function description.
38 * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
39 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
40 * docs/topics/functions.rst (Blocks): Add switch statements to
41 list of ways to terminate a block.
42 (gcc_jit_block_end_with_switch): Add function description.
43 (gcc_jit_case): Add type.
44 (gcc_jit_context_new_case): Add function description.
45 (gcc_jit_case_as_object): Add function description.
46 * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
47 * docs/_build/texinfo/libgccjit.texi: Regenerate.
48 * jit-common.h (gcc::jit::recording::case_): Add forward decl.
49 (gcc::jit::playback::case_): Add forward decl.
50 * jit-playback.c (add_case): New function.
51 (gcc::jit::playback::block::add_switch): New function.
52 * jit-playback.h (gcc::jit::playback::case_): New struct.
53 (gcc::jit::playback::block::get_function): New method.
54 (gcc::jit::playback::block::add_switch): New method.
55 * jit-recording.c: Within namespace gcc::jit...
56 (recording::context::new_case): New method.
57 (recording::function::validate): Update for change to
59 (recording::block::end_with_switch): New method.
60 (recording::block::get_successor_blocks): Update to support an
61 arbitrary number of successor blocks.
62 (recording::block::dump_edges_to_dot): Likewise.
63 (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
64 (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
65 (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
66 (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
67 (recording::statement::get_successor_blocks): Update to support an
68 arbitrary number of successor blocks.
69 (recording::conditional::get_successor_blocks): Likewise.
70 (recording::jump::get_successor_blocks): Likewise.
71 (recording::return_::get_successor_blocks): Likewise.
72 (recording::case_::write_reproducer): New.
73 (recording::case_::make_debug_string): New.
74 (recording::switch_::switch_): New.
75 (recording::switch_::replay_into): New.
76 (recording::switch_::get_successor_blocks): New.
77 (recording::switch_::make_debug_string): New.
78 (recording::switch_::write_reproducer): New.
79 * jit-recording.h: Within namespace gcc::jit::recording...
80 (context::new_case): New.
81 (rvalue::is_constant): New.
82 (rvalue::get_wide_int): New.
83 (block::end_with_switch): New.
84 (block::get_successor_blocks): Update to support an arbitrary
85 number of successor blocks.
86 (memento_of_new_rvalue_from_const::is_constant): New.
87 (memento_of_new_rvalue_from_const::get_wide_int): New.
88 (statement::get_successor_blocks): Update to support an arbitrary
89 number of successor blocks.
90 (conditional::get_successor_blocks): Likewise.
91 (jump::get_successor_blocks): Likewise.
92 (return_::get_successor_blocks): Likewise.
93 (case_): New subclass of memento.
94 (switch_): New subclass of statement.
95 * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
96 (gccjit::context::new_case): New method.
97 (gccjit::block::end_with_switch): New method.
98 (gccjit::case_::case): New ctors.
99 (gccjit::case_::get_inner_case): New method.
100 * libgccjit.c: Include "typed-splay-tree.h"
101 (struct gcc_jit_case): New.
102 (gcc_jit_context_new_case): New function.
103 (gcc_jit_case_as_object): New function.
104 (valid_dest_for_switch): New function.
105 (valid_case_for_switch): New function.
106 (class api_call_validator): New class.
107 (class case_range_validator): New class.
108 (case_range_validator::case_range_validator): New.
109 (case_range_validator::validate): New.
110 (case_range_validator::case_compare): New.
111 (case_range_validator::get_wide_int): new.
112 (gcc_jit_block_end_with_switch): New.
113 * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
114 (gcc_jit_case): New typedef.
115 (gcc_jit_context_new_case): New function.
116 (gcc_jit_case_as_object): New function.
117 (gcc_jit_block_end_with_switch): New function.
118 (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
119 * libgccjit.map: Add gcc_jit_block_end_with_switch,
120 gcc_jit_case_as_object and gcc_jit_context_new_case.
122 2015-06-30 David Malcolm <dmalcolm@redhat.com>
125 * docs/cp/topics/contexts.rst
126 (gccjit::context::set_bool_allow_unreachable_blocks): New.
127 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
128 * docs/topics/contexts.rst (Options): Add notes discussing the
129 transition from enums to entrypoints for new options.
130 (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
131 * docs/_build/texinfo/libgccjit.texi: Regenerate.
132 * jit-common.h (gcc::jit::inner_bool_option): New enum.
133 * jit-recording.c: Within namespace gcc::jit...
134 (recording::context::context): Handle m_inner_bool_options.
135 (recording::context::set_inner_bool_option): New.
136 (inner_bool_option_reproducer_strings): New.
137 (recording::context::log_all_options): Log the "inner" bool
139 (recording::context::log_inner_bool_option): New.
140 (recording::context::dump_reproducer_to_file): Write initializers
141 for "inner" bool options.
142 (recording::function::validate): Don't check for block
143 reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
144 * jit-recording.h: Within namespace gcc::jit...
145 (recording::context::set_inner_bool_option): New.
146 (recording::context::get_inner_bool_option): New.
147 (recording::context::log_inner_bool_option): New.
148 (recording::context::m_inner_bool_options): New.
150 (gccjit::context::set_bool_allow_unreachable_blocks): New.
152 (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
153 * libgccjit.h: Add note about options present in the
154 initial release of libgccjit.
155 (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
157 (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
159 * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
160 (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
163 2015-06-30 David Malcolm <dmalcolm@redhat.com>
166 * docs/cp/topics/contexts.rst (Additional command-line options):
168 * docs/topics/compatibility.rst: New file.
169 * docs/topics/contexts.rst (Additional command-line options): New
171 * docs/topics/index.rst: Add compatibility.rst.
172 * docs/_build/texinfo/libgccjit.texi: Regenerate.
173 * jit-playback.c (make_fake_args): Add call to
174 append_command_line_options.
175 * jit-recording.c: Within namespace gcc::jit...
176 (recording::context::~context): Free the optnames within
177 m_command_line_options.
178 (recording::context::set_bool_option): Likewise.
179 (recording::context::add_command_line_option): New method.
180 (recording::context::append_command_line_options): New method.
181 (recording::context::dump_reproducer_to_file): Add command-line
183 * jit-recording.h: Within namespace gcc::jit...
184 (recording::context::add_command_line_option): New method.
185 (recording::context::append_command_line_options): New method.
186 (recording::context::m_command_line_options): New field.
187 * libgccjit++.h (gccjit::context::add_command_line_option): New
189 * libgccjit.c (gcc_jit_context_add_command_line_option): New API
191 * libgccjit.h (gcc_jit_context_add_command_line_option): New API
193 (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
195 * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
196 LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
198 2015-06-30 David Malcolm <dmalcolm@redhat.com>
201 (gcc::jit::recording::context::dump_reproducer_to_file):
202 Add pragma to generated reproducers to disable -Wunused-variable.
203 Fix handling of NULL string options.
205 2015-06-30 David Malcolm <dmalcolm@redhat.com>
207 * docs/cp/topics/expressions.rst: Remove stray semicolon.
208 * docs/cp/topics/functions.rst: Remove stray backslash.
209 * docs/_build/texinfo/libgccjit.texi: Regenerate.
211 2015-06-25 Andrew MacLeod <amacleod@redhat.com>
213 * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
214 * jit-playback.c: Likewise.
216 2015-06-25 Andrew Macleod <amacleod@redhat.com>
218 * jit-common.h: Don't include alias.h.
220 2015-06-17 David Malcolm <dmalcolm@redhat.com>
222 * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
223 is for the correct struct.
224 (gcc_jit_rvalue_access_field): Likewise.
226 2015-06-17 Andrew MacLeod <amacleod@redhat.com>
228 * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
229 * jit-common.h: Likewise.
230 * jit-playback.c: Likewise.
232 2015-06-16 David Malcolm <dmalcolm@redhat.com>
235 * jit-recording.c: Within namespace gcc::jit::recording::
236 (rvalue::get_debug_string_parens): New function.
237 (binary_op::make_debug_string): Update to mimic C precedence
239 (binary_op_precedence): New array.
240 (binary_op::get_precedence): New function.
241 (comparison::make_debug_string): Update to mimic C precedence
243 (comparison_precedence): New array.
244 (comparison::get_precedence): New function.
245 (cast::make_debug_string): Update to mimic C precedence rules.
246 (call::make_debug_string): Likewise.
247 (call_through_ptr::make_debug_string): Likewise.
248 (array_access::make_debug_string): Likewise.
249 (access_field_of_lvalue::make_debug_string): Likewise.
250 (access_field_rvalue::make_debug_string): Likewise.
251 (dereference_field_rvalue::make_debug_string): Likewise.
252 (dereference_rvalue::make_debug_string): Likewise.
253 (get_address_of_lvalue::make_debug_string): Likewise.
254 * jit-recording.h: Within namespace gcc::jit::recording::
255 (precedence): New enum.
256 (rvalue::rvalue): Initialize field "m_parenthesized_string".
257 (rvalue::get_debug_string_parens): New method.
258 (rvalue::get_precedence): New pure virtual function.
259 (rvalue::m_parenthesized_string): New field.
260 (param::get_precedence): New function.
261 (global::get_precedence): New function.
262 (memento_of_new_rvalue_from_const::get_precedence): New function.
263 (memento_of_new_string_literal::get_precedence): New function.
264 (unary_op::get_precedence): New function.
265 (binary_op::get_precedence): New function.
266 (comparison::get_precedence): New function.
267 (cast::get_precedence): New function.
268 (call::get_precedence): New function.
269 (call_through_ptr::get_precedence): New function.
270 (array_access::get_precedence): New function.
271 (access_field_of_lvalue::get_precedence): New function.
272 (access_field_rvalue::get_precedence): New function.
273 (dereference_field_rvalue::get_precedence): New function.
274 (dereference_rvalue::get_precedence): New function.
275 (get_address_of_lvalue::get_precedence): New function.
276 (local::get_precedence): New function.
278 2015-06-09 Matthias Klose <doko@ubuntu.com>
280 * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
282 2015-06-08 Andrew MacLeod <amacleod@redhat.com>
284 * dummy-frontend.c : Adjust include files.
285 * jit-common.h : Likewise.
286 * jit-playback.c : Likewise.
288 2015-06-05 David Malcolm <dmalcolm@redhat.com>
291 (jit_langhook_post_compilation_parsing_cleanups): Remove.
292 (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
293 * jit-playback.c (gcc::jit::playback::context::new_global): Add
294 call to varpool_node::finalize_decl.
295 (gcc::jit::playback::context::finalize_global_decls): Remove.
297 (gcc::jit::playback::context::finalize_global_decls): Remove.
299 2015-06-05 David Malcolm <dmalcolm@redhat.com>
301 * dummy-frontend.c (jit_langhook_write_globals): Rename to...
302 (jit_langhook_post_compilation_parsing_cleanups): ...this, and
303 eliminate calls to finalize_compilation_unit and
304 write_global_decls_2.
305 (LANG_HOOKS_WRITE_GLOBALS): Rename to...
306 (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
307 redirect from jit_langhook_write_globals to
308 jit_langhook_post_compilation_parsing_cleanups.
310 (gcc::jit::playback::context::write_global_decls_1): Rename to...
311 (gcc::jit::playback::context::finalize_global_decls): ...this.
312 (gcc::jit::playback::context::write_global_decls_1): Delete.
314 (gcc::jit::playback::context::write_global_decls_1): Rename to...
315 (gcc::jit::playback::context::finalize_global_decls): ...this.
316 (gcc::jit::playback::context::write_global_decls_1): Delete.
318 2015-06-04 Andrew MacLeod <amacleod@redhat.com>
320 * dummy-frontend.c: Adjust includes for restructured coretypes.h.
321 * jit-common.h: Likewise.
322 * jit-playback.c: Likewise.
324 2015-05-12 David Malcolm <dmalcolm@redhat.com>
326 * jit-builtins.c: Include vec.h before target.h.
328 2015-04-27 Jim Wilson <jim.wilson@linaro.org>
330 * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
333 2015-04-09 David Malcolm <dmalcolm@redhat.com>
336 * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
337 and paste error in description of gccjit::context::one.
338 * docs/topics/expressions.rst (Simple expressions): Likewise in
339 description of gcc_jit_context_one.
340 * docs/_build/texinfo/libgccjit.texi: Regenerate.
342 2015-03-13 Uros Bizjak <ubizjak@gmail.com>
344 * jit-recording.c (dump::write): Also check vasprintf return value.
345 (recording::context::add_error_va): Ditto.
346 (recording::string::from_printf): Ditto.
348 2015-03-13 David Malcolm <dmalcolm@redhat.com>
350 * docs/internals/index.rst (Packaging notes): New section.
351 * docs/_build/texinfo/libgccjit.texi: Regenerate.
353 2015-03-05 David Malcolm <dmalcolm@redhat.com>
355 * docs/cp/intro/tutorial03.rst: Add missing arguments to
356 gccjit::block::end_with_conditional call. Add on_true/on_false
357 comments. Tweak the wording.
358 * docs/intro/tutorial03.rst: Add missing arguments to
359 gcc_jit_block_end_with_conditional call. Add some clarifying
361 * docs/topics/compilation.rst: Tweak the wording to avoid an
362 ambiguous use of "this".
363 * docs/topics/contexts.rst: Fix a typo.
364 * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
366 * docs/_build/texinfo/libgccjit.texi: Regenerate.
368 2015-02-24 Thomas Schwinge <thomas@codesourcery.com>
371 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
372 (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
373 (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
374 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
375 (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
376 (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
378 2015-02-04 David Malcolm <dmalcolm@redhat.com>
381 * docs/conf.py (html_theme): Change from 'pyramid'
384 2015-02-04 David Malcolm <dmalcolm@redhat.com>
386 * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
388 * docs/_build/texinfo/libgccjit.texi: Regenerate.
390 2015-02-03 David Malcolm <dmalcolm@redhat.com>
392 * jit-logging.h (gcc::jit::log_user::log): Make const.
393 * jit-recording.c (gcc::jit::recording::context::set_str_option):
394 Log the new value of the option.
395 (gcc::jit::recording::context::set_int_option): Likewise.
396 (gcc::jit::recording::context::set_bool_option): Likewise.
397 (gcc::jit::recording::context::compile): Log the value of all
399 (gcc::jit::recording::context::compile_to_file): Likewise.
400 (gcc::jit::recording::context::log_all_options): New function.
401 (gcc::jit::recording::context::log_str_option): New function.
402 (gcc::jit::recording::context::log_int_option): New function.
403 (gcc::jit::recording::context::log_bool_option): New function.
404 * jit-recording.h (gcc::jit::recording::context::log_all_options):
406 (gcc::jit::recording::context::log_str_option): New function.
407 (gcc::jit::recording::context::log_int_option): New function.
408 (gcc::jit::recording::context::log_bool_option): New function.
409 * docs/internals/test-hello-world.exe.log.txt: Update for above
411 * docs/_build/texinfo/libgccjit.texi: Regenerate.
413 2015-02-03 David Malcolm <dmalcolm@redhat.com>
416 * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
417 (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
418 * jit-playback.c: Include gcc.h.
419 (gcc::jit::playback::context::compile): Move mutex acquisition
420 to before the call to make_fake_args.
421 (append_arg_from_driver): New function.
422 (gcc::jit::playback::context::make_fake_args): On the first call,
423 call into driver_get_configure_time_options to get configure-time
424 default options and cache them. Add them to the args for
426 * jit-spec.c: New source file.
427 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
429 * docs/_build/texinfo/libgccjit.texi: Regenerate.
431 2015-02-02 David Malcolm <dmalcolm@redhat.com>
434 * dummy-frontend.c (jit_langhook_type_for_mode): Support
435 TYPE_MODE (long_long_integer_type_node).
437 2015-01-27 David Malcolm <dmalcolm@redhat.com>
439 * docs/internals/test-hello-world.exe.log.txt: Add example version
441 * docs/_build/texinfo/libgccjit.texi: Regenerate.
442 * jit-common.h (gcc::jit::dump::get_file): New accessor.
443 * jit-logging.c: Include toplev.h.
444 (gcc::jit::logger::logger): Log the GCC version.
445 * jit-recording.c: Include toplev.h.
446 (gcc:jit::recording::context::dump_reproducer_to_file): Log the
449 2015-01-26 David Malcolm <dmalcolm@redhat.com>
451 * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
452 * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
453 error buffer is only valid until the next call to the context.
454 * docs/_build/texinfo/libgccjit.texi: Regenerate.
455 * libgccjit.h (gcc_jit_context_get_first_error): Reword the
456 comment to omit mention of compiling.
457 (gcc_jit_context_get_last_error): The error buffer is only valid
458 until the next call to the context.
460 2015-01-26 David Malcolm <dmalcolm@redhat.com>
463 * config-lang.in (compilers): Drop "libgccjit.so".
465 2015-01-23 David Malcolm <dmalcolm@redhat.com>
468 * jit-playback.c (gcc::jit::playback::context::compile): Construct
469 toplev instances with init_signals=false.
471 2015-01-19 David Malcolm <dmalcolm@redhat.com>
473 * docs/cp/topics/results.rst: Rename to...
474 * docs/cp/topics/compilation.rst: ...this, and add section on
475 ahead-of-time compilation.
476 * docs/cp/topics/index.rst: Update for renaming of results.rst
478 * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
480 * docs/examples/tut05-bf.c: New file, implementing a compiler
482 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
483 changes to logger output.
484 * docs/intro/index.rst: Add tutorial05.rst
485 * docs/intro/tutorial05.rst: New file.
486 * docs/topics/results.rst: Rename to...
487 * docs/topics/compilation.rst: ...this, and add section on
488 ahead-of-time compilation.
489 * docs/topics/index.rst: Update for renaming of results.rst to
491 * docs/_build/texinfo/libgccjit.texi: Regenerate.
492 * jit-playback.c (gcc::jit::playback::context::compile): Convert
493 return type from result * to void. Move the code to convert to
494 dso and dlopen the result to a new pure virtual "postprocess"
496 (gcc::jit::playback::compile_to_memory::compile_to_memory): New
498 (gcc::jit::playback::compile_to_memory::postprocess): New
499 function, based on playback::context::compile.
500 (gcc::jit::playback::compile_to_file::compile_to_file): New
502 (gcc::jit::playback::compile_to_file::postprocess): New function.
503 (gcc::jit::playback::compile_to_file::copy_file): New function.
504 (gcc::jit::playback::context::convert_to_dso): Move internals
506 (gcc::jit::playback::context::invoke_driver): New method. Add
507 "-shared" and "-c" options to driver's argv as needed.
508 * jit-playback.h: Include "timevar.h".
509 (gcc::jit::playback::context::compile): Convert return type from
511 (gcc::jit::playback::context::postprocess): New pure virtual
512 function, making this an abstract base class.
513 (gcc::jit::playback::context::get_tempdir): New accessor.
514 (gcc::jit::playback::context::invoke_driver): New function.
515 (class gcc::jit::playback::compile_to_memory): New subclass of
517 (class gcc::jit::playback::compile_to_file): Likewise.
518 * jit-recording.c (gcc::jit::recording::context::compile): Use a
519 playback::compile_to_memory, and extract its result.
520 (gcc::jit::recording::context::compile_to_file): New function.
521 * jit-recording.h (gcc::jit::recording::context::compile_to_file):
523 * libgccjit++.h (gccjit::context::compile_to_file): New method.
524 * libgccjit.c (gcc_jit_context_compile): Update log message to
525 clarify that this is an in-memory compile.
526 (gcc_jit_context_compile_to_file): New function.
527 * libgccjit.h (gcc_jit_context): Clarify that you can compile
528 a context more than once, and that you can compile to a file
529 as well as to memory.
530 (gcc_jit_result): Clarify that this is the result of an
531 in-memory compilation.
532 (gcc_jit_context_compile): Clarify that you can compile, and that
533 this is an in-memory compilation.
534 (enum gcc_jit_output_kind): New enum.
535 (gcc_jit_context_compile_to_file): New function.
536 (gcc_jit_context_enable_dump): Clarify comment to cover both forms
538 * libgccjit.map (gcc_jit_context_compile_to_file): New API
540 * notes.txt: Update to show the playback::context::postprocess
543 2015-01-19 David Malcolm <dmalcolm@redhat.com>
546 (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
547 Add missing format string.
549 2015-01-16 David Malcolm <dmalcolm@redhat.com>
551 * Make-lang.in (lang_checks_parallelized): Add "check-jit".
552 (check_jit_parallelize): Set this to an arbitrary value (10).
554 2015-01-16 Jakub Jelinek <jakub@redhat.com>
556 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
558 (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
560 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
563 2015-01-15 Richard Sandiford <richard.sandiford@arm.com>
565 Update copyright years in docs/.
567 2015-01-15 David Malcolm <dmalcolm@redhat.com>
569 * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
570 lvalue and the rvalue are of compatible type.
572 2015-01-13 David Malcolm <dmalcolm@redhat.com>
574 * docs/cp/topics/contexts.rst (Debugging): Add
575 gccjit::context::dump_reproducer_to_file.
576 * docs/internals/index.rst (Design notes): New section,
577 discussing input validation and
578 gcc_jit_context_dump_reproducer_to_file.
579 * docs/topics/contexts.rst (Debugging): Add
580 gcc_jit_context_dump_reproducer_to_file.
581 * docs/_build/texinfo/libgccjit.texi: Regenerate.
582 * jit-common.h (gcc::jit::dump::get_context): New accessor.
583 * jit-recording.c: Include "hash-map.h".
584 Within namespace ::gcc::jit...
585 (dump::write): Flush each line.
586 (dump::make_location): Pass false for new param "created_by_user".
587 (class allocator): New class.
588 (allocator::~allocator): New function.
589 (allocator::xstrdup_printf): New function.
590 (allocator::xstrdup_printf_va): New function.
591 (class reproducer): New subclass of dump.
592 (reproducer::reproducer): New function.
593 (reproducer::write_params): New function.
594 (reproducer::write_args): New function.
595 (reproducer::make_identifier): New function.
596 (reproducer::make_tmp_identifier): New function.
597 (reproducer::get_identifier): New pair of functions.
598 (reproducer::get_identifier_as_rvalue): New function.
599 (reproducer::get_identifier_as_lvalue): New function.
600 (reproducer::get_identifier_as_type): New function.
601 (reproducer::xstrdup_printf): New function.
602 (recording::context::context): Initialize m_toplevel_ctxt.
603 (recording::context::new_location): Add param created_by_user.
604 (str_option_reproducer_strings): New table of strings.
605 (int_option_reproducer_strings): Likewise.
606 (bool_option_reproducer_strings): Likewise.
607 (get_type_enum_strings): Likewise.
608 (names_of_function_kinds): Likewise.
609 (global_kind_reproducer_strings): Likewise.
610 (unary_op_reproducer_strings): Likewise.
611 (binary_op_reproducer_strings): Likewise.
612 (comparison_reproducer_strings): Likewise.
613 Within namespace ::gcc::jit::recording::...
614 (context::dump_reproducer_to_file): New function.
615 (string::write_reproducer): Likewise.
616 (location::write_reproducer): Likewise.
617 (type::access_as_type): Likewise.
618 (memento_of_get_type::write_reproducer): Likewise.
619 (memento_of_get_pointer::write_reproducer): Likewise.
620 (memento_of_get_const::write_reproducer): Likewise.
621 (memento_of_get_volatile::write_reproducer): Likewise.
622 (array_type::write_reproducer): Likewise.
623 (function_type::write_reproducer): Likewise.
624 (function_type::write_deferred_reproducer): Likewise.
625 (field::write_reproducer): Likewise.
626 (struct_::access_as_type): Likewise.
627 (struct_::write_reproducer): Likewise.
628 (union_::write_reproducer): Likewise.
629 (fields::write_reproducer): Likewise.
630 (rvalue::access_as_rvalue): Likewise.
631 (lvalue::access_as_rvalue): Likewise.
632 (lvalue::access_as_lvalue): Likewise.
633 (param::access_as_rvalue): Likewise.
634 (param::access_as_lvalue): Likewise.
635 (param::write_reproducer): Likewise.
636 (function::write_reproducer): Likewise.
637 (block::write_reproducer): Likewise.
638 (global::write_reproducer): Likewise.
639 (memento_of_new_rvalue_from_const <int>::write_reproducer):
641 (memento_of_new_rvalue_from_const <long>::write_reproducer):
643 (memento_of_new_rvalue_from_const <double>::write_reproducer):
645 (memento_of_new_rvalue_from_const <void *>::write_reproducer):
647 (memento_of_new_string_literal::write_reproducer): Likewise.
648 (unary_op::write_reproducer): Likewise.
649 (binary_op::write_reproducer): Likewise.
650 (comparison::write_reproducer): Likewise.
651 (cast::write_reproducer): Likewise.
652 (call::write_reproducer): Likewise.
653 (call_through_ptr::write_reproducer): Likewise.
654 (array_access::write_reproducer): Likewise.
655 (access_field_of_lvalue::write_reproducer): Likewise.
656 (access_field_rvalue::write_reproducer): Likewise.
657 (dereference_field_rvalue::write_reproducer): Likewise.
658 (dereference_rvalue::write_reproducer): Likewise.
659 (get_address_of_lvalue::write_reproducer): Likewise.
660 (local::write_reproducer): Likewise.
661 (eval::write_reproducer): Likewise.
662 (assignment::write_reproducer): Likewise.
663 (assignment_op::write_reproducer): Likewise.
664 (comment::write_reproducer): Likewise.
665 (conditional::write_reproducer): Likewise.
666 (jump::write_reproducer): Likewise.
667 (return_::write_reproducer): Likewise.
668 * jit-recording.h (gcc::jit::reproducer): New forward declararion.
669 Within namespace ::gcc::jit::recording::...
670 (context::new_location): Add "created_by_user" param.
671 (context::dump_reproducer_to_file): New method.
672 (context::m_toplevel_ctxt): New field.
673 (memento::write_reproducer): New pure virtual function.
674 (memento::dyn_cast_location): New virtual function.
675 (string::write_reproducer):
676 (location::location): Add "created_by_user" param.
677 (location::dyn_cast_location): New function.
678 (location::created_by_user): New accessor.
679 (location::write_reproducer): New function.
680 (location::m_created_by_user): New field.
681 (type::access_as_type): New virtual function.
682 (location::write_reproducer): Likewise.
683 (type::access_as_type): Likewise.
684 (memento_of_get_type::write_reproducer): Likewise.
685 (memento_of_get_pointer::write_reproducer): Likewise.
686 (memento_of_get_const::write_reproducer): Likewise.
687 (memento_of_get_volatile::write_reproducer): Likewise.
688 (array_type::write_reproducer): Likewise.
689 (function_type::write_reproducer): Likewise.
690 (function_type::write_deferred_reproducer): Likewise.
691 (field::write_reproducer): Likewise.
692 (struct_::access_as_type): Likewise.
693 (struct_::write_reproducer): Likewise.
694 (union_::write_reproducer): Likewise.
695 (union_::m_fields): Remove stray unused field.
696 (fields::length): New accessor.
697 (fields::get_field): New accessor.
698 (fields::write_reproducer): New function.
699 (rvalue::access_as_rvalue): Likewise.
700 (lvalue::access_as_rvalue): Likewise.
701 (lvalue::access_as_lvalue): Likewise.
702 (param::access_as_rvalue): Likewise.
703 (param::access_as_lvalue): Likewise.
704 (param::write_reproducer): Likewise.
705 (function::write_reproducer): Likewise.
706 (block::write_reproducer): Likewise.
707 (global::write_reproducer): Likewise.
708 (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
710 (memento_of_new_string_literal::write_reproducer): Likewise.
711 (unary_op::write_reproducer): Likewise.
712 (binary_op::write_reproducer): Likewise.
713 (comparison::write_reproducer): Likewise.
714 (cast::write_reproducer): Likewise.
715 (call::write_reproducer): Likewise.
716 (call_through_ptr::write_reproducer): Likewise.
717 (array_access::write_reproducer): Likewise.
718 (access_field_of_lvalue::write_reproducer): Likewise.
719 (access_field_rvalue::write_reproducer): Likewise.
720 (dereference_field_rvalue::write_reproducer): Likewise.
721 (dereference_rvalue::write_reproducer): Likewise.
722 (get_address_of_lvalue::write_reproducer): Likewise.
723 (local::write_reproducer): Likewise.
724 (eval::write_reproducer): Likewise.
725 (assignment::write_reproducer): Likewise.
726 (assignment_op::write_reproducer): Likewise.
727 (comment::write_reproducer): Likewise.
728 (conditional::write_reproducer): Likewise.
729 (jump::write_reproducer): Likewise.
730 (return_::write_reproducer): Likewise.
731 * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
732 * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
733 param "created_by_user".
734 (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
735 * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
737 * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
740 2015-01-12 David Malcolm <dmalcolm@redhat.com>
742 * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
743 (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
745 (gcc::jit::rvalue_usage_validator::visit): New function.
746 (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
748 (gcc::jit::recording::rvalue::set_scope): New function.
749 (gcc::jit::recording::function::function): Call set_scope on each
750 param, issuing errors for any params that already have a function.
751 (gcc::jit::recording::block::add_eval): Return the new statement;
752 update the comment given that some error-checking now happens after
754 (gcc::jit::recording::block::add_assignment): Likewise.
755 (gcc::jit::recording::block::add_assignment_op): Likewise.
756 (gcc::jit::recording::block::add_comment): Likewise.
757 (gcc::jit::recording::block::end_with_conditional): Likewise.
758 (gcc::jit::recording::block::end_with_jump): Likewise.
759 (gcc::jit::recording::block::end_with_return): Likewise.
760 (gcc::jit::recording::block::validate): Add a comment.
761 (gcc::jit::recording::unary_op::visit_children): New function.
762 (gcc::jit::recording::binary_op::visit_children): New function.
763 (gcc::jit::recording::comparison::visit_children): New function.
764 (gcc::jit::recording::cast::visit_children): New function.
765 (gcc::jit::recording::call::visit_children): New function.
766 (gcc::jit::recording::call_through_ptr::visit_children): New function.
767 (gcc::jit::recording::array_access::visit_children): New function.
768 (gcc::jit::recording::access_field_of_lvalue::visit_children): New
770 (gcc::jit::recording::access_field_rvalue::visit_children): New
772 (gcc::jit::recording::dereference_field_rvalue::visit_children):
774 (gcc::jit::recording::dereference_rvalue::visit_children): New
776 (gcc::jit::recording::get_address_of_lvalue::visit_children): New
778 * jit-recording.h: Within namespace gcc::jit::recording...
779 (class rvalue_visitor): New.
780 (rvalue::rvalue): Initialize m_scope.
781 (rvalue::get_loc): New accessor.
782 (rvalue::verify_valid_within_stmt): New function.
783 (rvalue::visit_children): New pure virtual function.
784 (rvalue::set_scope): New function.
785 (rvalue::get_scope): New function.
786 (rvalue::dyn_cast_param): New function.
787 (rvalue::m_scope): New field.
788 (param::visit_children): New empty function.
789 (param::dyn_cast_param): New function.
790 (function::get_loc): New function.
791 (block::add_eval): Return the new statement.
792 (block::add_assignment): Likewise.
793 (block::add_assignment_op): Likewise.
794 (block::add_comment): Likewise.
795 (block::end_with_conditional): Likewise.
796 (block::end_with_jump): Likewise.
797 (block::end_with_return): Likewise.
798 (global::visit_children): New function.
799 (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
801 (memento_of_new_string_literal::visit_children): New function.
802 (unary_op::visit_children): New function.
803 (binary_op::visit_children): New function.
804 (comparison::visit_children): New function.
805 (cast::visit_children): New function.
806 (call::visit_children): New function.
807 (call_through_ptr::visit_children): New function.
808 (array_access::visit_children): New function.
809 (access_field_of_lvalue::visit_children): New function.
810 (access_field_rvalue::visit_children): New function.
811 (dereference_field_rvalue::visit_children): New function.
812 (dereference_rvalue::visit_children): New function.
813 (get_address_of_lvalue::visit_children): New function.
814 (local::local): Call set_scope.
815 (local::visit_children): New function.
816 (statement::get_block): Make public.
817 * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
818 (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
819 (gcc_jit_context_new_function): Verify that each param has
820 not yet been used for creating another function.
821 (gcc_jit_block_add_eval): After creating the stmt, verify
822 that the rvalue expression tree is valid to use within it.
823 (gcc_jit_block_add_assignment): Likewise for the lvalue and
824 rvalue expression trees.
825 (gcc_jit_block_add_assignment_op): Likewise.
826 (gcc_jit_block_end_with_conditional): Likewise for the boolval
828 (gcc_jit_block_end_with_return): Likewise for the rvalue
830 (gcc_jit_block_end_with_void_return): Remove return of "void",
831 now that block::end_with_return is now non-void.
833 2015-01-12 David Malcolm <dmalcolm@redhat.com>
835 * jit-playback.c (gcc::jit::playback::context::read_dump_file):
836 Add missing fclose on error-handling path.
838 2015-01-12 David Malcolm <dmalcolm@redhat.com>
840 * docs/cp/topics/expressions.rst (Global variables): Add
841 enum gcc_jit_global_kind param to gccjit::context::new_global.
842 * docs/topics/expressions.rst (Global variables): Likewise.
843 Document the new enum.
844 * docs/topics/results.rst (Compilation results): Document
846 * docs/_build/texinfo/libgccjit.texi: Regenerate.
847 * dummy-frontend.c (jit_langhook_write_globals): Call into the
848 playback context's write_global_decls_1 and write_global_decls_2
849 before and after calling symtab->finalize_compilation_unit ().
850 * jit-playback.c: Include "debug.h".
851 (gcc::jit::playback::context::new_global): Add "kind" param and
852 use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
853 underlying VAR_DECL. Call varpool_node::get_create on the
854 VAR_DECL, and add it to m_globals.
855 (gcc::jit::playback::context::write_global_decls_1): New function.
856 (gcc::jit::playback::context::write_global_decls_2): New function.
857 * jit-playback.h (gcc::jit::playback::context::context): Call
859 (gcc::jit::playback::context::new_global): Add "kind" param.
860 (gcc::jit::playback::context::write_global_decls_1): New function.
861 (gcc::jit::playback::context::write_global_decls_2): New function.
862 (gcc::jit::playback::context::m_globals): New field.
863 * jit-recording.c (gcc::jit::recording::context::context):
864 Initialize m_globals.
865 (gcc::jit::recording::context::new_global): Add param "kind".
866 Add the new global to m_globals.
867 (gcc::jit::recording::context::dump_to_file): Dump the globals.
868 (gcc::jit::recording::global::replay_into): Add field m_kind.
869 (gcc::jit::recording::global::write_to_dump): New override.
870 * jit-recording.h (gcc::jit::recording::context::new_global): Add
872 (gcc::jit::recording::context::m_globals): New field.
873 (gcc::jit::recording::global::global): Add param kind.
874 (gcc::jit::recording::global::write_to_dump): New override.
875 (gcc::jit::recording::global::m_kind): New field.
876 * jit-result.c (gcc::jit::result::get_global): New function.
877 * jit-result.h (gcc::jit::result::get_global): New function.
878 * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
879 * libgccjit.c (gcc_jit_context_new_global): Likewise.
880 (gcc_jit_result_get_global): New API entrypoint.
881 * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
882 (enum gcc_jit_global_kind): New enum.
883 (gcc_jit_context_new_global): API change: add "kind" param.
884 * libgccjit.map (gcc_jit_result_get_global): New symbol.
886 2015-01-09 David Malcolm <dmalcolm@redhat.com>
888 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
889 "symtab.h", "inchash.h". Move include of "hash-set.h" much
891 * jit-builtins.c: Remove redundant includes of "opts.h" and
893 * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
894 "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
895 * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
896 "statistics.h", "vec.h", "double-int.h", "real.h",
897 "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
898 "inchash.h", "fold-const.h". Move include of "hash-set.h" to
900 * jit-recording.c: Remove redundant includes of "opts.h" and
903 2015-01-09 David Malcolm <dmalcolm@redhat.com>
905 * docs/cp/topics/expressions.rst (Simple expressions): Use
906 ":c:type:" for C types. Document new overload of
907 gcc::jit::context::new_rvalue.
908 * docs/topics/expressions.rst (Simple expressions): Use
909 ":c:type:" for C types. Document new entrypoint
910 gcc_jit_context_new_rvalue_from_long.
911 * docs/_build/texinfo/libgccjit.texi: Regenerate.
912 * jit-playback.c: Within namespace gcc::jit::playback...
913 (context::new_rvalue_from_int): Eliminate in favor of...
914 (context::new_rvalue_from_const <int>): ...this.
915 (context::new_rvalue_from_double): Eliminate in favor of...
916 (context::new_rvalue_from_const <double>): ...this.
917 (context::new_rvalue_from_const <long>): New.
918 (context::new_rvalue_from_ptr): Eliminate in favor of...
919 (context::new_rvalue_from_const <void *>): ...this.
920 * jit-playback.h: Within namespace gcc::jit::playback...
921 (context::new_rvalue_from_int): Eliminate in favor of...
922 (context::new_rvalue_from_const <HOST_TYPE>): ...this.
923 (context::new_rvalue_from_double): Likewise.
924 (context::new_rvalue_from_ptr): Likewise.
925 * jit-recording.c: Within namespace gcc::jit::recording...
926 (context::new_rvalue_from_int): Eliminate.
927 (context::new_rvalue_from_double): Likewise.
928 (context::new_rvalue_from_ptr): Likewise.
929 (class memento_of_new_rvalue_from_const <int>):
930 Add explicit specialization.
931 (class memento_of_new_rvalue_from_const <long>):
933 (class memento_of_new_rvalue_from_const <double>):
935 (class memento_of_new_rvalue_from_const <void *>):
937 (memento_of_new_rvalue_from_int::replay_into):
939 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
941 (memento_of_new_rvalue_from_double::replay_into):
943 (memento_of_new_rvalue_from_ptr::replay_into):
944 ...and this to be deleted.
945 (memento_of_new_rvalue_from_int::make_debug_string):
947 (memento_of_new_rvalue_from_const <int>::make_debug_string):
949 (memento_of_new_rvalue_from_double::make_debug_string):
951 (memento_of_new_rvalue_from_const <double>::make_debug_string):
953 (memento_of_new_rvalue_from_ptr::make_debug_string)
955 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
957 (memento_of_new_rvalue_from_const <long>::make_debug_string):
959 * jit-recording.h: Within namespace gcc::jit::recording...
960 (context::new_rvalue_from_int): Eliminate.
961 (context::new_rvalue_from_double): Likewise.
962 (context::new_rvalue_from_ptr): Likewise, all in favor of...
963 (context::new_rvalue_from_const <HOST_TYPE>): New family of
965 (class memento_of_new_rvalue_from_int): Eliminate.
966 (class memento_of_new_rvalue_from_double): Likewise.
967 (class memento_of_new_rvalue_from_ptr): Likewise.
968 (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
969 of rvalue subclasses.
970 * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
972 * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
973 rewriting of recording::context::new_rvalue_from_int to
974 recording::context::new_rvalue_from_const <int>.
975 (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
976 (gcc_jit_context_new_rvalue_from_double): Update for
977 rewriting of recording::context::new_rvalue_from_double to
978 recording::context::new_rvalue_from_const <double>.
979 (gcc_jit_context_new_rvalue_from_ptr): Update for
980 rewriting of recording::context::new_rvalue_from_ptr to
981 recording::context::new_rvalue_from_const <void *>.
982 * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
984 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
986 2015-01-09 David Malcolm <dmalcolm@redhat.com>
989 * docs/internals/test-hello-world.exe.log.txt: Update, the log now
990 shows tempdir creation/cleanup.
991 * docs/_build/texinfo/libgccjit.texi: Regenerate.
992 * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
993 to the list of subclasses in the comment.
994 * jit-playback.c (gcc::jit::playback::context::context): Add a
995 comment clarifying when the tempdir gets cleaned up.
996 (gcc::jit::playback::context::compile): Pass the context's logger,
997 if any, to the tempdir.
998 (gcc::jit::playback::context::dlopen_built_dso): When creating the
999 gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
1000 over ownership of the tempdir to it.
1001 * jit-result.c: Include "jit-tempdir.h".
1002 (gcc::jit::result::result): Add tempdir param, saving it as
1004 (gcc::jit::result::~result): Delete m_tempdir.
1005 * jit-result.h (gcc::jit::result::result): Add tempdir param.
1006 (gcc::jit::result::m_tempdir): New field.
1007 * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
1009 (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
1010 and log m_path_template and m_path_tempdir.
1011 (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
1012 entry/exit, and log the unlink and rmdir calls.
1013 * jit-tempdir.h: Include "jit-logging.h".
1014 (class gcc::jit::tempdir): Make this be a subclass of log_user.
1015 (gcc::jit::tempdir::tempdir): Add logger param.
1016 * notes.txt: Update to show the two possible places where the
1017 tempdir can be cleaned up.
1019 2015-01-08 David Malcolm <dmalcolm@redhat.com>
1021 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
1024 2015-01-08 David Malcolm <dmalcolm@redhat.com>
1026 * docs/topics/contexts.rst (Error-handling): Document new
1027 entrypoint gcc_jit_context_get_last_error.
1028 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1029 * jit-recording.c (gcc::jit::recording::context::context):
1030 Initialize new fields "m_last_error_str" and
1031 "m_owns_last_error_str".
1032 (gcc::jit::recording::context::~context): Clean up
1033 m_last_error_str, if needed.
1034 (gcc::jit::recording::context::add_error_va): Update
1035 m_last_error_str and m_owns_last_error_str, freeing the old
1036 value if appropriate.
1037 (gcc::jit::recording::context::get_last_error): New function.
1038 * jit-recording.h (gcc::jit::recording::context::get_last_error):
1040 (gcc::jit::recording::context): New fields m_last_error_str and
1041 m_owns_last_error_str.
1042 * libgccjit.c (gcc_jit_context_get_last_error): New function.
1043 * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1044 * libgccjit.map (gcc_jit_context_get_last_error): New function.
1046 2015-01-08 David Malcolm <dmalcolm@redhat.com>
1048 * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1049 * docs/internals/index.rst (Overview of code structure): Mention
1050 gcc_jit_context_set_logfile, and embed the example logfile.
1051 * docs/internals/test-hello-world.exe.log.txt: New file: example
1053 * docs/topics/contexts.rst (Debugging): Add documentation
1054 for gcc_jit_context_set_logfile.
1055 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1056 * dummy-frontend.c: Include "jit-logging.h".
1057 (jit_langhook_init): Assert that there is an active playback
1058 context. If it has a logger, log entry/exit to this function.
1059 (jit_langhook_write_globals): Likewise.
1060 * jit-common.h (gcc::jit::logger): New forward declaration.
1061 * jit-logging.c: New file.
1062 * jit-logging.h: New file.
1063 * jit-playback.c: Include "jit-logging.h".
1064 (gcc::jit::playback::context::context): Initialize the log_user
1065 base class from the recording context's logger (if any). Use
1066 JIT_LOG_SCOPE to log entry/exit from the function body.
1067 (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1068 log entry/exit from the function body.
1069 (gcc::jit::playback::build_stmt_list): Likewise.
1070 (gcc::jit::playback::function::postprocess): Likewise.
1071 (gcc::jit::playback::context::compile): Likewise. Log the
1072 entry/exit to toplev::main and toplev::finalize. Log the
1073 fake argv passed to toplev::main.
1074 (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1075 log entry/exit from the function body.
1076 (gcc::jit::playback::context::release_mutex): Likewise.
1077 (gcc::jit::playback::context::make_fake_args): Likewise.
1078 (gcc::jit::playback::context::extract_any_requested_dumps):
1080 (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1081 log the arguments that the driver is invoked with.
1082 (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
1083 the logger to the result object.
1084 (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1085 log entry/exit from the function body.
1086 (gcc::jit::playback::context::dump_generated_code): Likewise.
1087 (gcc::jit::playback::context::handle_locations): Likewise.
1088 * jit-playback.h (gcc::jit::playback::context): Make this be
1089 a subclass of gcc::jit::log_user.
1090 * jit-recording.c: Include "jit-logging.h".
1091 (gcc::jit::recording::context::context: Initialize the logger to
1092 NULL for root contexts, or to the parent's logger for child
1094 (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1095 log entry/exit from the function body.
1096 (gcc::jit::recording::context::replay_into): Likewise.
1097 (gcc::jit::recording::context::disassociate_from_playback):
1099 (gcc::jit::recording::context::compile): Likewise.
1100 (recording::context::add_error_va): Likewise. Also, log the
1102 (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1103 log entry/exit from the function body.
1104 * jit-recording.h: Include "jit-logging.h".
1105 (gcc::jit::recording::context): Make this be a subclass of
1107 * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1108 (gcc::jit::result::result): Add logger param, recording it.
1109 Use JIT_LOG_SCOPE to log entry/exit from the function body.
1110 (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1111 log entry/exit from the function body.
1112 (gcc::jit::result::get_code): Likewise.
1113 * jit-result.h (gcc::jit::result): Make this be a subclass of
1115 (gcc::jit::result::result): Add logger parameter.
1116 * libgccjit++.h (gccjit::context::set_logfile): New function.
1117 * libgccjit.c: Include "jit-logging.h".
1118 (gcc_jit_context_acquire): Log the context.
1119 (gcc_jit_context_release): Use JIT_LOG_FUNC to
1120 log entry/exit from the function body, and log the context.
1121 (gcc_jit_context_new_child_context): Likewise, logging both
1123 (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1124 log entry/exit from the function body.
1125 (gcc_jit_context_get_type): Likewise.
1126 (gcc_jit_context_get_int_type): Likewise.
1127 (gcc_jit_context_new_array_type): Likewise.
1128 (gcc_jit_context_new_field): Likewise.
1129 (gcc_jit_context_new_struct_type): Likewise.
1130 (gcc_jit_context_new_opaque_struct): Likewise.
1131 (gcc_jit_struct_set_fields): Likewise.
1132 (gcc_jit_context_new_union_type): Likewise.
1133 (gcc_jit_context_new_function_ptr_type): Likewise.
1134 (gcc_jit_context_new_param): Likewise.
1135 (gcc_jit_context_new_function): Likewise.
1136 (gcc_jit_context_get_builtin_function): Likewise.
1137 (gcc_jit_function_get_param): Likewise.
1138 (gcc_jit_function_dump_to_dot): Likewise.
1139 (gcc_jit_function_new_block): Likewise.
1140 (gcc_jit_context_new_global): Likewise.
1141 (gcc_jit_context_new_rvalue_from_int): Likewise.
1142 (gcc_jit_context_zero): Likewise.
1143 (gcc_jit_context_one): Likewise.
1144 (gcc_jit_context_new_rvalue_from_double): Likewise.
1145 (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1146 (gcc_jit_context_null): Likewise.
1147 (gcc_jit_context_new_string_literal): Likewise.
1148 (gcc_jit_context_new_unary_op): Likewise.
1149 (gcc_jit_context_new_binary_op): Likewise.
1150 (gcc_jit_context_new_comparison): Likewise.
1151 (gcc_jit_context_new_call): Likewise.
1152 (gcc_jit_context_new_call_through_ptr): Likewise.
1153 (gcc_jit_context_new_cast): Likewise.
1154 (gcc_jit_context_new_array_access): Likewise.
1155 (gcc_jit_lvalue_access_field): Likewise.
1156 (gcc_jit_rvalue_access_field): Likewise.
1157 (gcc_jit_rvalue_dereference_field): Likewise.
1158 (gcc_jit_rvalue_dereference): Likewise.
1159 (gcc_jit_lvalue_get_address): Likewise.
1160 (gcc_jit_function_new_local): Likewise.
1161 (gcc_jit_block_add_eval): Likewise.
1162 (gcc_jit_block_add_assignment): Likewise.
1163 (gcc_jit_block_add_assignment_op): Likewise.
1164 (gcc_jit_block_end_with_conditional): Likewise.
1165 (gcc_jit_block_add_comment): Likewise.
1166 (gcc_jit_block_end_with_jump): Likewise.
1167 (gcc_jit_block_end_with_return): Likewise.
1168 (gcc_jit_block_end_with_void_return): Likewise.
1169 (gcc_jit_context_set_str_option): Likewise.
1170 (gcc_jit_context_set_int_option): Likewise.
1171 (gcc_jit_context_set_bool_option): Likewise.
1172 (gcc_jit_context_enable_dump): Likewise.
1173 (gcc_jit_context_compile): Likewise. Also log the context,
1175 (gcc_jit_context_dump_to_file): Likewise.
1176 (gcc_jit_context_set_logfile): New function.
1177 (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
1178 log entry/exit from the function body.
1179 (gcc_jit_result_get_code): Likewise. Also log the fnname)
1180 and the ptr to be returned.
1181 (gcc_jit_result_release): Likewise. Also log the result.
1182 * libgccjit.h: Include <stdio.h>, since we need FILE *.
1183 (gcc_jit_context_set_logfile): New declaration.
1184 * libgccjit.map (gcc_jit_context_set_logfile): New.
1186 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1188 * jit-recording.h (gcc::jit::recording::type::is_void): New
1190 (gcc::jit::recording::memento_of_get_type::is_void): New
1191 function, overriding default implementation.
1192 * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
1193 the underlying type is not "void".
1195 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1197 * docs/topics/expressions.rst (Unary Operations): Add
1198 GCC_JIT_UNARY_OP_ABS.
1199 * jit-playback.c (gcc::jit::playback::context::new_unary_op):
1201 * jit-recording.c (unary_op_strings): Likewise.
1202 * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
1203 of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
1204 * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
1205 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1207 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1209 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
1212 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1214 * TODO.rst (Test suite): Remove item about running C++ testcases.
1215 * docs/internals/index.rst (Working on the JIT library): Add
1216 "c++" to the enabled languages in the suggested "configure"
1217 invocation, and add a description of why this is necessary.
1218 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1220 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1222 * docs/internals/index.rst: Update to reflect that built
1223 testcases are now test-foo.c.exe, rather than test-foo.exe.
1224 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1226 2015-01-05 Jakub Jelinek <jakub@redhat.com>
1228 Update copyright years.
1230 2014-12-19 David Malcolm <dmalcolm@redhat.com>
1232 * jit-playback.c (gcc::jit::playback::context::build_cast): In
1233 case BOOLEAN_TYPE, don't assume that the source expression is
1236 2014-12-19 David Malcolm <dmalcolm@redhat.com>
1238 * jit-recording.c (gcc::jit::recording::context::context): When
1239 copying string options from a parent context, take a copy of the
1240 underlying buffers, rather than simply copying the pointer.
1242 2014-12-19 David Malcolm <dmalcolm@redhat.com>
1244 * jit-recording.c (gcc::jit::recording::context::set_str_option):
1247 2014-12-11 David Malcolm <dmalcolm@redhat.com>
1249 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
1250 Document new function.
1251 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1253 2014-12-10 Ulrich Drepper <drepper@gmail.com>
1255 Minor interface cleanups of libgccjit
1256 * jit-playback.c (convert_to_dso): Use auto_vec instead
1257 of automatic array to build up command line.
1258 * jit-recording.c (recording::context::set_str_option):
1259 Make copy of the string.
1260 (recording::context::~context): Free string options.
1261 * jit-recording.h (recording::context): Adjust type
1262 of m_str_options member.
1263 * libgccjit.h: Adjust comment about
1264 gcc_jit_context_set_str_option parameter being used after
1266 Update comment now that all interfaces are copy strings
1268 * libgccjit++.h (gccjit::context): Add set_str_option
1271 2014-12-10 David Malcolm <dmalcolm@redhat.com>
1273 * docs/cp/index.rst: New file.
1274 * docs/cp/intro/index.rst: New file.
1275 * docs/cp/intro/tutorial01.rst: New file.
1276 * docs/cp/intro/tutorial02.rst: New file.
1277 * docs/cp/intro/tutorial03.rst: New file.
1278 * docs/cp/intro/tutorial04.rst: New file.
1279 * docs/cp/topics/contexts.rst: New file.
1280 * docs/cp/topics/expressions.rst: New file.
1281 * docs/cp/topics/functions.rst: New file.
1282 * docs/cp/topics/index.rst: New file.
1283 * docs/cp/topics/locations.rst: New file.
1284 * docs/cp/topics/objects.rst: New file.
1285 * docs/cp/topics/results.rst: New file.
1286 * docs/cp/topics/types.rst: New file.
1287 * docs/examples/tut01-hello-world.cc: New file.
1288 * docs/examples/tut02-square.c: Fix missing newline in output.
1289 * docs/examples/tut02-square.cc: New file.
1290 * docs/examples/tut03-sum-of-squares.cc: New file.
1291 * docs/examples/tut04-toyvm/toyvm.cc: New file.
1292 * docs/index.rst: Move summary to above the table of contents.
1293 Add text about the C vs C++ APIs.
1294 * docs/topics/contexts.rst: Fix a typo.
1296 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1297 * docs/_build/texinfo/factorial1.png: New file.
1298 * docs/_build/texinfo/sum-of-squares1.png: New file.
1300 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1302 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
1303 logic for determine "funcname" to new function...
1304 (get_function_name): ...here, adding logic to skip any leading
1305 path from the filename.
1306 (toyvm_function_parse): Use the filename for fn_filename, rather
1307 than "name", so that the debugger can locate the source .toy
1309 (toyvm_function_parse): Don't fclose a NULL FILE *.
1311 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1314 * docs/internals/index.rst (Running under valgrind): New
1316 (docs/_build/texinfo/libgccjit.texi): Regenerate.
1318 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1321 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
1322 * jit-common.h (gcc::jit::tempdir): New forward decl.
1323 * jit-playback.c: Include jit-tempdir.h.
1324 (gcc::jit::playback::context::context): Initialize m_tempdir.
1325 (gcc::jit::playback::context::~context): Move tempdir
1326 cleanup to new file jit-tempdir.c
1327 (make_tempdir_path_template): Move to new file jit-tempdir.c.
1328 (gcc::jit::playback::context::compile): Move tempdir creation
1329 to new tempdir object in new file jit-tempdir.c.
1330 (gcc::jit::playback::context::make_fake_args): Get path from
1331 tempdir object rather than from member data.
1332 (gcc::jit::playback::context::convert_to_dso): Likewise.
1333 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1334 (gcc::jit::playback::context::dump_generated_code): Likewise.
1335 (gcc::jit::playback::context::get_path_c_file): New function.
1336 (gcc::jit::playback::context::get_path_s_file): New function.
1337 (gcc::jit::playback::context::get_path_so_file): New function.
1338 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1340 (gcc::jit::playback::context::get_path_s_file): New function.
1341 (gcc::jit::playback::context::get_path_so_file): New function.
1342 (gcc::jit::playback::context): Move fields "m_path_template",
1343 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1344 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1345 * jit-tempdir.c: New file.
1346 * jit-tempdir.h: New file.
1348 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1350 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1351 mutex here, immediately before using toplev, and release it here, on
1352 each exit path after acquisition.
1353 (jit_mutex): Move this variable here, from jit-recording.c.
1354 (gcc::jit::playback::context::acquire_mutex): New function, based on
1355 code in jit-recording.c.
1356 (gcc::jit::playback::context::release_mutex): Likewise.
1357 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1359 (gcc::jit::playback::context::release_mutex): New function.
1360 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1361 (gcc::jit::recording::context::compile): Move mutex-handling from
1362 here into jit-playback.c's gcc::jit::playback::context::compile.
1363 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1366 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1368 * jit-playback.c (gcc::jit::playback::context::compile): Move the
1370 (gcc::jit::playback::context::dlopen_built_dso): ...this new
1372 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1375 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1378 * docs/topics/contexts.rst (Debugging): Add description of
1379 gcc_jit_context_enable_dump.
1380 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1381 * jit-playback.c: Include context.h.
1382 (class auto_argvec): New class.
1383 (auto_argvec::~auto_argvec): New function.
1384 (gcc::jit::playback::context::compile): Convert fake_args to be
1385 an auto_argvec, so that it can contain dynamically-allocated
1386 strings. Construct a vec of all requested dumps, and pass it to
1387 make_fake_args. Extract requested dumps between the calls to
1388 toplev::main and toplev::finalize.
1389 (gcc::jit::playback::context::make_fake_args): Convert param
1390 "argvec" to be a vec <char *>, and gain a "requested_dumps"
1391 param. Convert to dynamically-allocated arg strings by converting
1392 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1393 for args that are already a copy. Add args for all requested dumps.
1394 (gcc::jit::playback::context::extract_any_requested_dumps): New
1396 (gcc::jit::playback::context::read_dump_file): New function.
1397 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1398 Convert param "argvec" to be a vec <char *>, and gain a
1399 "requested_dumps" param.
1400 (gcc::jit::playback::context::extract_any_requested_dumps): New
1402 (gcc::jit::playback::context::read_dump_file): New function.
1403 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
1405 (gcc::jit::recording::context::get_all_requested_dumps): New
1407 * jit-recording.h (gcc::jit::recording::requested_dump): New
1409 (gcc::jit::recording::context::enable_dump): New function.
1410 (gcc::jit::recording::context::get_all_requested_dumps): New
1412 (gcc::jit::recording::context::m_requested_dumps): New field.
1413 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
1414 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
1415 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
1417 2014-12-08 David Malcolm <dmalcolm@redhat.com>
1419 * libgccjit++.h: Indent the forward declarations of the classes to
1420 show the inheritance hierarchy.
1422 2014-12-08 David Malcolm <dmalcolm@redhat.com>
1424 * notes.txt: Show the beginning and ending of
1425 recording::context::compile vs playback::context::compile. Show
1426 the creation and unlinking of the tempdir. Show toplev::finalize.
1427 Move "RELEASE MUTEX" to the correct location. Show
1428 gcc_jit_result_release, and indicate where the
1429 dlopen/dlsym/dlclose occur.
1431 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1433 * docs/examples/tut02-square.c (main): Release the context
1434 earlier, to show that this is possible. Update error-handling
1435 to avoid a double-release of the context, and to avoid
1436 releasing a NULL result.
1437 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
1438 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
1439 * docs/topics/results.rst (gcc_jit_result): Mention that this
1440 controls the lifetimes of machine code functions.
1441 (gcc_jit_result_get_code): Spell out the requirements for this
1442 to succeed, and the lifetime of the result.
1443 (gcc_jit_result_release): Mention that this invalidates any code
1444 that was obtained from the result.
1445 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1447 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1450 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
1451 Add description of error-handling, taken in part from...
1452 * docs/topics/contexts.rst (Error-handling): Expand, and move some
1453 content to tutorial02.rst.
1454 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1456 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1459 * docs/topics/types.rst (Standard types) Add new enum values to
1460 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1461 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1462 Widen the left-hand column so that
1463 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1464 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1466 * jit-builtins.c: Include stringpool.h and jit-playback.h.
1467 Move everything out of the gcc::jit::recording namespace into
1469 (struct builtin_data): Add fields "fnclass", "attr", and
1471 (DEF_BUILTIN): Update macro so populate the new fields.
1472 (builtins_manager::builtins_manager): Update for move out of
1473 recording namespace. Initialize the m_attributes array.
1474 (builtins_manager::get_builtin_function): Likewise.
1475 (builtins_manager::get_builtin_function_by_id): New function.
1476 (builtins_manager::make_builtin_function): Update for move out of
1477 recording namespace. Add fix for PR jit/64020 by detecting
1478 specific builtin ids and having them ensure that builtins for
1479 other ids are created as necessary.
1480 (builtins_manager::get_type): Update for move out of recording
1482 (builtins_manager::make_type): Likewise. Add some missing
1484 (builtins_manager::make_primitive_type): Update for move out of
1485 recording namespace. Implement the three BT_COMPLEX_ cases and
1487 (builtins_manager::make_fn_type): Update for move out of recording
1489 (builtins_manager::make_ptr_type): Likewise.
1490 (builtins_manager::finish_playback): New function.
1491 (builtins_manager::get_class): New function.
1492 (builtins_manager::implicit_p): New function.
1493 (builtins_manager::get_attrs_tree): Two new functions.
1494 (builtins_manager::make_attrs_tree): New function.
1496 * jit-builtins.h: Move everything out of the gcc::jit::recording
1497 namespace into just gcc::jit.
1498 (enum built_in_attribute): New.
1499 (builtins_manager::builtins_manager): Update decl for namespace
1501 (builtins_manager::get_builtin_function): Likewise.
1502 (builtins_manager::get_class): New.
1503 (builtins_manager::implicit_p): New.
1504 (builtins_manager::get_attrs_tree): Two new functions.
1505 (builtins_manager::make_attrs_tree): New function.
1506 (builtins_manager::finish_playback): New.
1507 (builtins_manager::get_builtin_function_by_id): New.
1508 (builtins_manager::make_builtin_function): Update decl for
1510 (builtins_manager::get_type): Likewise.
1511 (builtins_manager::make_type): Likewise.
1512 (builtins_manager::make_primitive_type): Likewise.
1513 (builtins_manager::make_fn_type): Likewise.
1514 (builtins_manager::make_ptr_type): Likewise.
1515 (builtins_manager): Likewise for fields. Add new field
1518 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1519 (builtins_manager): Update forward decl to reflect namespace
1522 * jit-playback.c: Include attribs.h and jit-builtins.h.
1523 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1524 for the new COMPLEX_ types.
1525 (gcc::jit::playback::context::new_function): If creating a
1526 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1527 and call set_builtin_decl.
1528 (gcc::jit::playback::context::replay): If we have a
1529 builtins_manager, call its finish_playback method when we're done.
1532 (gcc::jit::playback::context::get_builtins_manager): New function.
1535 (gcc::jit::recording::context::get_builtins_manager): New function.
1536 (gcc::jit::recording::get_builtin_function): Use
1537 get_builtins_manager, in case we're a child context.
1538 (gcc::jit::recording::memento_of_get_type::dereference): Add the
1540 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1541 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1542 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1543 (get_type_strings): Likewise.
1546 (gcc::jit::recording::context::get_builtins_manager): New.
1548 * libgccjit.h (enum gcc_jit_types): Add
1549 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1550 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1552 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1555 (gcc::jit::recording::builtins_manager::get_builtin_function):
1556 Check for NULL return from make_builtin_function.
1557 (gcc::jit::recording::builtins_manager::make_builtin_function):
1558 Check for NULL return from get_type.
1560 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1562 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1563 creation code into...
1564 (gcc::jit::playback::context::convert_to_dso): New function.
1565 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1568 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1570 * jit-playback.c (gcc::jit::playback::context::compile): Use an
1571 auto_vec<const char *> rather than a const char *[20] for the
1572 top-level argv, and move the logic to build it to...
1573 (gcc::jit::playback::context::make_fake_args): New function.
1574 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1577 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1579 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1580 * jit-playback.c: Include new header jit-result.h.
1581 (gcc::jit::result::result): Move to new file jit-result.c.
1582 (gcc::jit::result::~result): Likewise.
1583 (gcc::jit::playback::result): Likewise.
1584 * jit-recording.h (class gcc::jit::result): Move to new
1585 header jit-result.h.
1586 * jit-result.c: New file, to contain...
1587 (gcc::jit::result::result): Move here from jit-playback.c,
1588 removing erroneous "playback" namespace from comment.
1589 (gcc::jit::result::~result): Likewise.
1590 (gcc::jit::playback::result): Likewise.
1591 * jit-result.h: New file, to contain...
1592 (class gcc::jit::result): Move from jit-recording.h.
1593 * libgccjit.c: Include jit-result.h.
1594 (gcc_jit_result_get_code): Update comment to reflect move
1596 (gcc_jit_result_release): Likewise.
1598 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1601 * docs/examples/tut04-toyvm/toyvm.c
1602 (toyvm_compiled_function): New typedef.
1603 (toyvm_compiled_func) Rename to...
1604 (toyvm_compiled_code) ...this.
1605 (struct toyvm_compiled_function): New struct.
1606 (toyvm_function_compile): Return a toyvm_compiled_function *
1607 rather than a toyvm_compiled_func, so that the caller can fully
1608 clean things up. Free "funcname".
1609 (test_script): Update for change to toyvm_function_compile.
1610 Clean up the toyvm_compiled_function.
1612 (docs/intro/tutorial04.rst): Update to reflect the above changes,
1613 and to better spell out the lifetime of the compiled code.
1615 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1619 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1620 context's new_function_type method, rather than directly creating
1621 a function_type instance.
1623 (gcc::jit::recording::context::new_function_type): New method,
1624 adapted from part of...
1625 (gcc::jit::recording::context::new_function_ptr_type): ...this.
1626 Update to call new_function_type.
1628 (gcc::jit::recording::context::new_function_type): New method.
1630 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1633 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1635 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1638 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1639 Convert param from const vec<playback::field *> & to
1640 const auto_vec<playback::field *> *.
1641 (gcc::jit::playback::context::new_function_type): Convert param
1642 "param_types" from vec<type *> * to const auto_vec<type *> *.
1643 (gcc::jit::playback::context::new_function): Convert param
1644 "params" from vec<param *> * to const auto_vec<param *> *.
1645 (gcc::jit::playback::context::build_call): Convert param "args"
1646 from vec<rvalue *> to const auto_vec<rvalue *> *.
1647 (gcc::jit::playback::context::new_call): Likewise.
1648 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1649 (wrapper_finalizer): New function.
1650 (gcc::jit::playback::wrapper::operator new): Call the finalizer
1651 variant of ggc_internal_cleared_alloc, supplying
1653 (gcc::jit::playback::function::finalizer): New.
1654 (gcc::jit::playback::block::finalizer): New.
1655 (gcc::jit::playback::source_file::finalizer): New.
1656 (gcc::jit::playback::source_line::finalizer): New.
1659 (gcc::jit::playback::context::new_function_type): Convert param
1660 "param_types" from vec<type *> * to const auto_vec<type *> *.
1661 (gcc::jit::playback::context::new_function): Convert param
1662 "params" from vec<param *> * to const auto_vec<param *> *.
1663 (gcc::jit::playback::context::new_call): Convert param
1664 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1665 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1666 (gcc::jit::playback::context::build_call): Likewise.
1667 (gcc::jit::playback::context): Convert fields "m_functions",
1668 "m_source_files", "m_cached_locations" from vec to auto_vec.
1669 (gcc::jit::playback::wrapper::finalizer): New virtual function.
1670 (gcc::jit::playback::compound_type::set_fields): Convert param fro
1671 const vec<playback::field *> & to
1672 const auto_vec<playback::field *> *.
1673 (gcc::jit::playback::function::finalizer): New.
1674 (gcc::jit::playback::block::finalizer): New.
1675 (gcc::jit::playback::source_file::finalizer): New.
1676 (gcc::jit::playback::source_line::finalizer): New.
1679 (gcc::jit::recording::function_type::replay_into): Convert local
1680 from a vec into an auto_vec.
1681 (gcc::jit::recording::fields::replay_into): Likewise.
1682 (gcc::jit::recording::function::replay_into): Likewise.
1683 (gcc::jit::recording::call::replay_into): Likewise.
1684 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1686 * jit-recording.h (gcc::jit::recording::context): Convert fields
1687 "m_mementos", "m_compound_types", "m_functions" from vec<> to
1689 (gcc::jit::recording::function_type::get_param_types): Convert
1690 return type from vec<type *> to const vec<type *> &.
1691 (gcc::jit::recording::function_type): Convert field
1692 "m_param_types" from a vec<> to an auto_vec<>.
1693 (gcc::jit::recording::fields): Likewise for field "m_fields".
1694 (gcc::jit::recording::function::get_params): Convert return type
1695 from vec <param *> to const vec<param *> &.
1696 (gcc::jit::recording::function): Convert fields "m_params",
1697 "m_locals", "m_blocks" from vec<> to auto_vec<>.
1698 (gcc::jit::recording::block): Likewise for field "m_statements".
1699 vec<> to auto_vec<>.
1700 (gcc::jit::recording::call): Likewise for field "m_args".
1701 (gcc::jit::recording::call_through_ptr): Likewise.
1703 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1706 * jit-recording.c (recording::function::validate): Convert
1707 "worklist" from vec<> to autovec<> to fix a leak.
1709 2014-11-11 David Malcolm <dmalcolm@redhat.com>
1711 * ChangeLog.jit: New.
1713 * Make-lang.in: New.
1715 * config-lang.in: New.
1716 * docs/Makefile: New.
1717 * docs/_build/texinfo/Makefile: New.
1718 * docs/_build/texinfo/factorial.png: New.
1719 * docs/_build/texinfo/libgccjit.texi: New.
1720 * docs/_build/texinfo/sum-of-squares.png: New.
1721 * docs/conf.py: New.
1722 * docs/examples/tut01-hello-world.c: New.
1723 * docs/examples/tut02-square.c: New.
1724 * docs/examples/tut03-sum-of-squares.c: New.
1725 * docs/examples/tut04-toyvm/Makefile: New.
1726 * docs/examples/tut04-toyvm/factorial.toy: New.
1727 * docs/examples/tut04-toyvm/fibonacci.toy: New.
1728 * docs/examples/tut04-toyvm/toyvm.c: New.
1729 * docs/index.rst: New.
1730 * docs/internals/index.rst: New.
1731 * docs/intro/factorial.png: New.
1732 * docs/intro/index.rst: New.
1733 * docs/intro/sum-of-squares.png: New.
1734 * docs/intro/tutorial01.rst: New.
1735 * docs/intro/tutorial02.rst: New.
1736 * docs/intro/tutorial03.rst: New.
1737 * docs/intro/tutorial04.rst: New.
1738 * docs/topics/contexts.rst: New.
1739 * docs/topics/expressions.rst: New.
1740 * docs/topics/functions.rst: New.
1741 * docs/topics/index.rst: New.
1742 * docs/topics/locations.rst: New.
1743 * docs/topics/objects.rst: New.
1744 * docs/topics/results.rst: New.
1745 * docs/topics/types.rst: New.
1746 * dummy-frontend.c: New.
1747 * jit-builtins.c: New.
1748 * jit-builtins.h: New.
1749 * jit-common.h: New.
1750 * jit-playback.c: New.
1751 * jit-playback.h: New.
1752 * jit-recording.c: New.
1753 * jit-recording.h: New.
1754 * libgccjit++.h: New.
1757 * libgccjit.map: New.
1760 2013-07-26 David Malcolm <dmalcolm@redhat.com>
1764 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1766 Copying and distribution of this file, with or without modification,
1767 are permitted in any medium without royalty provided the copyright
1768 notice and this notice are preserved.