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