1 2015-07-09 Andrew MacLeod <amacleod@redhat.com>
3 * dummy-frontend.c: Adjust includes for flags.h changes.
4 * jit-common.h: Likewise.
5 * jit-playback.c: Likewise.
7 2015-07-08 David Malcolm <dmalcolm@redhat.com>
10 * libgccjit.c (gcc_jit_context_new_field): Show name of field in
11 "unknown size" error message.
12 (gcc_jit_struct_set_fields): Show name of struct in error message.
13 (gcc_jit_context_new_global): Show name of global in
14 "unknown size" error message.
15 (gcc_jit_function_new_local): Likewise for local.
17 2015-07-07 Andrew MacLeod <amacleod@redhat.com>
19 * dummy-frontend.c: Adjust includes.
20 * jit-common.h: Likewise.
21 * jit-playback.c: Likewise.
23 2015-07-07 David Malcolm <dmalcolm@redhat.com>
26 * jit-recording.h: Within namespace gcc:jit::recording...
27 (type::has_known_size): New virtual function.
28 (struct_has_known_size): New function.
29 * libgccjit.c (gcc_jit_context_new_field): Verify that the type
31 (gcc_jit_context_new_global): Likewise.
32 (gcc_jit_function_new_local): Likewise.
34 2015-07-07 David Malcolm <dmalcolm@redhat.com>
37 * dummy-frontend.c (jit_langhook_type_for_mode): Ensure that we
38 handle modes QI, HI, SI, DI, TI.
40 2015-07-01 David Malcolm <dmalcolm@redhat.com>
43 * jit-playback.c (jit_mark_addressable): New function.
44 (gcc::jit::playback::lvalue::get_address): Call
45 jit_mark_addressable on the underlying tree.
47 2015-07-01 David Malcolm <dmalcolm@redhat.com>
49 * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
51 * docs/_build/texinfo/libgccjit.texi: Regenerate.
53 2015-07-01 David Malcolm <dmalcolm@redhat.com>
55 * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
56 Clarify lack of lifetime requirements on (const char *) parameter.
57 * docs/topics/expressions.rst
58 (gcc_jit_context_new_string_literal): Likewise.
59 (gcc_jit_context_new_global): Likewise.
60 * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
61 (gcc_jit_context_new_function): Likewise.
62 (gcc_jit_function_new_block): Likewise.
63 (gcc_jit_block_add_comment): Likewise.
64 * docs/topics/locations.rst (gcc_jit_context_new_location):
66 * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
67 (gcc_jit_context_new_struct_type): Likewise.
68 * docs/_build/texinfo/libgccjit.texi: Regenerate.
70 2015-06-30 David Malcolm <dmalcolm@redhat.com>
72 * docs/cp/topics/functions.rst (Blocks): Add switch statements to
73 list of ways to terminate a block.
74 (gccjit::block::end_with_switch): Add function description.
75 (gccjit::case_): Add class.
76 (gccjit::context::new_case): Add function description.
77 * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
78 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
79 * docs/topics/functions.rst (Blocks): Add switch statements to
80 list of ways to terminate a block.
81 (gcc_jit_block_end_with_switch): Add function description.
82 (gcc_jit_case): Add type.
83 (gcc_jit_context_new_case): Add function description.
84 (gcc_jit_case_as_object): Add function description.
85 * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
86 * docs/_build/texinfo/libgccjit.texi: Regenerate.
87 * jit-common.h (gcc::jit::recording::case_): Add forward decl.
88 (gcc::jit::playback::case_): Add forward decl.
89 * jit-playback.c (add_case): New function.
90 (gcc::jit::playback::block::add_switch): New function.
91 * jit-playback.h (gcc::jit::playback::case_): New struct.
92 (gcc::jit::playback::block::get_function): New method.
93 (gcc::jit::playback::block::add_switch): New method.
94 * jit-recording.c: Within namespace gcc::jit...
95 (recording::context::new_case): New method.
96 (recording::function::validate): Update for change to
98 (recording::block::end_with_switch): New method.
99 (recording::block::get_successor_blocks): Update to support an
100 arbitrary number of successor blocks.
101 (recording::block::dump_edges_to_dot): Likewise.
102 (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
103 (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
104 (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
105 (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
106 (recording::statement::get_successor_blocks): Update to support an
107 arbitrary number of successor blocks.
108 (recording::conditional::get_successor_blocks): Likewise.
109 (recording::jump::get_successor_blocks): Likewise.
110 (recording::return_::get_successor_blocks): Likewise.
111 (recording::case_::write_reproducer): New.
112 (recording::case_::make_debug_string): New.
113 (recording::switch_::switch_): New.
114 (recording::switch_::replay_into): New.
115 (recording::switch_::get_successor_blocks): New.
116 (recording::switch_::make_debug_string): New.
117 (recording::switch_::write_reproducer): New.
118 * jit-recording.h: Within namespace gcc::jit::recording...
119 (context::new_case): New.
120 (rvalue::is_constant): New.
121 (rvalue::get_wide_int): New.
122 (block::end_with_switch): New.
123 (block::get_successor_blocks): Update to support an arbitrary
124 number of successor blocks.
125 (memento_of_new_rvalue_from_const::is_constant): New.
126 (memento_of_new_rvalue_from_const::get_wide_int): New.
127 (statement::get_successor_blocks): Update to support an arbitrary
128 number of successor blocks.
129 (conditional::get_successor_blocks): Likewise.
130 (jump::get_successor_blocks): Likewise.
131 (return_::get_successor_blocks): Likewise.
132 (case_): New subclass of memento.
133 (switch_): New subclass of statement.
134 * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
135 (gccjit::context::new_case): New method.
136 (gccjit::block::end_with_switch): New method.
137 (gccjit::case_::case): New ctors.
138 (gccjit::case_::get_inner_case): New method.
139 * libgccjit.c: Include "typed-splay-tree.h"
140 (struct gcc_jit_case): New.
141 (gcc_jit_context_new_case): New function.
142 (gcc_jit_case_as_object): New function.
143 (valid_dest_for_switch): New function.
144 (valid_case_for_switch): New function.
145 (class api_call_validator): New class.
146 (class case_range_validator): New class.
147 (case_range_validator::case_range_validator): New.
148 (case_range_validator::validate): New.
149 (case_range_validator::case_compare): New.
150 (case_range_validator::get_wide_int): new.
151 (gcc_jit_block_end_with_switch): New.
152 * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
153 (gcc_jit_case): New typedef.
154 (gcc_jit_context_new_case): New function.
155 (gcc_jit_case_as_object): New function.
156 (gcc_jit_block_end_with_switch): New function.
157 (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
158 * libgccjit.map: Add gcc_jit_block_end_with_switch,
159 gcc_jit_case_as_object and gcc_jit_context_new_case.
161 2015-06-30 David Malcolm <dmalcolm@redhat.com>
164 * docs/cp/topics/contexts.rst
165 (gccjit::context::set_bool_allow_unreachable_blocks): New.
166 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
167 * docs/topics/contexts.rst (Options): Add notes discussing the
168 transition from enums to entrypoints for new options.
169 (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
170 * docs/_build/texinfo/libgccjit.texi: Regenerate.
171 * jit-common.h (gcc::jit::inner_bool_option): New enum.
172 * jit-recording.c: Within namespace gcc::jit...
173 (recording::context::context): Handle m_inner_bool_options.
174 (recording::context::set_inner_bool_option): New.
175 (inner_bool_option_reproducer_strings): New.
176 (recording::context::log_all_options): Log the "inner" bool
178 (recording::context::log_inner_bool_option): New.
179 (recording::context::dump_reproducer_to_file): Write initializers
180 for "inner" bool options.
181 (recording::function::validate): Don't check for block
182 reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
183 * jit-recording.h: Within namespace gcc::jit...
184 (recording::context::set_inner_bool_option): New.
185 (recording::context::get_inner_bool_option): New.
186 (recording::context::log_inner_bool_option): New.
187 (recording::context::m_inner_bool_options): New.
189 (gccjit::context::set_bool_allow_unreachable_blocks): New.
191 (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
192 * libgccjit.h: Add note about options present in the
193 initial release of libgccjit.
194 (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
196 (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
198 * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
199 (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
202 2015-06-30 David Malcolm <dmalcolm@redhat.com>
205 * docs/cp/topics/contexts.rst (Additional command-line options):
207 * docs/topics/compatibility.rst: New file.
208 * docs/topics/contexts.rst (Additional command-line options): New
210 * docs/topics/index.rst: Add compatibility.rst.
211 * docs/_build/texinfo/libgccjit.texi: Regenerate.
212 * jit-playback.c (make_fake_args): Add call to
213 append_command_line_options.
214 * jit-recording.c: Within namespace gcc::jit...
215 (recording::context::~context): Free the optnames within
216 m_command_line_options.
217 (recording::context::set_bool_option): Likewise.
218 (recording::context::add_command_line_option): New method.
219 (recording::context::append_command_line_options): New method.
220 (recording::context::dump_reproducer_to_file): Add command-line
222 * jit-recording.h: Within namespace gcc::jit...
223 (recording::context::add_command_line_option): New method.
224 (recording::context::append_command_line_options): New method.
225 (recording::context::m_command_line_options): New field.
226 * libgccjit++.h (gccjit::context::add_command_line_option): New
228 * libgccjit.c (gcc_jit_context_add_command_line_option): New API
230 * libgccjit.h (gcc_jit_context_add_command_line_option): New API
232 (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
234 * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
235 LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
237 2015-06-30 David Malcolm <dmalcolm@redhat.com>
240 (gcc::jit::recording::context::dump_reproducer_to_file):
241 Add pragma to generated reproducers to disable -Wunused-variable.
242 Fix handling of NULL string options.
244 2015-06-30 David Malcolm <dmalcolm@redhat.com>
246 * docs/cp/topics/expressions.rst: Remove stray semicolon.
247 * docs/cp/topics/functions.rst: Remove stray backslash.
248 * docs/_build/texinfo/libgccjit.texi: Regenerate.
250 2015-06-25 Andrew MacLeod <amacleod@redhat.com>
252 * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
253 * jit-playback.c: Likewise.
255 2015-06-25 Andrew Macleod <amacleod@redhat.com>
257 * jit-common.h: Don't include alias.h.
259 2015-06-17 David Malcolm <dmalcolm@redhat.com>
261 * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
262 is for the correct struct.
263 (gcc_jit_rvalue_access_field): Likewise.
265 2015-06-17 Andrew MacLeod <amacleod@redhat.com>
267 * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
268 * jit-common.h: Likewise.
269 * jit-playback.c: Likewise.
271 2015-06-16 David Malcolm <dmalcolm@redhat.com>
274 * jit-recording.c: Within namespace gcc::jit::recording::
275 (rvalue::get_debug_string_parens): New function.
276 (binary_op::make_debug_string): Update to mimic C precedence
278 (binary_op_precedence): New array.
279 (binary_op::get_precedence): New function.
280 (comparison::make_debug_string): Update to mimic C precedence
282 (comparison_precedence): New array.
283 (comparison::get_precedence): New function.
284 (cast::make_debug_string): Update to mimic C precedence rules.
285 (call::make_debug_string): Likewise.
286 (call_through_ptr::make_debug_string): Likewise.
287 (array_access::make_debug_string): Likewise.
288 (access_field_of_lvalue::make_debug_string): Likewise.
289 (access_field_rvalue::make_debug_string): Likewise.
290 (dereference_field_rvalue::make_debug_string): Likewise.
291 (dereference_rvalue::make_debug_string): Likewise.
292 (get_address_of_lvalue::make_debug_string): Likewise.
293 * jit-recording.h: Within namespace gcc::jit::recording::
294 (precedence): New enum.
295 (rvalue::rvalue): Initialize field "m_parenthesized_string".
296 (rvalue::get_debug_string_parens): New method.
297 (rvalue::get_precedence): New pure virtual function.
298 (rvalue::m_parenthesized_string): New field.
299 (param::get_precedence): New function.
300 (global::get_precedence): New function.
301 (memento_of_new_rvalue_from_const::get_precedence): New function.
302 (memento_of_new_string_literal::get_precedence): New function.
303 (unary_op::get_precedence): New function.
304 (binary_op::get_precedence): New function.
305 (comparison::get_precedence): New function.
306 (cast::get_precedence): New function.
307 (call::get_precedence): New function.
308 (call_through_ptr::get_precedence): New function.
309 (array_access::get_precedence): New function.
310 (access_field_of_lvalue::get_precedence): New function.
311 (access_field_rvalue::get_precedence): New function.
312 (dereference_field_rvalue::get_precedence): New function.
313 (dereference_rvalue::get_precedence): New function.
314 (get_address_of_lvalue::get_precedence): New function.
315 (local::get_precedence): New function.
317 2015-06-09 Matthias Klose <doko@ubuntu.com>
319 * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
321 2015-06-08 Andrew MacLeod <amacleod@redhat.com>
323 * dummy-frontend.c : Adjust include files.
324 * jit-common.h : Likewise.
325 * jit-playback.c : Likewise.
327 2015-06-05 David Malcolm <dmalcolm@redhat.com>
330 (jit_langhook_post_compilation_parsing_cleanups): Remove.
331 (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
332 * jit-playback.c (gcc::jit::playback::context::new_global): Add
333 call to varpool_node::finalize_decl.
334 (gcc::jit::playback::context::finalize_global_decls): Remove.
336 (gcc::jit::playback::context::finalize_global_decls): Remove.
338 2015-06-05 David Malcolm <dmalcolm@redhat.com>
340 * dummy-frontend.c (jit_langhook_write_globals): Rename to...
341 (jit_langhook_post_compilation_parsing_cleanups): ...this, and
342 eliminate calls to finalize_compilation_unit and
343 write_global_decls_2.
344 (LANG_HOOKS_WRITE_GLOBALS): Rename to...
345 (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
346 redirect from jit_langhook_write_globals to
347 jit_langhook_post_compilation_parsing_cleanups.
349 (gcc::jit::playback::context::write_global_decls_1): Rename to...
350 (gcc::jit::playback::context::finalize_global_decls): ...this.
351 (gcc::jit::playback::context::write_global_decls_1): Delete.
353 (gcc::jit::playback::context::write_global_decls_1): Rename to...
354 (gcc::jit::playback::context::finalize_global_decls): ...this.
355 (gcc::jit::playback::context::write_global_decls_1): Delete.
357 2015-06-04 Andrew MacLeod <amacleod@redhat.com>
359 * dummy-frontend.c: Adjust includes for restructured coretypes.h.
360 * jit-common.h: Likewise.
361 * jit-playback.c: Likewise.
363 2015-05-12 David Malcolm <dmalcolm@redhat.com>
365 * jit-builtins.c: Include vec.h before target.h.
367 2015-04-27 Jim Wilson <jim.wilson@linaro.org>
369 * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
372 2015-04-09 David Malcolm <dmalcolm@redhat.com>
375 * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
376 and paste error in description of gccjit::context::one.
377 * docs/topics/expressions.rst (Simple expressions): Likewise in
378 description of gcc_jit_context_one.
379 * docs/_build/texinfo/libgccjit.texi: Regenerate.
381 2015-03-13 Uros Bizjak <ubizjak@gmail.com>
383 * jit-recording.c (dump::write): Also check vasprintf return value.
384 (recording::context::add_error_va): Ditto.
385 (recording::string::from_printf): Ditto.
387 2015-03-13 David Malcolm <dmalcolm@redhat.com>
389 * docs/internals/index.rst (Packaging notes): New section.
390 * docs/_build/texinfo/libgccjit.texi: Regenerate.
392 2015-03-05 David Malcolm <dmalcolm@redhat.com>
394 * docs/cp/intro/tutorial03.rst: Add missing arguments to
395 gccjit::block::end_with_conditional call. Add on_true/on_false
396 comments. Tweak the wording.
397 * docs/intro/tutorial03.rst: Add missing arguments to
398 gcc_jit_block_end_with_conditional call. Add some clarifying
400 * docs/topics/compilation.rst: Tweak the wording to avoid an
401 ambiguous use of "this".
402 * docs/topics/contexts.rst: Fix a typo.
403 * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
405 * docs/_build/texinfo/libgccjit.texi: Regenerate.
407 2015-02-24 Thomas Schwinge <thomas@codesourcery.com>
410 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
411 (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
412 (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
413 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
414 (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
415 (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
417 2015-02-04 David Malcolm <dmalcolm@redhat.com>
420 * docs/conf.py (html_theme): Change from 'pyramid'
423 2015-02-04 David Malcolm <dmalcolm@redhat.com>
425 * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
427 * docs/_build/texinfo/libgccjit.texi: Regenerate.
429 2015-02-03 David Malcolm <dmalcolm@redhat.com>
431 * jit-logging.h (gcc::jit::log_user::log): Make const.
432 * jit-recording.c (gcc::jit::recording::context::set_str_option):
433 Log the new value of the option.
434 (gcc::jit::recording::context::set_int_option): Likewise.
435 (gcc::jit::recording::context::set_bool_option): Likewise.
436 (gcc::jit::recording::context::compile): Log the value of all
438 (gcc::jit::recording::context::compile_to_file): Likewise.
439 (gcc::jit::recording::context::log_all_options): New function.
440 (gcc::jit::recording::context::log_str_option): New function.
441 (gcc::jit::recording::context::log_int_option): New function.
442 (gcc::jit::recording::context::log_bool_option): New function.
443 * jit-recording.h (gcc::jit::recording::context::log_all_options):
445 (gcc::jit::recording::context::log_str_option): New function.
446 (gcc::jit::recording::context::log_int_option): New function.
447 (gcc::jit::recording::context::log_bool_option): New function.
448 * docs/internals/test-hello-world.exe.log.txt: Update for above
450 * docs/_build/texinfo/libgccjit.texi: Regenerate.
452 2015-02-03 David Malcolm <dmalcolm@redhat.com>
455 * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
456 (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
457 * jit-playback.c: Include gcc.h.
458 (gcc::jit::playback::context::compile): Move mutex acquisition
459 to before the call to make_fake_args.
460 (append_arg_from_driver): New function.
461 (gcc::jit::playback::context::make_fake_args): On the first call,
462 call into driver_get_configure_time_options to get configure-time
463 default options and cache them. Add them to the args for
465 * jit-spec.c: New source file.
466 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
468 * docs/_build/texinfo/libgccjit.texi: Regenerate.
470 2015-02-02 David Malcolm <dmalcolm@redhat.com>
473 * dummy-frontend.c (jit_langhook_type_for_mode): Support
474 TYPE_MODE (long_long_integer_type_node).
476 2015-01-27 David Malcolm <dmalcolm@redhat.com>
478 * docs/internals/test-hello-world.exe.log.txt: Add example version
480 * docs/_build/texinfo/libgccjit.texi: Regenerate.
481 * jit-common.h (gcc::jit::dump::get_file): New accessor.
482 * jit-logging.c: Include toplev.h.
483 (gcc::jit::logger::logger): Log the GCC version.
484 * jit-recording.c: Include toplev.h.
485 (gcc:jit::recording::context::dump_reproducer_to_file): Log the
488 2015-01-26 David Malcolm <dmalcolm@redhat.com>
490 * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
491 * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
492 error buffer is only valid until the next call to the context.
493 * docs/_build/texinfo/libgccjit.texi: Regenerate.
494 * libgccjit.h (gcc_jit_context_get_first_error): Reword the
495 comment to omit mention of compiling.
496 (gcc_jit_context_get_last_error): The error buffer is only valid
497 until the next call to the context.
499 2015-01-26 David Malcolm <dmalcolm@redhat.com>
502 * config-lang.in (compilers): Drop "libgccjit.so".
504 2015-01-23 David Malcolm <dmalcolm@redhat.com>
507 * jit-playback.c (gcc::jit::playback::context::compile): Construct
508 toplev instances with init_signals=false.
510 2015-01-19 David Malcolm <dmalcolm@redhat.com>
512 * docs/cp/topics/results.rst: Rename to...
513 * docs/cp/topics/compilation.rst: ...this, and add section on
514 ahead-of-time compilation.
515 * docs/cp/topics/index.rst: Update for renaming of results.rst
517 * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
519 * docs/examples/tut05-bf.c: New file, implementing a compiler
521 * docs/internals/test-hello-world.exe.log.txt: Update to reflect
522 changes to logger output.
523 * docs/intro/index.rst: Add tutorial05.rst
524 * docs/intro/tutorial05.rst: New file.
525 * docs/topics/results.rst: Rename to...
526 * docs/topics/compilation.rst: ...this, and add section on
527 ahead-of-time compilation.
528 * docs/topics/index.rst: Update for renaming of results.rst to
530 * docs/_build/texinfo/libgccjit.texi: Regenerate.
531 * jit-playback.c (gcc::jit::playback::context::compile): Convert
532 return type from result * to void. Move the code to convert to
533 dso and dlopen the result to a new pure virtual "postprocess"
535 (gcc::jit::playback::compile_to_memory::compile_to_memory): New
537 (gcc::jit::playback::compile_to_memory::postprocess): New
538 function, based on playback::context::compile.
539 (gcc::jit::playback::compile_to_file::compile_to_file): New
541 (gcc::jit::playback::compile_to_file::postprocess): New function.
542 (gcc::jit::playback::compile_to_file::copy_file): New function.
543 (gcc::jit::playback::context::convert_to_dso): Move internals
545 (gcc::jit::playback::context::invoke_driver): New method. Add
546 "-shared" and "-c" options to driver's argv as needed.
547 * jit-playback.h: Include "timevar.h".
548 (gcc::jit::playback::context::compile): Convert return type from
550 (gcc::jit::playback::context::postprocess): New pure virtual
551 function, making this an abstract base class.
552 (gcc::jit::playback::context::get_tempdir): New accessor.
553 (gcc::jit::playback::context::invoke_driver): New function.
554 (class gcc::jit::playback::compile_to_memory): New subclass of
556 (class gcc::jit::playback::compile_to_file): Likewise.
557 * jit-recording.c (gcc::jit::recording::context::compile): Use a
558 playback::compile_to_memory, and extract its result.
559 (gcc::jit::recording::context::compile_to_file): New function.
560 * jit-recording.h (gcc::jit::recording::context::compile_to_file):
562 * libgccjit++.h (gccjit::context::compile_to_file): New method.
563 * libgccjit.c (gcc_jit_context_compile): Update log message to
564 clarify that this is an in-memory compile.
565 (gcc_jit_context_compile_to_file): New function.
566 * libgccjit.h (gcc_jit_context): Clarify that you can compile
567 a context more than once, and that you can compile to a file
568 as well as to memory.
569 (gcc_jit_result): Clarify that this is the result of an
570 in-memory compilation.
571 (gcc_jit_context_compile): Clarify that you can compile, and that
572 this is an in-memory compilation.
573 (enum gcc_jit_output_kind): New enum.
574 (gcc_jit_context_compile_to_file): New function.
575 (gcc_jit_context_enable_dump): Clarify comment to cover both forms
577 * libgccjit.map (gcc_jit_context_compile_to_file): New API
579 * notes.txt: Update to show the playback::context::postprocess
582 2015-01-19 David Malcolm <dmalcolm@redhat.com>
585 (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
586 Add missing format string.
588 2015-01-16 David Malcolm <dmalcolm@redhat.com>
590 * Make-lang.in (lang_checks_parallelized): Add "check-jit".
591 (check_jit_parallelize): Set this to an arbitrary value (10).
593 2015-01-16 Jakub Jelinek <jakub@redhat.com>
595 * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
597 (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
599 * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
602 2015-01-15 Richard Sandiford <richard.sandiford@arm.com>
604 Update copyright years in docs/.
606 2015-01-15 David Malcolm <dmalcolm@redhat.com>
608 * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
609 lvalue and the rvalue are of compatible type.
611 2015-01-13 David Malcolm <dmalcolm@redhat.com>
613 * docs/cp/topics/contexts.rst (Debugging): Add
614 gccjit::context::dump_reproducer_to_file.
615 * docs/internals/index.rst (Design notes): New section,
616 discussing input validation and
617 gcc_jit_context_dump_reproducer_to_file.
618 * docs/topics/contexts.rst (Debugging): Add
619 gcc_jit_context_dump_reproducer_to_file.
620 * docs/_build/texinfo/libgccjit.texi: Regenerate.
621 * jit-common.h (gcc::jit::dump::get_context): New accessor.
622 * jit-recording.c: Include "hash-map.h".
623 Within namespace ::gcc::jit...
624 (dump::write): Flush each line.
625 (dump::make_location): Pass false for new param "created_by_user".
626 (class allocator): New class.
627 (allocator::~allocator): New function.
628 (allocator::xstrdup_printf): New function.
629 (allocator::xstrdup_printf_va): New function.
630 (class reproducer): New subclass of dump.
631 (reproducer::reproducer): New function.
632 (reproducer::write_params): New function.
633 (reproducer::write_args): New function.
634 (reproducer::make_identifier): New function.
635 (reproducer::make_tmp_identifier): New function.
636 (reproducer::get_identifier): New pair of functions.
637 (reproducer::get_identifier_as_rvalue): New function.
638 (reproducer::get_identifier_as_lvalue): New function.
639 (reproducer::get_identifier_as_type): New function.
640 (reproducer::xstrdup_printf): New function.
641 (recording::context::context): Initialize m_toplevel_ctxt.
642 (recording::context::new_location): Add param created_by_user.
643 (str_option_reproducer_strings): New table of strings.
644 (int_option_reproducer_strings): Likewise.
645 (bool_option_reproducer_strings): Likewise.
646 (get_type_enum_strings): Likewise.
647 (names_of_function_kinds): Likewise.
648 (global_kind_reproducer_strings): Likewise.
649 (unary_op_reproducer_strings): Likewise.
650 (binary_op_reproducer_strings): Likewise.
651 (comparison_reproducer_strings): Likewise.
652 Within namespace ::gcc::jit::recording::...
653 (context::dump_reproducer_to_file): New function.
654 (string::write_reproducer): Likewise.
655 (location::write_reproducer): Likewise.
656 (type::access_as_type): Likewise.
657 (memento_of_get_type::write_reproducer): Likewise.
658 (memento_of_get_pointer::write_reproducer): Likewise.
659 (memento_of_get_const::write_reproducer): Likewise.
660 (memento_of_get_volatile::write_reproducer): Likewise.
661 (array_type::write_reproducer): Likewise.
662 (function_type::write_reproducer): Likewise.
663 (function_type::write_deferred_reproducer): Likewise.
664 (field::write_reproducer): Likewise.
665 (struct_::access_as_type): Likewise.
666 (struct_::write_reproducer): Likewise.
667 (union_::write_reproducer): Likewise.
668 (fields::write_reproducer): Likewise.
669 (rvalue::access_as_rvalue): Likewise.
670 (lvalue::access_as_rvalue): Likewise.
671 (lvalue::access_as_lvalue): Likewise.
672 (param::access_as_rvalue): Likewise.
673 (param::access_as_lvalue): Likewise.
674 (param::write_reproducer): Likewise.
675 (function::write_reproducer): Likewise.
676 (block::write_reproducer): Likewise.
677 (global::write_reproducer): Likewise.
678 (memento_of_new_rvalue_from_const <int>::write_reproducer):
680 (memento_of_new_rvalue_from_const <long>::write_reproducer):
682 (memento_of_new_rvalue_from_const <double>::write_reproducer):
684 (memento_of_new_rvalue_from_const <void *>::write_reproducer):
686 (memento_of_new_string_literal::write_reproducer): Likewise.
687 (unary_op::write_reproducer): Likewise.
688 (binary_op::write_reproducer): Likewise.
689 (comparison::write_reproducer): Likewise.
690 (cast::write_reproducer): Likewise.
691 (call::write_reproducer): Likewise.
692 (call_through_ptr::write_reproducer): Likewise.
693 (array_access::write_reproducer): Likewise.
694 (access_field_of_lvalue::write_reproducer): Likewise.
695 (access_field_rvalue::write_reproducer): Likewise.
696 (dereference_field_rvalue::write_reproducer): Likewise.
697 (dereference_rvalue::write_reproducer): Likewise.
698 (get_address_of_lvalue::write_reproducer): Likewise.
699 (local::write_reproducer): Likewise.
700 (eval::write_reproducer): Likewise.
701 (assignment::write_reproducer): Likewise.
702 (assignment_op::write_reproducer): Likewise.
703 (comment::write_reproducer): Likewise.
704 (conditional::write_reproducer): Likewise.
705 (jump::write_reproducer): Likewise.
706 (return_::write_reproducer): Likewise.
707 * jit-recording.h (gcc::jit::reproducer): New forward declararion.
708 Within namespace ::gcc::jit::recording::...
709 (context::new_location): Add "created_by_user" param.
710 (context::dump_reproducer_to_file): New method.
711 (context::m_toplevel_ctxt): New field.
712 (memento::write_reproducer): New pure virtual function.
713 (memento::dyn_cast_location): New virtual function.
714 (string::write_reproducer):
715 (location::location): Add "created_by_user" param.
716 (location::dyn_cast_location): New function.
717 (location::created_by_user): New accessor.
718 (location::write_reproducer): New function.
719 (location::m_created_by_user): New field.
720 (type::access_as_type): New virtual function.
721 (location::write_reproducer): Likewise.
722 (type::access_as_type): Likewise.
723 (memento_of_get_type::write_reproducer): Likewise.
724 (memento_of_get_pointer::write_reproducer): Likewise.
725 (memento_of_get_const::write_reproducer): Likewise.
726 (memento_of_get_volatile::write_reproducer): Likewise.
727 (array_type::write_reproducer): Likewise.
728 (function_type::write_reproducer): Likewise.
729 (function_type::write_deferred_reproducer): Likewise.
730 (field::write_reproducer): Likewise.
731 (struct_::access_as_type): Likewise.
732 (struct_::write_reproducer): Likewise.
733 (union_::write_reproducer): Likewise.
734 (union_::m_fields): Remove stray unused field.
735 (fields::length): New accessor.
736 (fields::get_field): New accessor.
737 (fields::write_reproducer): New function.
738 (rvalue::access_as_rvalue): Likewise.
739 (lvalue::access_as_rvalue): Likewise.
740 (lvalue::access_as_lvalue): Likewise.
741 (param::access_as_rvalue): Likewise.
742 (param::access_as_lvalue): Likewise.
743 (param::write_reproducer): Likewise.
744 (function::write_reproducer): Likewise.
745 (block::write_reproducer): Likewise.
746 (global::write_reproducer): Likewise.
747 (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
749 (memento_of_new_string_literal::write_reproducer): Likewise.
750 (unary_op::write_reproducer): Likewise.
751 (binary_op::write_reproducer): Likewise.
752 (comparison::write_reproducer): Likewise.
753 (cast::write_reproducer): Likewise.
754 (call::write_reproducer): Likewise.
755 (call_through_ptr::write_reproducer): Likewise.
756 (array_access::write_reproducer): Likewise.
757 (access_field_of_lvalue::write_reproducer): Likewise.
758 (access_field_rvalue::write_reproducer): Likewise.
759 (dereference_field_rvalue::write_reproducer): Likewise.
760 (dereference_rvalue::write_reproducer): Likewise.
761 (get_address_of_lvalue::write_reproducer): Likewise.
762 (local::write_reproducer): Likewise.
763 (eval::write_reproducer): Likewise.
764 (assignment::write_reproducer): Likewise.
765 (assignment_op::write_reproducer): Likewise.
766 (comment::write_reproducer): Likewise.
767 (conditional::write_reproducer): Likewise.
768 (jump::write_reproducer): Likewise.
769 (return_::write_reproducer): Likewise.
770 * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
771 * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
772 param "created_by_user".
773 (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
774 * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
776 * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
779 2015-01-12 David Malcolm <dmalcolm@redhat.com>
781 * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
782 (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
784 (gcc::jit::rvalue_usage_validator::visit): New function.
785 (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
787 (gcc::jit::recording::rvalue::set_scope): New function.
788 (gcc::jit::recording::function::function): Call set_scope on each
789 param, issuing errors for any params that already have a function.
790 (gcc::jit::recording::block::add_eval): Return the new statement;
791 update the comment given that some error-checking now happens after
793 (gcc::jit::recording::block::add_assignment): Likewise.
794 (gcc::jit::recording::block::add_assignment_op): Likewise.
795 (gcc::jit::recording::block::add_comment): Likewise.
796 (gcc::jit::recording::block::end_with_conditional): Likewise.
797 (gcc::jit::recording::block::end_with_jump): Likewise.
798 (gcc::jit::recording::block::end_with_return): Likewise.
799 (gcc::jit::recording::block::validate): Add a comment.
800 (gcc::jit::recording::unary_op::visit_children): New function.
801 (gcc::jit::recording::binary_op::visit_children): New function.
802 (gcc::jit::recording::comparison::visit_children): New function.
803 (gcc::jit::recording::cast::visit_children): New function.
804 (gcc::jit::recording::call::visit_children): New function.
805 (gcc::jit::recording::call_through_ptr::visit_children): New function.
806 (gcc::jit::recording::array_access::visit_children): New function.
807 (gcc::jit::recording::access_field_of_lvalue::visit_children): New
809 (gcc::jit::recording::access_field_rvalue::visit_children): New
811 (gcc::jit::recording::dereference_field_rvalue::visit_children):
813 (gcc::jit::recording::dereference_rvalue::visit_children): New
815 (gcc::jit::recording::get_address_of_lvalue::visit_children): New
817 * jit-recording.h: Within namespace gcc::jit::recording...
818 (class rvalue_visitor): New.
819 (rvalue::rvalue): Initialize m_scope.
820 (rvalue::get_loc): New accessor.
821 (rvalue::verify_valid_within_stmt): New function.
822 (rvalue::visit_children): New pure virtual function.
823 (rvalue::set_scope): New function.
824 (rvalue::get_scope): New function.
825 (rvalue::dyn_cast_param): New function.
826 (rvalue::m_scope): New field.
827 (param::visit_children): New empty function.
828 (param::dyn_cast_param): New function.
829 (function::get_loc): New function.
830 (block::add_eval): Return the new statement.
831 (block::add_assignment): Likewise.
832 (block::add_assignment_op): Likewise.
833 (block::add_comment): Likewise.
834 (block::end_with_conditional): Likewise.
835 (block::end_with_jump): Likewise.
836 (block::end_with_return): Likewise.
837 (global::visit_children): New function.
838 (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
840 (memento_of_new_string_literal::visit_children): New function.
841 (unary_op::visit_children): New function.
842 (binary_op::visit_children): New function.
843 (comparison::visit_children): New function.
844 (cast::visit_children): New function.
845 (call::visit_children): New function.
846 (call_through_ptr::visit_children): New function.
847 (array_access::visit_children): New function.
848 (access_field_of_lvalue::visit_children): New function.
849 (access_field_rvalue::visit_children): New function.
850 (dereference_field_rvalue::visit_children): New function.
851 (dereference_rvalue::visit_children): New function.
852 (get_address_of_lvalue::visit_children): New function.
853 (local::local): Call set_scope.
854 (local::visit_children): New function.
855 (statement::get_block): Make public.
856 * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
857 (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
858 (gcc_jit_context_new_function): Verify that each param has
859 not yet been used for creating another function.
860 (gcc_jit_block_add_eval): After creating the stmt, verify
861 that the rvalue expression tree is valid to use within it.
862 (gcc_jit_block_add_assignment): Likewise for the lvalue and
863 rvalue expression trees.
864 (gcc_jit_block_add_assignment_op): Likewise.
865 (gcc_jit_block_end_with_conditional): Likewise for the boolval
867 (gcc_jit_block_end_with_return): Likewise for the rvalue
869 (gcc_jit_block_end_with_void_return): Remove return of "void",
870 now that block::end_with_return is now non-void.
872 2015-01-12 David Malcolm <dmalcolm@redhat.com>
874 * jit-playback.c (gcc::jit::playback::context::read_dump_file):
875 Add missing fclose on error-handling path.
877 2015-01-12 David Malcolm <dmalcolm@redhat.com>
879 * docs/cp/topics/expressions.rst (Global variables): Add
880 enum gcc_jit_global_kind param to gccjit::context::new_global.
881 * docs/topics/expressions.rst (Global variables): Likewise.
882 Document the new enum.
883 * docs/topics/results.rst (Compilation results): Document
885 * docs/_build/texinfo/libgccjit.texi: Regenerate.
886 * dummy-frontend.c (jit_langhook_write_globals): Call into the
887 playback context's write_global_decls_1 and write_global_decls_2
888 before and after calling symtab->finalize_compilation_unit ().
889 * jit-playback.c: Include "debug.h".
890 (gcc::jit::playback::context::new_global): Add "kind" param and
891 use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
892 underlying VAR_DECL. Call varpool_node::get_create on the
893 VAR_DECL, and add it to m_globals.
894 (gcc::jit::playback::context::write_global_decls_1): New function.
895 (gcc::jit::playback::context::write_global_decls_2): New function.
896 * jit-playback.h (gcc::jit::playback::context::context): Call
898 (gcc::jit::playback::context::new_global): Add "kind" param.
899 (gcc::jit::playback::context::write_global_decls_1): New function.
900 (gcc::jit::playback::context::write_global_decls_2): New function.
901 (gcc::jit::playback::context::m_globals): New field.
902 * jit-recording.c (gcc::jit::recording::context::context):
903 Initialize m_globals.
904 (gcc::jit::recording::context::new_global): Add param "kind".
905 Add the new global to m_globals.
906 (gcc::jit::recording::context::dump_to_file): Dump the globals.
907 (gcc::jit::recording::global::replay_into): Add field m_kind.
908 (gcc::jit::recording::global::write_to_dump): New override.
909 * jit-recording.h (gcc::jit::recording::context::new_global): Add
911 (gcc::jit::recording::context::m_globals): New field.
912 (gcc::jit::recording::global::global): Add param kind.
913 (gcc::jit::recording::global::write_to_dump): New override.
914 (gcc::jit::recording::global::m_kind): New field.
915 * jit-result.c (gcc::jit::result::get_global): New function.
916 * jit-result.h (gcc::jit::result::get_global): New function.
917 * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
918 * libgccjit.c (gcc_jit_context_new_global): Likewise.
919 (gcc_jit_result_get_global): New API entrypoint.
920 * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
921 (enum gcc_jit_global_kind): New enum.
922 (gcc_jit_context_new_global): API change: add "kind" param.
923 * libgccjit.map (gcc_jit_result_get_global): New symbol.
925 2015-01-09 David Malcolm <dmalcolm@redhat.com>
927 * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
928 "symtab.h", "inchash.h". Move include of "hash-set.h" much
930 * jit-builtins.c: Remove redundant includes of "opts.h" and
932 * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
933 "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
934 * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
935 "statistics.h", "vec.h", "double-int.h", "real.h",
936 "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
937 "inchash.h", "fold-const.h". Move include of "hash-set.h" to
939 * jit-recording.c: Remove redundant includes of "opts.h" and
942 2015-01-09 David Malcolm <dmalcolm@redhat.com>
944 * docs/cp/topics/expressions.rst (Simple expressions): Use
945 ":c:type:" for C types. Document new overload of
946 gcc::jit::context::new_rvalue.
947 * docs/topics/expressions.rst (Simple expressions): Use
948 ":c:type:" for C types. Document new entrypoint
949 gcc_jit_context_new_rvalue_from_long.
950 * docs/_build/texinfo/libgccjit.texi: Regenerate.
951 * jit-playback.c: Within namespace gcc::jit::playback...
952 (context::new_rvalue_from_int): Eliminate in favor of...
953 (context::new_rvalue_from_const <int>): ...this.
954 (context::new_rvalue_from_double): Eliminate in favor of...
955 (context::new_rvalue_from_const <double>): ...this.
956 (context::new_rvalue_from_const <long>): New.
957 (context::new_rvalue_from_ptr): Eliminate in favor of...
958 (context::new_rvalue_from_const <void *>): ...this.
959 * jit-playback.h: Within namespace gcc::jit::playback...
960 (context::new_rvalue_from_int): Eliminate in favor of...
961 (context::new_rvalue_from_const <HOST_TYPE>): ...this.
962 (context::new_rvalue_from_double): Likewise.
963 (context::new_rvalue_from_ptr): Likewise.
964 * jit-recording.c: Within namespace gcc::jit::recording...
965 (context::new_rvalue_from_int): Eliminate.
966 (context::new_rvalue_from_double): Likewise.
967 (context::new_rvalue_from_ptr): Likewise.
968 (class memento_of_new_rvalue_from_const <int>):
969 Add explicit specialization.
970 (class memento_of_new_rvalue_from_const <long>):
972 (class memento_of_new_rvalue_from_const <double>):
974 (class memento_of_new_rvalue_from_const <void *>):
976 (memento_of_new_rvalue_from_int::replay_into):
978 (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
980 (memento_of_new_rvalue_from_double::replay_into):
982 (memento_of_new_rvalue_from_ptr::replay_into):
983 ...and this to be deleted.
984 (memento_of_new_rvalue_from_int::make_debug_string):
986 (memento_of_new_rvalue_from_const <int>::make_debug_string):
988 (memento_of_new_rvalue_from_double::make_debug_string):
990 (memento_of_new_rvalue_from_const <double>::make_debug_string):
992 (memento_of_new_rvalue_from_ptr::make_debug_string)
994 (memento_of_new_rvalue_from_const <void *>::make_debug_string):
996 (memento_of_new_rvalue_from_const <long>::make_debug_string):
998 * jit-recording.h: Within namespace gcc::jit::recording...
999 (context::new_rvalue_from_int): Eliminate.
1000 (context::new_rvalue_from_double): Likewise.
1001 (context::new_rvalue_from_ptr): Likewise, all in favor of...
1002 (context::new_rvalue_from_const <HOST_TYPE>): New family of
1004 (class memento_of_new_rvalue_from_int): Eliminate.
1005 (class memento_of_new_rvalue_from_double): Likewise.
1006 (class memento_of_new_rvalue_from_ptr): Likewise.
1007 (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
1008 of rvalue subclasses.
1009 * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
1011 * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
1012 rewriting of recording::context::new_rvalue_from_int to
1013 recording::context::new_rvalue_from_const <int>.
1014 (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
1015 (gcc_jit_context_new_rvalue_from_double): Update for
1016 rewriting of recording::context::new_rvalue_from_double to
1017 recording::context::new_rvalue_from_const <double>.
1018 (gcc_jit_context_new_rvalue_from_ptr): Update for
1019 rewriting of recording::context::new_rvalue_from_ptr to
1020 recording::context::new_rvalue_from_const <void *>.
1021 * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
1023 * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
1025 2015-01-09 David Malcolm <dmalcolm@redhat.com>
1028 * docs/internals/test-hello-world.exe.log.txt: Update, the log now
1029 shows tempdir creation/cleanup.
1030 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1031 * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
1032 to the list of subclasses in the comment.
1033 * jit-playback.c (gcc::jit::playback::context::context): Add a
1034 comment clarifying when the tempdir gets cleaned up.
1035 (gcc::jit::playback::context::compile): Pass the context's logger,
1036 if any, to the tempdir.
1037 (gcc::jit::playback::context::dlopen_built_dso): When creating the
1038 gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
1039 over ownership of the tempdir to it.
1040 * jit-result.c: Include "jit-tempdir.h".
1041 (gcc::jit::result::result): Add tempdir param, saving it as
1043 (gcc::jit::result::~result): Delete m_tempdir.
1044 * jit-result.h (gcc::jit::result::result): Add tempdir param.
1045 (gcc::jit::result::m_tempdir): New field.
1046 * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
1048 (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
1049 and log m_path_template and m_path_tempdir.
1050 (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
1051 entry/exit, and log the unlink and rmdir calls.
1052 * jit-tempdir.h: Include "jit-logging.h".
1053 (class gcc::jit::tempdir): Make this be a subclass of log_user.
1054 (gcc::jit::tempdir::tempdir): Add logger param.
1055 * notes.txt: Update to show the two possible places where the
1056 tempdir can be cleaned up.
1058 2015-01-08 David Malcolm <dmalcolm@redhat.com>
1060 * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
1063 2015-01-08 David Malcolm <dmalcolm@redhat.com>
1065 * docs/topics/contexts.rst (Error-handling): Document new
1066 entrypoint gcc_jit_context_get_last_error.
1067 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1068 * jit-recording.c (gcc::jit::recording::context::context):
1069 Initialize new fields "m_last_error_str" and
1070 "m_owns_last_error_str".
1071 (gcc::jit::recording::context::~context): Clean up
1072 m_last_error_str, if needed.
1073 (gcc::jit::recording::context::add_error_va): Update
1074 m_last_error_str and m_owns_last_error_str, freeing the old
1075 value if appropriate.
1076 (gcc::jit::recording::context::get_last_error): New function.
1077 * jit-recording.h (gcc::jit::recording::context::get_last_error):
1079 (gcc::jit::recording::context): New fields m_last_error_str and
1080 m_owns_last_error_str.
1081 * libgccjit.c (gcc_jit_context_get_last_error): New function.
1082 * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1083 * libgccjit.map (gcc_jit_context_get_last_error): New function.
1085 2015-01-08 David Malcolm <dmalcolm@redhat.com>
1087 * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1088 * docs/internals/index.rst (Overview of code structure): Mention
1089 gcc_jit_context_set_logfile, and embed the example logfile.
1090 * docs/internals/test-hello-world.exe.log.txt: New file: example
1092 * docs/topics/contexts.rst (Debugging): Add documentation
1093 for gcc_jit_context_set_logfile.
1094 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1095 * dummy-frontend.c: Include "jit-logging.h".
1096 (jit_langhook_init): Assert that there is an active playback
1097 context. If it has a logger, log entry/exit to this function.
1098 (jit_langhook_write_globals): Likewise.
1099 * jit-common.h (gcc::jit::logger): New forward declaration.
1100 * jit-logging.c: New file.
1101 * jit-logging.h: New file.
1102 * jit-playback.c: Include "jit-logging.h".
1103 (gcc::jit::playback::context::context): Initialize the log_user
1104 base class from the recording context's logger (if any). Use
1105 JIT_LOG_SCOPE to log entry/exit from the function body.
1106 (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1107 log entry/exit from the function body.
1108 (gcc::jit::playback::build_stmt_list): Likewise.
1109 (gcc::jit::playback::function::postprocess): Likewise.
1110 (gcc::jit::playback::context::compile): Likewise. Log the
1111 entry/exit to toplev::main and toplev::finalize. Log the
1112 fake argv passed to toplev::main.
1113 (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1114 log entry/exit from the function body.
1115 (gcc::jit::playback::context::release_mutex): Likewise.
1116 (gcc::jit::playback::context::make_fake_args): Likewise.
1117 (gcc::jit::playback::context::extract_any_requested_dumps):
1119 (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1120 log the arguments that the driver is invoked with.
1121 (gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
1122 the logger to the result object.
1123 (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1124 log entry/exit from the function body.
1125 (gcc::jit::playback::context::dump_generated_code): Likewise.
1126 (gcc::jit::playback::context::handle_locations): Likewise.
1127 * jit-playback.h (gcc::jit::playback::context): Make this be
1128 a subclass of gcc::jit::log_user.
1129 * jit-recording.c: Include "jit-logging.h".
1130 (gcc::jit::recording::context::context: Initialize the logger to
1131 NULL for root contexts, or to the parent's logger for child
1133 (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1134 log entry/exit from the function body.
1135 (gcc::jit::recording::context::replay_into): Likewise.
1136 (gcc::jit::recording::context::disassociate_from_playback):
1138 (gcc::jit::recording::context::compile): Likewise.
1139 (recording::context::add_error_va): Likewise. Also, log the
1141 (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1142 log entry/exit from the function body.
1143 * jit-recording.h: Include "jit-logging.h".
1144 (gcc::jit::recording::context): Make this be a subclass of
1146 * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1147 (gcc::jit::result::result): Add logger param, recording it.
1148 Use JIT_LOG_SCOPE to log entry/exit from the function body.
1149 (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1150 log entry/exit from the function body.
1151 (gcc::jit::result::get_code): Likewise.
1152 * jit-result.h (gcc::jit::result): Make this be a subclass of
1154 (gcc::jit::result::result): Add logger parameter.
1155 * libgccjit++.h (gccjit::context::set_logfile): New function.
1156 * libgccjit.c: Include "jit-logging.h".
1157 (gcc_jit_context_acquire): Log the context.
1158 (gcc_jit_context_release): Use JIT_LOG_FUNC to
1159 log entry/exit from the function body, and log the context.
1160 (gcc_jit_context_new_child_context): Likewise, logging both
1162 (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1163 log entry/exit from the function body.
1164 (gcc_jit_context_get_type): Likewise.
1165 (gcc_jit_context_get_int_type): Likewise.
1166 (gcc_jit_context_new_array_type): Likewise.
1167 (gcc_jit_context_new_field): Likewise.
1168 (gcc_jit_context_new_struct_type): Likewise.
1169 (gcc_jit_context_new_opaque_struct): Likewise.
1170 (gcc_jit_struct_set_fields): Likewise.
1171 (gcc_jit_context_new_union_type): Likewise.
1172 (gcc_jit_context_new_function_ptr_type): Likewise.
1173 (gcc_jit_context_new_param): Likewise.
1174 (gcc_jit_context_new_function): Likewise.
1175 (gcc_jit_context_get_builtin_function): Likewise.
1176 (gcc_jit_function_get_param): Likewise.
1177 (gcc_jit_function_dump_to_dot): Likewise.
1178 (gcc_jit_function_new_block): Likewise.
1179 (gcc_jit_context_new_global): Likewise.
1180 (gcc_jit_context_new_rvalue_from_int): Likewise.
1181 (gcc_jit_context_zero): Likewise.
1182 (gcc_jit_context_one): Likewise.
1183 (gcc_jit_context_new_rvalue_from_double): Likewise.
1184 (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1185 (gcc_jit_context_null): Likewise.
1186 (gcc_jit_context_new_string_literal): Likewise.
1187 (gcc_jit_context_new_unary_op): Likewise.
1188 (gcc_jit_context_new_binary_op): Likewise.
1189 (gcc_jit_context_new_comparison): Likewise.
1190 (gcc_jit_context_new_call): Likewise.
1191 (gcc_jit_context_new_call_through_ptr): Likewise.
1192 (gcc_jit_context_new_cast): Likewise.
1193 (gcc_jit_context_new_array_access): Likewise.
1194 (gcc_jit_lvalue_access_field): Likewise.
1195 (gcc_jit_rvalue_access_field): Likewise.
1196 (gcc_jit_rvalue_dereference_field): Likewise.
1197 (gcc_jit_rvalue_dereference): Likewise.
1198 (gcc_jit_lvalue_get_address): Likewise.
1199 (gcc_jit_function_new_local): Likewise.
1200 (gcc_jit_block_add_eval): Likewise.
1201 (gcc_jit_block_add_assignment): Likewise.
1202 (gcc_jit_block_add_assignment_op): Likewise.
1203 (gcc_jit_block_end_with_conditional): Likewise.
1204 (gcc_jit_block_add_comment): Likewise.
1205 (gcc_jit_block_end_with_jump): Likewise.
1206 (gcc_jit_block_end_with_return): Likewise.
1207 (gcc_jit_block_end_with_void_return): Likewise.
1208 (gcc_jit_context_set_str_option): Likewise.
1209 (gcc_jit_context_set_int_option): Likewise.
1210 (gcc_jit_context_set_bool_option): Likewise.
1211 (gcc_jit_context_enable_dump): Likewise.
1212 (gcc_jit_context_compile): Likewise. Also log the context,
1214 (gcc_jit_context_dump_to_file): Likewise.
1215 (gcc_jit_context_set_logfile): New function.
1216 (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
1217 log entry/exit from the function body.
1218 (gcc_jit_result_get_code): Likewise. Also log the fnname)
1219 and the ptr to be returned.
1220 (gcc_jit_result_release): Likewise. Also log the result.
1221 * libgccjit.h: Include <stdio.h>, since we need FILE *.
1222 (gcc_jit_context_set_logfile): New declaration.
1223 * libgccjit.map (gcc_jit_context_set_logfile): New.
1225 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1227 * jit-recording.h (gcc::jit::recording::type::is_void): New
1229 (gcc::jit::recording::memento_of_get_type::is_void): New
1230 function, overriding default implementation.
1231 * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
1232 the underlying type is not "void".
1234 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1236 * docs/topics/expressions.rst (Unary Operations): Add
1237 GCC_JIT_UNARY_OP_ABS.
1238 * jit-playback.c (gcc::jit::playback::context::new_unary_op):
1240 * jit-recording.c (unary_op_strings): Likewise.
1241 * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
1242 of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
1243 * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
1244 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1246 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1248 * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
1251 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1253 * TODO.rst (Test suite): Remove item about running C++ testcases.
1254 * docs/internals/index.rst (Working on the JIT library): Add
1255 "c++" to the enabled languages in the suggested "configure"
1256 invocation, and add a description of why this is necessary.
1257 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1259 2015-01-07 David Malcolm <dmalcolm@redhat.com>
1261 * docs/internals/index.rst: Update to reflect that built
1262 testcases are now test-foo.c.exe, rather than test-foo.exe.
1263 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1265 2015-01-05 Jakub Jelinek <jakub@redhat.com>
1267 Update copyright years.
1269 2014-12-19 David Malcolm <dmalcolm@redhat.com>
1271 * jit-playback.c (gcc::jit::playback::context::build_cast): In
1272 case BOOLEAN_TYPE, don't assume that the source expression is
1275 2014-12-19 David Malcolm <dmalcolm@redhat.com>
1277 * jit-recording.c (gcc::jit::recording::context::context): When
1278 copying string options from a parent context, take a copy of the
1279 underlying buffers, rather than simply copying the pointer.
1281 2014-12-19 David Malcolm <dmalcolm@redhat.com>
1283 * jit-recording.c (gcc::jit::recording::context::set_str_option):
1286 2014-12-11 David Malcolm <dmalcolm@redhat.com>
1288 * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
1289 Document new function.
1290 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1292 2014-12-10 Ulrich Drepper <drepper@gmail.com>
1294 Minor interface cleanups of libgccjit
1295 * jit-playback.c (convert_to_dso): Use auto_vec instead
1296 of automatic array to build up command line.
1297 * jit-recording.c (recording::context::set_str_option):
1298 Make copy of the string.
1299 (recording::context::~context): Free string options.
1300 * jit-recording.h (recording::context): Adjust type
1301 of m_str_options member.
1302 * libgccjit.h: Adjust comment about
1303 gcc_jit_context_set_str_option parameter being used after
1305 Update comment now that all interfaces are copy strings
1307 * libgccjit++.h (gccjit::context): Add set_str_option
1310 2014-12-10 David Malcolm <dmalcolm@redhat.com>
1312 * docs/cp/index.rst: New file.
1313 * docs/cp/intro/index.rst: New file.
1314 * docs/cp/intro/tutorial01.rst: New file.
1315 * docs/cp/intro/tutorial02.rst: New file.
1316 * docs/cp/intro/tutorial03.rst: New file.
1317 * docs/cp/intro/tutorial04.rst: New file.
1318 * docs/cp/topics/contexts.rst: New file.
1319 * docs/cp/topics/expressions.rst: New file.
1320 * docs/cp/topics/functions.rst: New file.
1321 * docs/cp/topics/index.rst: New file.
1322 * docs/cp/topics/locations.rst: New file.
1323 * docs/cp/topics/objects.rst: New file.
1324 * docs/cp/topics/results.rst: New file.
1325 * docs/cp/topics/types.rst: New file.
1326 * docs/examples/tut01-hello-world.cc: New file.
1327 * docs/examples/tut02-square.c: Fix missing newline in output.
1328 * docs/examples/tut02-square.cc: New file.
1329 * docs/examples/tut03-sum-of-squares.cc: New file.
1330 * docs/examples/tut04-toyvm/toyvm.cc: New file.
1331 * docs/index.rst: Move summary to above the table of contents.
1332 Add text about the C vs C++ APIs.
1333 * docs/topics/contexts.rst: Fix a typo.
1335 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1336 * docs/_build/texinfo/factorial1.png: New file.
1337 * docs/_build/texinfo/sum-of-squares1.png: New file.
1339 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1341 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
1342 logic for determine "funcname" to new function...
1343 (get_function_name): ...here, adding logic to skip any leading
1344 path from the filename.
1345 (toyvm_function_parse): Use the filename for fn_filename, rather
1346 than "name", so that the debugger can locate the source .toy
1348 (toyvm_function_parse): Don't fclose a NULL FILE *.
1350 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1353 * docs/internals/index.rst (Running under valgrind): New
1355 (docs/_build/texinfo/libgccjit.texi): Regenerate.
1357 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1360 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
1361 * jit-common.h (gcc::jit::tempdir): New forward decl.
1362 * jit-playback.c: Include jit-tempdir.h.
1363 (gcc::jit::playback::context::context): Initialize m_tempdir.
1364 (gcc::jit::playback::context::~context): Move tempdir
1365 cleanup to new file jit-tempdir.c
1366 (make_tempdir_path_template): Move to new file jit-tempdir.c.
1367 (gcc::jit::playback::context::compile): Move tempdir creation
1368 to new tempdir object in new file jit-tempdir.c.
1369 (gcc::jit::playback::context::make_fake_args): Get path from
1370 tempdir object rather than from member data.
1371 (gcc::jit::playback::context::convert_to_dso): Likewise.
1372 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1373 (gcc::jit::playback::context::dump_generated_code): Likewise.
1374 (gcc::jit::playback::context::get_path_c_file): New function.
1375 (gcc::jit::playback::context::get_path_s_file): New function.
1376 (gcc::jit::playback::context::get_path_so_file): New function.
1377 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1379 (gcc::jit::playback::context::get_path_s_file): New function.
1380 (gcc::jit::playback::context::get_path_so_file): New function.
1381 (gcc::jit::playback::context): Move fields "m_path_template",
1382 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1383 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1384 * jit-tempdir.c: New file.
1385 * jit-tempdir.h: New file.
1387 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1389 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1390 mutex here, immediately before using toplev, and release it here, on
1391 each exit path after acquisition.
1392 (jit_mutex): Move this variable here, from jit-recording.c.
1393 (gcc::jit::playback::context::acquire_mutex): New function, based on
1394 code in jit-recording.c.
1395 (gcc::jit::playback::context::release_mutex): Likewise.
1396 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1398 (gcc::jit::playback::context::release_mutex): New function.
1399 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1400 (gcc::jit::recording::context::compile): Move mutex-handling from
1401 here into jit-playback.c's gcc::jit::playback::context::compile.
1402 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1405 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1407 * jit-playback.c (gcc::jit::playback::context::compile): Move the
1409 (gcc::jit::playback::context::dlopen_built_dso): ...this new
1411 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1414 2014-12-09 David Malcolm <dmalcolm@redhat.com>
1417 * docs/topics/contexts.rst (Debugging): Add description of
1418 gcc_jit_context_enable_dump.
1419 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1420 * jit-playback.c: Include context.h.
1421 (class auto_argvec): New class.
1422 (auto_argvec::~auto_argvec): New function.
1423 (gcc::jit::playback::context::compile): Convert fake_args to be
1424 an auto_argvec, so that it can contain dynamically-allocated
1425 strings. Construct a vec of all requested dumps, and pass it to
1426 make_fake_args. Extract requested dumps between the calls to
1427 toplev::main and toplev::finalize.
1428 (gcc::jit::playback::context::make_fake_args): Convert param
1429 "argvec" to be a vec <char *>, and gain a "requested_dumps"
1430 param. Convert to dynamically-allocated arg strings by converting
1431 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1432 for args that are already a copy. Add args for all requested dumps.
1433 (gcc::jit::playback::context::extract_any_requested_dumps): New
1435 (gcc::jit::playback::context::read_dump_file): New function.
1436 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1437 Convert param "argvec" to be a vec <char *>, and gain a
1438 "requested_dumps" param.
1439 (gcc::jit::playback::context::extract_any_requested_dumps): New
1441 (gcc::jit::playback::context::read_dump_file): New function.
1442 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
1444 (gcc::jit::recording::context::get_all_requested_dumps): New
1446 * jit-recording.h (gcc::jit::recording::requested_dump): New
1448 (gcc::jit::recording::context::enable_dump): New function.
1449 (gcc::jit::recording::context::get_all_requested_dumps): New
1451 (gcc::jit::recording::context::m_requested_dumps): New field.
1452 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
1453 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
1454 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
1456 2014-12-08 David Malcolm <dmalcolm@redhat.com>
1458 * libgccjit++.h: Indent the forward declarations of the classes to
1459 show the inheritance hierarchy.
1461 2014-12-08 David Malcolm <dmalcolm@redhat.com>
1463 * notes.txt: Show the beginning and ending of
1464 recording::context::compile vs playback::context::compile. Show
1465 the creation and unlinking of the tempdir. Show toplev::finalize.
1466 Move "RELEASE MUTEX" to the correct location. Show
1467 gcc_jit_result_release, and indicate where the
1468 dlopen/dlsym/dlclose occur.
1470 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1472 * docs/examples/tut02-square.c (main): Release the context
1473 earlier, to show that this is possible. Update error-handling
1474 to avoid a double-release of the context, and to avoid
1475 releasing a NULL result.
1476 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
1477 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
1478 * docs/topics/results.rst (gcc_jit_result): Mention that this
1479 controls the lifetimes of machine code functions.
1480 (gcc_jit_result_get_code): Spell out the requirements for this
1481 to succeed, and the lifetime of the result.
1482 (gcc_jit_result_release): Mention that this invalidates any code
1483 that was obtained from the result.
1484 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1486 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1489 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
1490 Add description of error-handling, taken in part from...
1491 * docs/topics/contexts.rst (Error-handling): Expand, and move some
1492 content to tutorial02.rst.
1493 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1495 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1498 * docs/topics/types.rst (Standard types) Add new enum values to
1499 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
1500 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1501 Widen the left-hand column so that
1502 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
1503 * docs/_build/texinfo/libgccjit.texi: Regenerate.
1505 * jit-builtins.c: Include stringpool.h and jit-playback.h.
1506 Move everything out of the gcc::jit::recording namespace into
1508 (struct builtin_data): Add fields "fnclass", "attr", and
1510 (DEF_BUILTIN): Update macro so populate the new fields.
1511 (builtins_manager::builtins_manager): Update for move out of
1512 recording namespace. Initialize the m_attributes array.
1513 (builtins_manager::get_builtin_function): Likewise.
1514 (builtins_manager::get_builtin_function_by_id): New function.
1515 (builtins_manager::make_builtin_function): Update for move out of
1516 recording namespace. Add fix for PR jit/64020 by detecting
1517 specific builtin ids and having them ensure that builtins for
1518 other ids are created as necessary.
1519 (builtins_manager::get_type): Update for move out of recording
1521 (builtins_manager::make_type): Likewise. Add some missing
1523 (builtins_manager::make_primitive_type): Update for move out of
1524 recording namespace. Implement the three BT_COMPLEX_ cases and
1526 (builtins_manager::make_fn_type): Update for move out of recording
1528 (builtins_manager::make_ptr_type): Likewise.
1529 (builtins_manager::finish_playback): New function.
1530 (builtins_manager::get_class): New function.
1531 (builtins_manager::implicit_p): New function.
1532 (builtins_manager::get_attrs_tree): Two new functions.
1533 (builtins_manager::make_attrs_tree): New function.
1535 * jit-builtins.h: Move everything out of the gcc::jit::recording
1536 namespace into just gcc::jit.
1537 (enum built_in_attribute): New.
1538 (builtins_manager::builtins_manager): Update decl for namespace
1540 (builtins_manager::get_builtin_function): Likewise.
1541 (builtins_manager::get_class): New.
1542 (builtins_manager::implicit_p): New.
1543 (builtins_manager::get_attrs_tree): Two new functions.
1544 (builtins_manager::make_attrs_tree): New function.
1545 (builtins_manager::finish_playback): New.
1546 (builtins_manager::get_builtin_function_by_id): New.
1547 (builtins_manager::make_builtin_function): Update decl for
1549 (builtins_manager::get_type): Likewise.
1550 (builtins_manager::make_type): Likewise.
1551 (builtins_manager::make_primitive_type): Likewise.
1552 (builtins_manager::make_fn_type): Likewise.
1553 (builtins_manager::make_ptr_type): Likewise.
1554 (builtins_manager): Likewise for fields. Add new field
1557 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
1558 (builtins_manager): Update forward decl to reflect namespace
1561 * jit-playback.c: Include attribs.h and jit-builtins.h.
1562 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
1563 for the new COMPLEX_ types.
1564 (gcc::jit::playback::context::new_function): If creating a
1565 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
1566 and call set_builtin_decl.
1567 (gcc::jit::playback::context::replay): If we have a
1568 builtins_manager, call its finish_playback method when we're done.
1571 (gcc::jit::playback::context::get_builtins_manager): New function.
1574 (gcc::jit::recording::context::get_builtins_manager): New function.
1575 (gcc::jit::recording::get_builtin_function): Use
1576 get_builtins_manager, in case we're a child context.
1577 (gcc::jit::recording::memento_of_get_type::dereference): Add the
1579 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
1580 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
1581 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
1582 (get_type_strings): Likewise.
1585 (gcc::jit::recording::context::get_builtins_manager): New.
1587 * libgccjit.h (enum gcc_jit_types): Add
1588 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
1589 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
1591 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1594 (gcc::jit::recording::builtins_manager::get_builtin_function):
1595 Check for NULL return from make_builtin_function.
1596 (gcc::jit::recording::builtins_manager::make_builtin_function):
1597 Check for NULL return from get_type.
1599 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1601 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
1602 creation code into...
1603 (gcc::jit::playback::context::convert_to_dso): New function.
1604 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
1607 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1609 * jit-playback.c (gcc::jit::playback::context::compile): Use an
1610 auto_vec<const char *> rather than a const char *[20] for the
1611 top-level argv, and move the logic to build it to...
1612 (gcc::jit::playback::context::make_fake_args): New function.
1613 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1616 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1618 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
1619 * jit-playback.c: Include new header jit-result.h.
1620 (gcc::jit::result::result): Move to new file jit-result.c.
1621 (gcc::jit::result::~result): Likewise.
1622 (gcc::jit::playback::result): Likewise.
1623 * jit-recording.h (class gcc::jit::result): Move to new
1624 header jit-result.h.
1625 * jit-result.c: New file, to contain...
1626 (gcc::jit::result::result): Move here from jit-playback.c,
1627 removing erroneous "playback" namespace from comment.
1628 (gcc::jit::result::~result): Likewise.
1629 (gcc::jit::playback::result): Likewise.
1630 * jit-result.h: New file, to contain...
1631 (class gcc::jit::result): Move from jit-recording.h.
1632 * libgccjit.c: Include jit-result.h.
1633 (gcc_jit_result_get_code): Update comment to reflect move
1635 (gcc_jit_result_release): Likewise.
1637 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1640 * docs/examples/tut04-toyvm/toyvm.c
1641 (toyvm_compiled_function): New typedef.
1642 (toyvm_compiled_func) Rename to...
1643 (toyvm_compiled_code) ...this.
1644 (struct toyvm_compiled_function): New struct.
1645 (toyvm_function_compile): Return a toyvm_compiled_function *
1646 rather than a toyvm_compiled_func, so that the caller can fully
1647 clean things up. Free "funcname".
1648 (test_script): Update for change to toyvm_function_compile.
1649 Clean up the toyvm_compiled_function.
1651 (docs/intro/tutorial04.rst): Update to reflect the above changes,
1652 and to better spell out the lifetime of the compiled code.
1654 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1658 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
1659 context's new_function_type method, rather than directly creating
1660 a function_type instance.
1662 (gcc::jit::recording::context::new_function_type): New method,
1663 adapted from part of...
1664 (gcc::jit::recording::context::new_function_ptr_type): ...this.
1665 Update to call new_function_type.
1667 (gcc::jit::recording::context::new_function_type): New method.
1669 2014-12-01 David Malcolm <dmalcolm@redhat.com>
1672 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
1674 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1677 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
1678 Convert param from const vec<playback::field *> & to
1679 const auto_vec<playback::field *> *.
1680 (gcc::jit::playback::context::new_function_type): Convert param
1681 "param_types" from vec<type *> * to const auto_vec<type *> *.
1682 (gcc::jit::playback::context::new_function): Convert param
1683 "params" from vec<param *> * to const auto_vec<param *> *.
1684 (gcc::jit::playback::context::build_call): Convert param "args"
1685 from vec<rvalue *> to const auto_vec<rvalue *> *.
1686 (gcc::jit::playback::context::new_call): Likewise.
1687 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1688 (wrapper_finalizer): New function.
1689 (gcc::jit::playback::wrapper::operator new): Call the finalizer
1690 variant of ggc_internal_cleared_alloc, supplying
1692 (gcc::jit::playback::function::finalizer): New.
1693 (gcc::jit::playback::block::finalizer): New.
1694 (gcc::jit::playback::source_file::finalizer): New.
1695 (gcc::jit::playback::source_line::finalizer): New.
1698 (gcc::jit::playback::context::new_function_type): Convert param
1699 "param_types" from vec<type *> * to const auto_vec<type *> *.
1700 (gcc::jit::playback::context::new_function): Convert param
1701 "params" from vec<param *> * to const auto_vec<param *> *.
1702 (gcc::jit::playback::context::new_call): Convert param
1703 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
1704 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
1705 (gcc::jit::playback::context::build_call): Likewise.
1706 (gcc::jit::playback::context): Convert fields "m_functions",
1707 "m_source_files", "m_cached_locations" from vec to auto_vec.
1708 (gcc::jit::playback::wrapper::finalizer): New virtual function.
1709 (gcc::jit::playback::compound_type::set_fields): Convert param fro
1710 const vec<playback::field *> & to
1711 const auto_vec<playback::field *> *.
1712 (gcc::jit::playback::function::finalizer): New.
1713 (gcc::jit::playback::block::finalizer): New.
1714 (gcc::jit::playback::source_file::finalizer): New.
1715 (gcc::jit::playback::source_line::finalizer): New.
1718 (gcc::jit::recording::function_type::replay_into): Convert local
1719 from a vec into an auto_vec.
1720 (gcc::jit::recording::fields::replay_into): Likewise.
1721 (gcc::jit::recording::function::replay_into): Likewise.
1722 (gcc::jit::recording::call::replay_into): Likewise.
1723 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
1725 * jit-recording.h (gcc::jit::recording::context): Convert fields
1726 "m_mementos", "m_compound_types", "m_functions" from vec<> to
1728 (gcc::jit::recording::function_type::get_param_types): Convert
1729 return type from vec<type *> to const vec<type *> &.
1730 (gcc::jit::recording::function_type): Convert field
1731 "m_param_types" from a vec<> to an auto_vec<>.
1732 (gcc::jit::recording::fields): Likewise for field "m_fields".
1733 (gcc::jit::recording::function::get_params): Convert return type
1734 from vec <param *> to const vec<param *> &.
1735 (gcc::jit::recording::function): Convert fields "m_params",
1736 "m_locals", "m_blocks" from vec<> to auto_vec<>.
1737 (gcc::jit::recording::block): Likewise for field "m_statements".
1738 vec<> to auto_vec<>.
1739 (gcc::jit::recording::call): Likewise for field "m_args".
1740 (gcc::jit::recording::call_through_ptr): Likewise.
1742 2014-11-19 David Malcolm <dmalcolm@redhat.com>
1745 * jit-recording.c (recording::function::validate): Convert
1746 "worklist" from vec<> to autovec<> to fix a leak.
1748 2014-11-11 David Malcolm <dmalcolm@redhat.com>
1750 * ChangeLog.jit: New.
1752 * Make-lang.in: New.
1754 * config-lang.in: New.
1755 * docs/Makefile: New.
1756 * docs/_build/texinfo/Makefile: New.
1757 * docs/_build/texinfo/factorial.png: New.
1758 * docs/_build/texinfo/libgccjit.texi: New.
1759 * docs/_build/texinfo/sum-of-squares.png: New.
1760 * docs/conf.py: New.
1761 * docs/examples/tut01-hello-world.c: New.
1762 * docs/examples/tut02-square.c: New.
1763 * docs/examples/tut03-sum-of-squares.c: New.
1764 * docs/examples/tut04-toyvm/Makefile: New.
1765 * docs/examples/tut04-toyvm/factorial.toy: New.
1766 * docs/examples/tut04-toyvm/fibonacci.toy: New.
1767 * docs/examples/tut04-toyvm/toyvm.c: New.
1768 * docs/index.rst: New.
1769 * docs/internals/index.rst: New.
1770 * docs/intro/factorial.png: New.
1771 * docs/intro/index.rst: New.
1772 * docs/intro/sum-of-squares.png: New.
1773 * docs/intro/tutorial01.rst: New.
1774 * docs/intro/tutorial02.rst: New.
1775 * docs/intro/tutorial03.rst: New.
1776 * docs/intro/tutorial04.rst: New.
1777 * docs/topics/contexts.rst: New.
1778 * docs/topics/expressions.rst: New.
1779 * docs/topics/functions.rst: New.
1780 * docs/topics/index.rst: New.
1781 * docs/topics/locations.rst: New.
1782 * docs/topics/objects.rst: New.
1783 * docs/topics/results.rst: New.
1784 * docs/topics/types.rst: New.
1785 * dummy-frontend.c: New.
1786 * jit-builtins.c: New.
1787 * jit-builtins.h: New.
1788 * jit-common.h: New.
1789 * jit-playback.c: New.
1790 * jit-playback.h: New.
1791 * jit-recording.c: New.
1792 * jit-recording.h: New.
1793 * libgccjit++.h: New.
1796 * libgccjit.map: New.
1799 2013-07-26 David Malcolm <dmalcolm@redhat.com>
1803 Copyright (C) 2013-2015 Free Software Foundation, Inc.
1805 Copying and distribution of this file, with or without modification,
1806 are permitted in any medium without royalty provided the copyright
1807 notice and this notice are preserved.