gcc_jit_type_get_aligned
[official-gcc.git] / gcc / jit / ChangeLog
blobdc7dda604d00302c5f4e6de590798b783f27ec92
1 2017-04-24  David Malcolm  <dmalcolm@redhat.com>
3         * docs/cp/topics/types.rst (gccjit::type::get_const): Remove
4         comment.
5         (gccjit::type::get_aligned): Add.
6         * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_7.
7         * docs/topics/types.rst: Add gcc_jit_type_get_aligned.
8         * docs/_build/texinfo/libgccjit.texi: Regenerate.
9         * jit-playback.c (gcc::jit::playback::type::get_aligned): New
10         method.
11         * jit-playback.h (gcc::jit::playback::type::get_aligned): New
12         method.
13         * jit-recording.c: Within namespace gcc::jit::recording...
14         (type::get_aligned): New method.
15         (memento_of_get_aligned::replay_into): New method.
16         (memento_of_get_aligned::make_debug_string): New method.
17         (memento_of_get_aligned::write_reproducer): New method.
18         * jit-recording.h: Within namespace gcc::jit::recording...
19         (type::get_aligned): New method.
20         (type::accepts_writes_from): Strip off qualifications from
21         this when comparing pointer equality.
22         (decorated_type): New subclass of type, subsuming the
23         commonality between memento_of_get_const and
24         memento_of_get_volatile.
25         (memento_of_get_const): Make a subclass of decorated_type,
26         rather than type.
27         (memento_of_get_volatile): Likewise.
28         (memento_of_get_aligned): Likewise.
29         * libgccjit++.h: Within namespace gccjit...
30         (type::get_const): New method.
31         (type::get_aligned): New method.
32         * libgccjit.c (gcc_jit_type_get_aligned): New function.
33         * libgccjit.h (gcc_jit_type_get_aligned): New decl.
34         * libgccjit.map (LIBGCCJIT_ABI_7): New
35         (gcc_jit_type_get_aligned): Add.
37 2017-01-19  David Malcolm  <dmalcolm@redhat.com>
39         * dummy-frontend.c (jit_langhook_type_for_size): Delete.
40         (LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine.
42 2017-01-18  David Malcolm  <dmalcolm@redhat.com>
44         * dummy-frontend.c (jit_langhook_type_for_size): Implement, using
45         lto's lto_type_for_size.
47 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
49         Update copyright years.
51 2016-05-20  David Malcolm  <dmalcolm@redhat.com>
53         * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_6.
54         * docs/topics/expressions.rst (Function calls): Add documentation
55         of gcc_jit_rvalue_set_bool_require_tail_call.
56         * docs/_build/texinfo/libgccjit.texi: Regenerate.
57         * jit-common.h (gcc::jit::recording::base_call): Add forward decl.
58         * jit-playback.c: Within namespace gcc::jit::playback...
59         (context::build_call) Add "require_tail_call" param and use it
60         to set CALL_EXPR_MUST_TAIL_CALL.
61         (context::new_call): Add "require_tail_call" param.
62         (context::new_call_through_ptr): Likewise.
63         * jit-playback.h: Within namespace gcc::jit::playback...
64         (context::new_call: Add "require_tail_call" param.
65         (context::new_call_through_ptr): Likewise.
66         (context::build_call): Likewise.
67         * jit-recording.c: Within namespace gcc::jit::recording...
68         (base_call::base_call): New constructor.
69         (base_call::write_reproducer_tail_call): New method.
70         (call::call): Update for inheritance from base_call.
71         (call::replay_into): Provide m_require_tail_call to call
72         to new_call.
73         (call::write_reproducer): Call write_reproducer_tail_call.
74         (call_through_ptr::call_through_ptr): Update for inheritance from
75         base_call.
76         (call_through_ptr::replay_into): Provide m_require_tail_call to call
77         to new_call_through_ptr.
78         (recording::call_through_ptr::write_reproducer): Call
79         write_reproducer_tail_call.
80         * jit-recording.h: Within namespace gcc::jit::recording...
81         (rvalue::dyn_cast_base_call): New virtual function.
82         (class base_call): New subclass of class rvalue.
83         (class call): Inherit from base_call rather than directly from
84         rvalue, moving get_precedence and m_args to base_call.
85         (class call_through_ptr): Likewise.
86         * libgccjit.c (gcc_jit_rvalue_set_bool_require_tail_call): New
87         function.
88         * libgccjit.h
89         (LIBGCCJIT_HAVE_gcc_jit_rvalue_set_bool_require_tail_call): New
90         macro.
91         (gcc_jit_rvalue_set_bool_require_tail_call): New function.
92         * libgccjit.map (LIBGCCJIT_ABI_6): New.
93         (gcc_jit_rvalue_set_bool_require_tail_call): Add.
95 2016-05-17  David Malcolm  <dmalcolm@redhat.com>
97         * dummy-frontend.c: Include diagnostic.h.
98         (jit_begin_diagnostic): New function.
99         (jit_end_diagnostic): New function.
100         (jit_langhook_init): Register jit_begin_diagnostic
101         and jit_end_diagnostic with the global_dc.
102         * jit-playback.c: Include diagnostic.h.
103         (gcc::jit::playback::context::add_diagnostic): New method.
104         * jit-playback.h (struct diagnostic_context): Add forward
105         declaration.
106         (gcc::jit::playback::context::add_diagnostic): New method.
108 2016-05-17  David Malcolm  <dmalcolm@redhat.com>
110         * docs/topics/expressions.rst (Function calls): Document
111         gcc_jit_context_new_call_through_ptr.
112         * docs/_build/texinfo/libgccjit.texi: Regenerate.
114 2016-05-13  David Malcolm  <dmalcolm@redhat.com>
116         * jit-playback.h: Within namespace gcc:jit::playback...
117         (compile_to_memory::postprocess): Mark with FINAL OVERRIDE.
118         (compile_to_file::postprocess): Likewise.
119         (function::finalizer): Likewise.
120         (block::finalizer): Likewise.
121         (source_file::finalizer): Likewise.
122         (source_line::finalizer): Likewise.
123         * jit-recording.c (gcc::jit::rvalue_usage_validator):: Likewise.
124         * jit-recording.h: Within namespace gcc::jit::recording...
125         (string::replay_into): Mark with FINAL OVERRIDE.
126         (string::make_debug_string): Likewise.
127         (string::write_reproducer): Likewise.
128         (location::replay_into): Likewise.
129         (location::dyn_cast_location): Likewise.
130         (location::make_debug_string): Likewise.
131         (location::write_reproducer): Likewise.
132         (memento_of_get_type::dereference): Likewise.
133         (memento_of_get_type::accepts_writes_from): Likewise.
134         (memento_of_get_type::is_int): Likewise.
135         (memento_of_get_type::is_float): Likewise.
136         (memento_of_get_type::is_bool): Likewise.
137         (memento_of_get_type::is_pointer): Likewise.
138         (memento_of_get_type::is_array): Likewise.
139         (memento_of_get_type::is_void): Likewise.
140         (memento_of_get_type::replay_into): Likewise.
141         (memento_of_get_type::make_debug_string): Likewise.
142         (memento_of_get_type::write_reproducer): Likewise.
143         (memento_of_get_pointer::dereference): Likewise.
144         (memento_of_get_pointer::accepts_writes_from): Likewise.
145         (memento_of_get_pointer::replay_into): Likewise.
146         (memento_of_get_pointer::is_int): Likewise.
147         (memento_of_get_pointer::is_float): Likewise.
148         (memento_of_get_pointer::is_bool): Likewise.
149         (memento_of_get_pointer::is_pointer): Likewise.
150         (memento_of_get_pointer::is_array): Likewise.
151         (memento_of_get_pointer::make_debug_string): Likewise.
152         (memento_of_get_pointer::write_reproducer): Likewise.
153         (memento_of_get_const::dereference): Likewise.
154         (memento_of_get_const::accepts_writes_from): Likewise.
155         (memento_of_get_const::unqualified): Likewise.
156         (memento_of_get_const::is_int): Likewise.
157         (memento_of_get_const::is_float): Likewise.
158         (memento_of_get_const::is_bool): Likewise.
159         (memento_of_get_const::is_pointer): Likewise.
160         (memento_of_get_const::is_array): Likewise.
161         (memento_of_get_const::void replay_into): Likewise;
162         (memento_of_get_const::make_debug_string): Likewise.
163         (memento_of_get_const::write_reproducer): Likewise.
164         (memento_of_get_volatile::dereference): Likewise.
165         (memento_of_get_volatile::unqualified): Likewise.
166         (memento_of_get_volatile::is_int): Likewise.
167         (memento_of_get_volatile::is_float): Likewise.
168         (memento_of_get_volatile::is_bool): Likewise.
169         (memento_of_get_volatile::is_pointer): Likewise.
170         (memento_of_get_volatile::is_array): Likewise.
171         (memento_of_get_volatile::replay_into): Likewise;
172         (memento_of_get_volatile::make_debug_string): Likewise.
173         (memento_of_get_volatile::write_reproducer): Likewise.
174         (array_type::dereference): Likewise.
175         (array_type::is_int): Likewise.
176         (array_type::is_float): Likewise.
177         (array_type::is_bool): Likewise.
178         (array_type::is_pointer): Likewise.
179         (array_type::is_array): Likewise.
180         (array_type::replay_into): Likewise;
181         (array_type::make_debug_string): Likewise.
182         (array_type::write_reproducer): Likewise.
183         (function_type::dereference): Likewise.
184         (function_type::function_dyn_cast_function_type): Likewise.
185         (function_type::function_as_a_function_type): Likewise.
186         (function_type::is_int): Likewise.
187         (function_type::is_float): Likewise.
188         (function_type::is_bool): Likewise.
189         (function_type::is_pointer): Likewise.
190         (function_type::is_array): Likewise.
191         (function_type::replay_into): Likewise;
192         (function_type::make_debug_string): Likewise.
193         (function_type::write_reproducer): Likewise.
194         (field::replay_into): Likewise;
195         (field::write_to_dump): Likewise.
196         (field::make_debug_string): Likewise.
197         (field::write_reproducer): Likewise.
198         (compound_type::dereference): Likewise.
199         (compound_type::is_int): Likewise.
200         (compound_type::is_float): Likewise.
201         (compound_type::is_bool): Likewise.
202         (compound_type::is_pointer): Likewise.
203         (compound_type::is_array): Likewise.
204         (compound_type::has_known_size): Likewise.
205         (struct_::dyn_cast_struct): Likewise.
206         (struct_::replay_into): Likewise.
207         (struct_::access_as_type): Likewise.
208         (struct_::make_debug_string): Likewise.
209         (struct_::write_reproducer): Likewise.
210         (fields::replay_into): Likewise.
211         (fields::write_to_dump): Likewise.
212         (fields::make_debug_string): Likewise.
213         (fields::write_reproducer): Likewise.
214         (union_::replay_into): Likewise.
215         (union_::make_debug_string): Likewise.
216         (union_::write_reproducer): Likewise.
217         (lvalue::access_as_rvalue): Mark with OVERRIDE.
218         (param::replay_into): Mark with FINAL OVERRIDE.
219         (param::visit_children): Likewise.
220         (param::dyn_cast_param): Likewise.
221         (param::access_as_rvalue): Likewise.
222         (param::access_as_lvalue): Likewise.
223         (param::make_debug_string): Likewise.
224         (param::write_reproducer): Likewise.
225         (param::get_precedence): Likewise.
226         (function::replay_into): Likewise.
227         (function::write_to_dump): Likewise.
228         (function::make_debug_string): Likewise.
229         (function::write_reproducer): Likewise.
230         (block::write_to_dump): Likewise.
231         (block::make_debug_string): Likewise.
232         (block::write_reproducer): Likewise.
233         (block::replay_into): Likewise.
234         (global::replay_into): Likewise;
235         (global::visit_children): Likewise.
236         (global::write_to_dump): Likewise.
237         (global::make_debug_string): Likewise.
238         (global::write_reproducer): Likewise.
239         (global::get_precedence): Likewise.
240         (memento_of_new_rvalue_from_const::replay_into): Likewise.
241         (memento_of_new_rvalue_from_const::visit_children): Likewise.
242         (memento_of_new_rvalue_from_const::is_constant): Likewise.
243         (memento_of_new_rvalue_from_const::get_wide_int): Likewise.
244         (memento_of_new_rvalue_from_const::make_debug_string): Likewise.
245         (memento_of_new_rvalue_from_const::write_reproducer): Likewise.
246         (memento_of_new_rvalue_from_const::get_precedence): Likewise.
247         (memento_of_new_string_literal::replay_into): Likewise.
248         (memento_of_new_string_literal::visit_children): Likewise.
249         (memento_of_new_string_literal::make_debug_string): Likewise.
250         (memento_of_new_string_literal::write_reproducer): Likewise.
251         (memento_of_new_string_literal::get_precedence): Likewise.
252         (unary_op::replay_into): Likewise.
253         (unary_op::visit_children): Likewise.
254         (unary_op::make_debug_string): Likewise.
255         (unary_op::write_reproducer): Likewise.
256         (unary_op::get_precedence): Likewise.
257         (binary_op::replay_into): Likewise.
258         (binary_op::visit_children): Likewise.
259         (binary_op::make_debug_string): Likewise.
260         (binary_op::write_reproducer): Likewise.
261         (binary_op::get_precedence): Likewise.
262         (comparison::replay_into): Likewise.
263         (comparison::visit_children): Likewise.
264         (comparison::make_debug_string): Likewise.
265         (comparison::write_reproducer): Likewise.
266         (comparison::get_precedence): Likewise.
267         (cast::replay_into): Likewise.
268         (cast::visit_children): Likewise.
269         (cast::make_debug_string): Likewise.
270         (cast::write_reproducer): Likewise.
271         (cast::get_precedence): Likewise.
272         (call::replay_into): Likewise.
273         (call::visit_children): Likewise.
274         (call::make_debug_string): Likewise.
275         (call::write_reproducer): Likewise.
276         (call::get_precedence): Likewise.
277         (call_through_ptr::replay_into): Likewise.
278         (call_through_ptr::visit_children): Likewise.
279         (call_through_ptr::make_debug_string): Likewise.
280         (call_through_ptr::write_reproducer): Likewise.
281         (call_through_ptr::get_precedence): Likewise.
282         (array_access::replay_into): Likewise.
283         (array_access::visit_children): Likewise.
284         (array_access::make_debug_string): Likewise.
285         (array_access::write_reproducer): Likewise.
286         (array_access::get_precedence): Likewise.
287         (access_field_of_lvalue::replay_into): Likewise.
288         (access_field_of_lvalue::visit_children): Likewise.
289         (access_field_of_lvalue::make_debug_string): Likewise.
290         (access_field_of_lvalue::write_reproducer): Likewise.
291         (access_field_of_lvalue::get_precedence): Likewise.
292         (access_field_rvalue::replay_into): Likewise.
293         (access_field_rvalue::visit_children): Likewise.
294         (access_field_rvalue::make_debug_string): Likewise.
295         (access_field_rvalue::write_reproducer): Likewise.
296         (access_field_rvalue::get_precedence): Likewise.
297         (dereference_field_rvalue::replay_into): Likewise.
298         (dereference_field_rvalue::visit_children): Likewise.
299         (dereference_field_rvalue::make_debug_string): Likewise.
300         (dereference_field_rvalue::write_reproducer): Likewise.
301         (dereference_field_rvalue::get_precedence): Likewise.
302         (dereference_rvalue::replay_into): Likewise.
303         (dereference_rvalue::visit_children): Likewise.
304         (dereference_rvalue::make_debug_string): Likewise.
305         (dereference_rvalue::write_reproducer): Likewise.
306         (dereference_rvalue::get_precedence): Likewise.
307         (get_address_of_lvalue::replay_into): Likewise.
308         (get_address_of_lvalue::visit_children): Likewise.
309         (get_address_of_lvalue::make_debug_string): Likewise.
310         (get_address_of_lvalue::write_reproducer): Likewise.
311         (get_address_of_lvalue::get_precedence): Likewise.
312         (local::replay_into): Likewise.
313         (local::visit_children): Likewise.
314         (local::write_to_dump): Likewise.
315         (local::make_debug_string): Likewise.
316         (local::write_reproducer): Likewise.
317         (local::get_precedence): Likewise.
318         (statement::write_to_dump): Likewise.
319         (eval::replay_into): Likewise.
320         (eval::make_debug_string): Likewise.
321         (eval::write_reproducer): Likewise.
322         (assignment::replay_into): Likewise.
323         (assignment::make_debug_string): Likewise.
324         (assignment::write_reproducer): Likewise.
325         (assignment_op::replay_into): Likewise.
326         (assignment_op::make_debug_string): Likewise.
327         (assignment_op::write_reproducer): Likewise.
328         (comment::replay_into): Likewise.
329         (comment::make_debug_string): Likewise.
330         (comment::write_reproducer): Likewise.
331         (conditional::replay_into): Likewise.
332         (conditional::get_successor_blocks): Likewise.
333         (conditional::make_debug_string): Likewise.
334         (conditional::write_reproducer): Likewise.
335         (jump::replay_into): Likewise.
336         (jump::get_successor_blocks): Likewise.
337         (jump::make_debug_string): Likewise.
338         (jump::write_reproducer): Likewise.
339         (return_::replay_into): Likewise.
340         (return_::get_successor_blocks): Likewise.
341         (return_::make_debug_string): Likewise.
342         (return_::write_reproducer): Likewise.
343         (case_::replay_into): Likewise.
344         (case_::write_reproducer): Likewise.
345         (case_::make_debug_string): Likewise.
346         (switch_::replay_into): Likewise.
347         (switch_::get_successor_blocks): Likewise.
348         (switch_::make_debug_string): Likewise.
349         (switch_::write_reproducer): Likewise.
351 2016-02-08  David Malcolm  <dmalcolm@redhat.com>
353         * dummy-frontend.c (jit_langhook_init): Remove
354         second argument to build_common_tree_nodes to
355         track r233218.
357 2016-01-23  Iain Buclaw  <ibuclaw@gdcproject.org>
359         * jit-playback.c: Include pthread.h.
361 2016-01-19  David Malcolm  <dmalcolm@redhat.com>
363         PR jit/69144
364         * jit-playback.c (gcc::jit::playback::compile_to_file::postprocess):
365         Potentially add the temporary artifact to the tempdir's list of
366         tempfiles needing additional cleanup.
367         (gcc::jit::playback::context::extract_any_requested_dumps): Likewise
368         for the dumpfile.
369         * jit-tempdir.c (gcc::jit::tempdir::~tempdir): Clean up additional
370         tempfiles.
371         * jit-tempdir.h (gcc::jit::tempdir::add_temp_file): New method.
372         (gcc::jit::tempdir::m_tempfiles): New field.
373         * docs/cp/intro/tutorial04.rst: Update for changes to toyvm.cc.
374         * docs/examples/tut04-toyvm/toyvm.cc (class compilation_result):
375         New.
376         (toyvm_function::compile): Change return type from function ptr
377         to a compilation_result.
378         (toyvm_function::get_function_name): New accessor.
379         (toyvm_function::m_funcname): New field.
380         (get_function_name): Convert to...
381         (toyvm_function::make_function_name): ...this new method.
382         (toyvm_function::parse): Call make_function_name.
383         (toyvm_function::compile): Convert return type from function ptr
384         to a compilation_result.  Use get_function_name.
385         (compilation_state::compile): Convert return type from
386         gcc_jit_result * to a compilation_result.
387         (test_script): Update for above changes, extracting the code from
388         the compilation_result.
389         (main): Likewise.
390         * docs/_build/texinfo/libgccjit.texi: Regenerate.
392 2016-01-04  Jakub Jelinek  <jakub@redhat.com>
394         Update copyright years.
396 2015-11-11  Andrew MacLeod  <amacleod@redhat.com>
398         * dummy-frontend.c: Remove unused header files.
399         * jit-builtins.c: Likewise.
400         * jit-playback.c: Likewise.
401         * jit-recording.c: Likewise.
402         * jit-spec.c: Likewise.
403         * libgccjit.c: Likewise.
405 2015-11-07  Richard Sandiford  <richard.sandiford@arm.com>
407         * jit-builtins.c: Don't undef DEF_BUILTIN.
409 2015-10-29  Andrew MacLeod  <amacleod@redhat.com>
411         * dummy-frontend.c: Reorder #include's and remove duplicates.
412         * jit-builtins.c: Likewise.
413         * jit-playback.c: Likewise.
414         * jit-recording.c: Likewise.
415         * libgccjit.c: Likewise.
417 2015-10-13  Jakub Jelinek  <jakub@redhat.com>
419         * jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
420         DEF_FUNCTION_TYPE_11): Define.
421         * jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
422         DEF_FUNCTION_TYPE_11): Define.
424 2015-09-30  Thomas Schwinge  <thomas@codesourcery.com>
425             Ulrich Drepper  <drepper@gmail.com>
427         * jit-builtins.h: Undefine DEF_FUNCTION_TYPE_VAR_6 after use.
429 2015-09-30  Matthias Klose  <doko@ubuntu.com>
431         * jit-builtins.h Define DEF_FUNCTION_TYPE_VAR_6,
432         remove DEF_FUNCTION_TYPE_VAR_11.
433         * jit-builtins.c (builtins_manager::make_type): Define and handle
434         DEF_FUNCTION_TYPE_VAR_6, remove DEF_FUNCTION_TYPE_VAR_11.
436 2015-08-25  David Malcolm  <dmalcolm@redhat.com>
438         * docs/cp/topics/contexts.rst
439         (gccjit::context::set_bool_use_external_driver): New.
440         * docs/internals/test-hello-world.exe.log.txt: Update.
441         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_5): New.
442         * docs/topics/contexts.rst
443         (gcc_jit_context_set_bool_use_external_driver): New.
444         * jit-common.h (enum inner_bool_option): Add
445         INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
446         * jit-playback.c (gcc_driver_name): New global.
447         (gcc:jit::playback::context::invoke_driver): Split out second
448         half into...
449         (gcc::jit::playback::context::invoke_embedded_driver): ...this new
450         function, and...
451         (gcc::jit::playback::context::invoke_external_driver): ...this new
452         function.
453         * jit-playback.h
454         (gcc::jit::playback::context::get_inner_bool_option): New.
455         (gcc::jit::playback::context::invoke_embedded_driver): New.
456         (gcc::jit::playback::context::invoke_external_driver): New.
457         * jit-recording.c (inner_bool_option_reproducer_strings):
458         Add entry for INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER.
459         * libgccjit++.h
460         (gccjit::context::set_bool_use_external_driver): New.
461         * libgccjit.c (gcc_jit_context_set_bool_use_external_driver): New.
462         * libgccjit.h (gcc_jit_context_set_bool_use_external_driver): New.
463         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_use_external_driver):
464         New.
465         * libgccjit.map (LIBGCCJIT_ABI_5): New.
466         * notes.txt: Show invocation of embedded copy of driver.
467         * docs/internals/test-hello-world.exe.log.txt: Update
469 2015-08-13  David Malcolm  <dmalcolm@redhat.com>
471         * jit-playback.c (invoke_driver): On OS X, add
472         "-Wl,-undefined,dynamic_lookup" to the driver arguments.
474 2015-08-03  David Malcolm  <dmalcolm@redhat.com>
476         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_4): New.
477         * docs/topics/contexts.rst (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY):
478         We no longer show a profile.
479         * docs/topics/index.rst (Topic Reference): Add performance.rst.
480         * docs/topics/performance.rst: New file.
481         * docs/_build/texinfo/libgccjit.texi: Regenerate.
482         * jit-playback.c (gcc::jit::playback::context::compile): Add timer
483         param when constructing the "toplev" instance.
484         (gcc::jit::playback::context::acquire_mutex): Add timer param when
485         constructing auto_timevar instance.
486         (gcc::jit::playback::context::make_fake_args): If we have a timer,
487         add "-ftime-report".
488         (gcc::jit::playback::context::invoke_driver): Add timer param when
489         constructing auto_timevar instance.
490         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
491         * jit-playback.h (gcc::jit::playback::context::get_timer): New accessor.
492         * jit-recording.c: Include timevar.h.
493         (gcc::jit::recording::context::context): Initialize field "m_timer".
494         * jit-recording.h: Add forward declaration of class timer.
495         (gcc::jit::recording::context::set_timer): New method.
496         (gcc::jit::recording::context::get_timer): New method.
497         (gcc::jit::recording::context::m_timer): New field.
498         * libgccjit++.h (gccjit::timer): New class.
499         (gccjit::auto_time): New class.
500         (gccjit::context::set_timer): New method.
501         (gccjit::context::get_timer): New.
502         (gccjit::timer::timer): New.
503         (gccjit::timer::push): New.
504         (gccjit::timer::pop): New.
505         (timer::print): New.
506         (timer::get_inner_timer): New.
507         (timer::release): New.
508         (auto_time::auto_time): New.
509         (auto_time::~auto_time): New.
510         * libgccjit.c: Include timevar.h.
511         (struct gcc_jit_timer): New.
512         (gcc_jit_timer_new): New function.
513         (gcc_jit_timer_release): New function.
514         (gcc_jit_context_set_timer): New function.
515         (gcc_jit_context_get_timer): New function.
516         (gcc_jit_timer_push): New function.
517         (gcc_jit_timer_pop): New function.
518         (gcc_jit_timer_print): New function.
519         * libgccjit.h (LIBGCCJIT_HAVE_TIMING_API): New macro.
520         (gcc_jit_timer): New typedef.
521         (gcc_jit_timer_new): New function.
522         (gcc_jit_timer_release): New function.
523         (gcc_jit_context_set_timer): New function.
524         (gcc_jit_context_get_timer): New function.
525         (gcc_jit_timer_push): New function.
526         (gcc_jit_timer_pop): New function.
527         (gcc_jit_timer_print): New function.
528         * libgccjit.map (LIBGCCJIT_ABI_4): New.
529         (gcc_jit_timer_new): New function.
530         (gcc_jit_timer_release): New function.
531         (gcc_jit_context_set_timer): New function.
532         (gcc_jit_context_get_timer): New function.
533         (gcc_jit_timer_push): New function.
534         (gcc_jit_timer_pop): New function.
535         (gcc_jit_timer_print): New function.
537 2015-07-23  David Malcolm  <dmalcolm@redhat.com>
539         * jit-playback.c (invoke_driver): Convert local "argvec"
540         to an auto_argvec, so that it owns copies of the strings,
541         rather than borrows them, updating ADD_ARG to use xstrdup
542         and special-casing the NULL terminator to avoid
543         xstrdup (NULL).  Call add_multilib_driver_arguments at the front
544         of the arguments.
545         (MULTILIB_DEFAULTS): Provide a default definition.
546         (multilib_defaults_raw): New constant array.
547         (gcc::jit::playback::context::add_multilib_driver_arguments): New
548         method.
549         * jit-playback.h
550         (gcc::jit::playback::context::add_multilib_driver_arguments): New
551         method.
552         * docs/internals/test-hello-world.exe.log.txt: Update.
553         * docs/_build/texinfo/libgccjit.texi: Regenerate.
555 2015-07-16  David Malcolm  <dmalcolm@redhat.com>
557         * docs/internals/index.rst (Overview of code structure): Add note
558         that the implementation is in C++, despite the .c extension.
559         (Submitting patches): New subsection.
560         * docs/_build/texinfo/libgccjit.texi: Regenerate.
562 2015-07-09  Andrew MacLeod  <amacleod@redhat.com>
564         * dummy-frontend.c: Adjust includes for flags.h changes.
565         * jit-common.h: Likewise.
566         * jit-playback.c: Likewise.
568 2015-07-08  David Malcolm  <dmalcolm@redhat.com>
570         PR jit/66783
571         * libgccjit.c (gcc_jit_context_new_field): Show name of field in
572         "unknown size" error message.
573         (gcc_jit_struct_set_fields): Show name of struct in error message.
574         (gcc_jit_context_new_global): Show name of global in
575         "unknown size" error message.
576         (gcc_jit_function_new_local): Likewise for local.
578 2015-07-07  Andrew MacLeod  <amacleod@redhat.com>
580         * dummy-frontend.c: Adjust includes.
581         * jit-common.h: Likewise.
582         * jit-playback.c: Likewise.
584 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
586         PR jit/66783
587         * jit-recording.h: Within namespace gcc:jit::recording...
588         (type::has_known_size): New virtual function.
589         (struct_has_known_size): New function.
590         * libgccjit.c (gcc_jit_context_new_field): Verify that the type
591         has a known size.
592         (gcc_jit_context_new_global): Likewise.
593         (gcc_jit_function_new_local): Likewise.
595 2015-07-07  David Malcolm  <dmalcolm@redhat.com>
597         PR jit/66779
598         * dummy-frontend.c (jit_langhook_type_for_mode): Ensure that we
599         handle modes QI, HI, SI, DI, TI.
601 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
603         PR jit/66700
604         * jit-playback.c (jit_mark_addressable): New function.
605         (gcc::jit::playback::lvalue::get_address): Call
606         jit_mark_addressable on the underlying tree.
608 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
610         * docs/topics/types.rst (gcc_jit_context_new_union_type): Add
611         documentation.
612         * docs/_build/texinfo/libgccjit.texi: Regenerate.
614 2015-07-01  David Malcolm  <dmalcolm@redhat.com>
616         * docs/topics/contexts.rst (gcc_jit_context_set_bool_option):
617         Clarify lack of lifetime requirements on (const char *) parameter.
618         * docs/topics/expressions.rst
619         (gcc_jit_context_new_string_literal): Likewise.
620         (gcc_jit_context_new_global): Likewise.
621         * docs/topics/functions.rst (gcc_jit_context_new_param): Likewise.
622         (gcc_jit_context_new_function): Likewise.
623         (gcc_jit_function_new_block): Likewise.
624         (gcc_jit_block_add_comment): Likewise.
625         * docs/topics/locations.rst (gcc_jit_context_new_location):
626         Likewise.
627         * docs/topics/types.rst (gcc_jit_context_new_field): Likewise.
628         (gcc_jit_context_new_struct_type): Likewise.
629         * docs/_build/texinfo/libgccjit.texi: Regenerate.
631 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
633         * docs/cp/topics/functions.rst (Blocks): Add switch statements to
634         list of ways to terminate a block.
635         (gccjit::block::end_with_switch): Add function description.
636         (gccjit::case_): Add class.
637         (gccjit::context::new_case): Add function description.
638         * docs/cp/topics/objects.rst: Add "case_" to class hierarchy.
639         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_3): New.
640         * docs/topics/functions.rst (Blocks): Add switch statements to
641         list of ways to terminate a block.
642         (gcc_jit_block_end_with_switch): Add function description.
643         (gcc_jit_case): Add type.
644         (gcc_jit_context_new_case): Add function description.
645         (gcc_jit_case_as_object): Add function description.
646         * docs/topics/objects.rst: Add gcc_jit_case to class hierarchy.
647         * docs/_build/texinfo/libgccjit.texi: Regenerate.
648         * jit-common.h (gcc::jit::recording::case_): Add forward decl.
649         (gcc::jit::playback::case_): Add forward decl.
650         * jit-playback.c (add_case): New function.
651         (gcc::jit::playback::block::add_switch): New function.
652         * jit-playback.h (gcc::jit::playback::case_): New struct.
653         (gcc::jit::playback::block::get_function): New method.
654         (gcc::jit::playback::block::add_switch): New method.
655         * jit-recording.c: Within namespace gcc::jit...
656         (recording::context::new_case): New method.
657         (recording::function::validate): Update for change to
658         get_successor_blocks.
659         (recording::block::end_with_switch): New method.
660         (recording::block::get_successor_blocks): Update to support an
661         arbitrary number of successor blocks.
662         (recording::block::dump_edges_to_dot): Likewise.
663         (memento_of_new_rvalue_from_const <int>::get_wide_int): New.
664         (memento_of_new_rvalue_from_const <long>::get_wide_int): New.
665         (memento_of_new_rvalue_from_const <double>::get_wide_int): New.
666         (memento_of_new_rvalue_from_const <void *>::get_wide_int): New.
667         (recording::statement::get_successor_blocks): Update to support an
668         arbitrary number of successor blocks.
669         (recording::conditional::get_successor_blocks): Likewise.
670         (recording::jump::get_successor_blocks): Likewise.
671         (recording::return_::get_successor_blocks): Likewise.
672         (recording::case_::write_reproducer): New.
673         (recording::case_::make_debug_string): New.
674         (recording::switch_::switch_): New.
675         (recording::switch_::replay_into): New.
676         (recording::switch_::get_successor_blocks): New.
677         (recording::switch_::make_debug_string): New.
678         (recording::switch_::write_reproducer): New.
679         * jit-recording.h: Within namespace gcc::jit::recording...
680         (context::new_case): New.
681         (rvalue::is_constant): New.
682         (rvalue::get_wide_int): New.
683         (block::end_with_switch): New.
684         (block::get_successor_blocks): Update to support an arbitrary
685         number of successor blocks.
686         (memento_of_new_rvalue_from_const::is_constant): New.
687         (memento_of_new_rvalue_from_const::get_wide_int): New.
688         (statement::get_successor_blocks): Update to support an arbitrary
689         number of successor blocks.
690         (conditional::get_successor_blocks): Likewise.
691         (jump::get_successor_blocks): Likewise.
692         (return_::get_successor_blocks): Likewise.
693         (case_): New subclass of memento.
694         (switch_): New subclass of statement.
695         * libgccjit++.h (gccjit::case_): New subclass of gccjit::object.
696         (gccjit::context::new_case): New method.
697         (gccjit::block::end_with_switch): New method.
698         (gccjit::case_::case): New ctors.
699         (gccjit::case_::get_inner_case): New method.
700         * libgccjit.c: Include "typed-splay-tree.h"
701         (struct gcc_jit_case): New.
702         (gcc_jit_context_new_case): New function.
703         (gcc_jit_case_as_object): New function.
704         (valid_dest_for_switch): New function.
705         (valid_case_for_switch): New function.
706         (class api_call_validator): New class.
707         (class case_range_validator): New class.
708         (case_range_validator::case_range_validator): New.
709         (case_range_validator::validate): New.
710         (case_range_validator::case_compare): New.
711         (case_range_validator::get_wide_int): new.
712         (gcc_jit_block_end_with_switch): New.
713         * libgccjit.h: Add gcc_jit_case to class hierarchy comment.
714         (gcc_jit_case): New typedef.
715         (gcc_jit_context_new_case): New function.
716         (gcc_jit_case_as_object): New function.
717         (gcc_jit_block_end_with_switch): New function.
718         (LIBGCCJIT_HAVE_SWITCH_STATEMENTS): New.
719         * libgccjit.map: Add gcc_jit_block_end_with_switch,
720         gcc_jit_case_as_object and gcc_jit_context_new_case.
722 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
724         PR jit/66546
725         * docs/cp/topics/contexts.rst
726         (gccjit::context::set_bool_allow_unreachable_blocks): New.
727         * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New.
728         * docs/topics/contexts.rst (Options): Add notes discussing the
729         transition from enums to entrypoints for new options.
730         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
731         * docs/_build/texinfo/libgccjit.texi: Regenerate.
732         * jit-common.h (gcc::jit::inner_bool_option): New enum.
733         * jit-recording.c: Within namespace gcc::jit...
734         (recording::context::context): Handle m_inner_bool_options.
735         (recording::context::set_inner_bool_option): New.
736         (inner_bool_option_reproducer_strings): New.
737         (recording::context::log_all_options): Log the "inner" bool
738         options.
739         (recording::context::log_inner_bool_option): New.
740         (recording::context::dump_reproducer_to_file): Write initializers
741         for "inner" bool options.
742         (recording::function::validate): Don't check for block
743         reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set.
744         * jit-recording.h: Within namespace gcc::jit...
745         (recording::context::set_inner_bool_option): New.
746         (recording::context::get_inner_bool_option): New.
747         (recording::context::log_inner_bool_option): New.
748         (recording::context::m_inner_bool_options): New.
749         * libgccjit++.h
750         (gccjit::context::set_bool_allow_unreachable_blocks): New.
751         * libgccjit.c
752         (gcc_jit_context_set_bool_allow_unreachable_blocks): New.
753         * libgccjit.h: Add note about options present in the
754         initial release of libgccjit.
755         (gcc_jit_context_set_bool_allow_unreachable_blocks): New API
756         entrypoint.
757         (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks):
758         New macro.
759         * libgccjit.map (LIBGCCJIT_ABI_2): New, containing...
760         (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new
761         entrypoint.
763 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
765         PR jit/66628
766         * docs/cp/topics/contexts.rst (Additional command-line options):
767         New section.
768         * docs/topics/compatibility.rst: New file.
769         * docs/topics/contexts.rst (Additional command-line options): New
770         section.
771         * docs/topics/index.rst: Add compatibility.rst.
772         * docs/_build/texinfo/libgccjit.texi: Regenerate.
773         * jit-playback.c (make_fake_args): Add call to
774         append_command_line_options.
775         * jit-recording.c: Within namespace gcc::jit...
776         (recording::context::~context): Free the optnames within
777         m_command_line_options.
778         (recording::context::set_bool_option): Likewise.
779         (recording::context::add_command_line_option): New method.
780         (recording::context::append_command_line_options): New method.
781         (recording::context::dump_reproducer_to_file): Add command-line
782         options.
783         * jit-recording.h: Within namespace gcc::jit...
784         (recording::context::add_command_line_option): New method.
785         (recording::context::append_command_line_options): New method.
786         (recording::context::m_command_line_options): New field.
787         * libgccjit++.h (gccjit::context::add_command_line_option): New
788         method.
789         * libgccjit.c (gcc_jit_context_add_command_line_option): New API
790         entrypoint.
791         * libgccjit.h (gcc_jit_context_add_command_line_option): New API
792         entrypoint.
793         (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option): New
794         macro.
795         * libgccjit.map: Put existing symbols within LIBGCCJIT_ABI_0; add
796         LIBGCCJIT_ABI_1 and gcc_jit_context_add_command_line_option.
798 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
800         * jit-recording.c
801         (gcc::jit::recording::context::dump_reproducer_to_file):
802         Add pragma to generated reproducers to disable -Wunused-variable.
803         Fix handling of NULL string options.
805 2015-06-30  David Malcolm  <dmalcolm@redhat.com>
807         * docs/cp/topics/expressions.rst: Remove stray semicolon.
808         * docs/cp/topics/functions.rst: Remove stray backslash.
809         * docs/_build/texinfo/libgccjit.texi: Regenerate.
811 2015-06-25  Andrew MacLeod  <amacleod@redhat.com>
813         * dummy-frontend.c: Remove ipa-ref.h and plugin-api.h from include list.
814         * jit-playback.c: Likewise.
816 2015-06-25  Andrew Macleod  <amacleod@redhat.com>
818         * jit-common.h: Don't include alias.h.
820 2015-06-17  David Malcolm  <dmalcolm@redhat.com>
822         * libgccjit.c (gcc_jit_lvalue_access_field): Verify that the field
823         is for the correct struct.
824         (gcc_jit_rvalue_access_field): Likewise.
826 2015-06-17  Andrew MacLeod  <amacleod@redhat.com>
828         * dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
829         * jit-common.h: Likewise.
830         * jit-playback.c: Likewise.
832 2015-06-16  David Malcolm  <dmalcolm@redhat.com>
834         PR jit/66539
835         * jit-recording.c: Within namespace gcc::jit::recording::
836         (rvalue::get_debug_string_parens): New function.
837         (binary_op::make_debug_string): Update to mimic C precedence
838         rules.
839         (binary_op_precedence): New array.
840         (binary_op::get_precedence): New function.
841         (comparison::make_debug_string): Update to mimic C precedence
842         rules.
843         (comparison_precedence): New array.
844         (comparison::get_precedence): New function.
845         (cast::make_debug_string): Update to mimic C precedence rules.
846         (call::make_debug_string): Likewise.
847         (call_through_ptr::make_debug_string): Likewise.
848         (array_access::make_debug_string): Likewise.
849         (access_field_of_lvalue::make_debug_string): Likewise.
850         (access_field_rvalue::make_debug_string): Likewise.
851         (dereference_field_rvalue::make_debug_string): Likewise.
852         (dereference_rvalue::make_debug_string): Likewise.
853         (get_address_of_lvalue::make_debug_string): Likewise.
854         * jit-recording.h: Within namespace gcc::jit::recording::
855         (precedence): New enum.
856         (rvalue::rvalue): Initialize field "m_parenthesized_string".
857         (rvalue::get_debug_string_parens): New method.
858         (rvalue::get_precedence): New pure virtual function.
859         (rvalue::m_parenthesized_string): New field.
860         (param::get_precedence): New function.
861         (global::get_precedence): New function.
862         (memento_of_new_rvalue_from_const::get_precedence): New function.
863         (memento_of_new_string_literal::get_precedence): New function.
864         (unary_op::get_precedence): New function.
865         (binary_op::get_precedence): New function.
866         (comparison::get_precedence): New function.
867         (cast::get_precedence): New function.
868         (call::get_precedence): New function.
869         (call_through_ptr::get_precedence): New function.
870         (array_access::get_precedence): New function.
871         (access_field_of_lvalue::get_precedence): New function.
872         (access_field_rvalue::get_precedence): New function.
873         (dereference_field_rvalue::get_precedence): New function.
874         (dereference_rvalue::get_precedence): New function.
875         (get_address_of_lvalue::get_precedence): New function.
876         (local::get_precedence): New function.
878 2015-06-09  Matthias Klose  <doko@ubuntu.com>
880         * Make-lang.in (jit.install-common): Install headers using INSTALL_DATA.
882 2015-06-08  Andrew MacLeod  <amacleod@redhat.com>
884         * dummy-frontend.c : Adjust include files.
885         * jit-common.h : Likewise.
886         * jit-playback.c : Likewise.
888 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
890         * dummy-frontend.c
891         (jit_langhook_post_compilation_parsing_cleanups): Remove.
892         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): Remove
893         * jit-playback.c (gcc::jit::playback::context::new_global): Add
894         call to varpool_node::finalize_decl.
895         (gcc::jit::playback::context::finalize_global_decls): Remove.
896         * jit-playback.h
897         (gcc::jit::playback::context::finalize_global_decls): Remove.
899 2015-06-05  David Malcolm  <dmalcolm@redhat.com>
901         * dummy-frontend.c (jit_langhook_write_globals): Rename to...
902         (jit_langhook_post_compilation_parsing_cleanups): ...this, and
903         eliminate calls to finalize_compilation_unit and
904         write_global_decls_2.
905         (LANG_HOOKS_WRITE_GLOBALS): Rename to...
906         (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): ...this and
907         redirect from jit_langhook_write_globals to
908         jit_langhook_post_compilation_parsing_cleanups.
909         * jit-playback.c
910         (gcc::jit::playback::context::write_global_decls_1): Rename to...
911         (gcc::jit::playback::context::finalize_global_decls): ...this.
912         (gcc::jit::playback::context::write_global_decls_1): Delete.
913         * jit-playback.h
914         (gcc::jit::playback::context::write_global_decls_1): Rename to...
915         (gcc::jit::playback::context::finalize_global_decls): ...this.
916         (gcc::jit::playback::context::write_global_decls_1): Delete.
918 2015-06-04  Andrew MacLeod  <amacleod@redhat.com>
920         * dummy-frontend.c: Adjust includes for restructured coretypes.h.
921         * jit-common.h: Likewise.
922         * jit-playback.c: Likewise.
924 2015-05-12  David Malcolm  <dmalcolm@redhat.com>
926         * jit-builtins.c: Include vec.h before target.h.
928 2015-04-27  Jim Wilson  <jim.wilson@linaro.org>
930         * Make-lang.in (jit.mostlyclean): Remove shared libraries and object
931         files.
933 2015-04-09  David Malcolm  <dmalcolm@redhat.com>
935         PR jit/65691
936         * docs/cp/topics/expressions.rst (Simple expressions): Fix copy
937         and paste error in description of gccjit::context::one.
938         * docs/topics/expressions.rst (Simple expressions): Likewise in
939         description of gcc_jit_context_one.
940         * docs/_build/texinfo/libgccjit.texi: Regenerate.
942 2015-03-13  Uros Bizjak  <ubizjak@gmail.com>
944         * jit-recording.c (dump::write): Also check vasprintf return value.
945         (recording::context::add_error_va): Ditto.
946         (recording::string::from_printf): Ditto.
948 2015-03-13  David Malcolm  <dmalcolm@redhat.com>
950         * docs/internals/index.rst (Packaging notes): New section.
951         * docs/_build/texinfo/libgccjit.texi: Regenerate.
953 2015-03-05  David Malcolm  <dmalcolm@redhat.com>
955         * docs/cp/intro/tutorial03.rst: Add missing arguments to
956         gccjit::block::end_with_conditional call.  Add on_true/on_false
957         comments.  Tweak the wording.
958         * docs/intro/tutorial03.rst: Add missing arguments to
959         gcc_jit_block_end_with_conditional call.  Add some clarifying
960         comments.
961         * docs/topics/compilation.rst: Tweak the wording to avoid an
962         ambiguous use of "this".
963         * docs/topics/contexts.rst: Fix a typo.
964         * docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
965         a stray backtick.
966         * docs/_build/texinfo/libgccjit.texi: Regenerate.
968 2015-02-24  Thomas Schwinge  <thomas@codesourcery.com>
970         PR libgomp/64625
971         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8)
972         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
973         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
974         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_8)
975         (DEF_FUNCTION_TYPE_VAR_12): Remove macros.
976         (DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
978 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
980         PR jit/64257
981         * docs/conf.py (html_theme): Change from 'pyramid'
982         to 'sphinxdoc'.
984 2015-02-04  David Malcolm  <dmalcolm@redhat.com>
986         * docs/topics/contexts.rst (gcc_jit_context_acquire): Fix
987         typo.
988         * docs/_build/texinfo/libgccjit.texi: Regenerate.
990 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
992         * jit-logging.h (gcc::jit::log_user::log): Make const.
993         * jit-recording.c (gcc::jit::recording::context::set_str_option):
994         Log the new value of the option.
995         (gcc::jit::recording::context::set_int_option): Likewise.
996         (gcc::jit::recording::context::set_bool_option): Likewise.
997         (gcc::jit::recording::context::compile): Log the value of all
998         options.
999         (gcc::jit::recording::context::compile_to_file): Likewise.
1000         (gcc::jit::recording::context::log_all_options): New function.
1001         (gcc::jit::recording::context::log_str_option): New function.
1002         (gcc::jit::recording::context::log_int_option): New function.
1003         (gcc::jit::recording::context::log_bool_option): New function.
1004         * jit-recording.h (gcc::jit::recording::context::log_all_options):
1005         New function.
1006         (gcc::jit::recording::context::log_str_option): New function.
1007         (gcc::jit::recording::context::log_int_option): New function.
1008         (gcc::jit::recording::context::log_bool_option): New function.
1009         * docs/internals/test-hello-world.exe.log.txt: Update for above
1010         changes.
1011         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1013 2015-02-03  David Malcolm  <dmalcolm@redhat.com>
1015         PR jit/64810
1016         * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
1017         (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
1018         * jit-playback.c: Include gcc.h.
1019         (gcc::jit::playback::context::compile): Move mutex acquisition
1020         to before the call to make_fake_args.
1021         (append_arg_from_driver): New function.
1022         (gcc::jit::playback::context::make_fake_args): On the first call,
1023         call into driver_get_configure_time_options to get configure-time
1024         default options and cache them.  Add them to the args for
1025         toplev::main.
1026         * jit-spec.c: New source file.
1027         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
1028         above changes.
1029         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1031 2015-02-02  David Malcolm  <dmalcolm@redhat.com>
1033         PR jit/64810
1034         * dummy-frontend.c (jit_langhook_type_for_mode): Support
1035         TYPE_MODE (long_long_integer_type_node).
1037 2015-01-27  David Malcolm  <dmalcolm@redhat.com>
1039         * docs/internals/test-hello-world.exe.log.txt: Add example version
1040         lines.
1041         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1042         * jit-common.h (gcc::jit::dump::get_file): New accessor.
1043         * jit-logging.c: Include toplev.h.
1044         (gcc::jit::logger::logger): Log the GCC version.
1045         * jit-recording.c: Include toplev.h.
1046         (gcc:jit::recording::context::dump_reproducer_to_file): Log the
1047         GCC version.
1049 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
1051         * docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
1052         * docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
1053         error buffer is only valid until the next call to the context.
1054         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1055         * libgccjit.h (gcc_jit_context_get_first_error): Reword the
1056         comment to omit mention of compiling.
1057         (gcc_jit_context_get_last_error): The error buffer is only valid
1058         until the next call to the context.
1060 2015-01-26  David Malcolm  <dmalcolm@redhat.com>
1062         PR jit/64708
1063         * config-lang.in (compilers): Drop "libgccjit.so".
1065 2015-01-23  David Malcolm  <dmalcolm@redhat.com>
1067         PR jit/64721
1068         * jit-playback.c (gcc::jit::playback::context::compile): Construct
1069         toplev instances with init_signals=false.
1071 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
1073         * docs/cp/topics/results.rst: Rename to...
1074         * docs/cp/topics/compilation.rst: ...this, and add section on
1075         ahead-of-time compilation.
1076         * docs/cp/topics/index.rst: Update for renaming of results.rst
1077         to compilation.rst.
1078         * docs/examples/emit-alphabet.bf: New file, a sample "brainf"
1079         script.
1080         * docs/examples/tut05-bf.c: New file, implementing a compiler
1081         for "brainf".
1082         * docs/internals/test-hello-world.exe.log.txt: Update to reflect
1083         changes to logger output.
1084         * docs/intro/index.rst: Add tutorial05.rst
1085         * docs/intro/tutorial05.rst: New file.
1086         * docs/topics/results.rst: Rename to...
1087         * docs/topics/compilation.rst: ...this, and add section on
1088         ahead-of-time compilation.
1089         * docs/topics/index.rst: Update for renaming of results.rst to
1090         compilation.rst.
1091         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1092         * jit-playback.c (gcc::jit::playback::context::compile): Convert
1093         return type from result * to void.  Move the code to convert to
1094         dso and dlopen the result to a new pure virtual "postprocess"
1095         method.
1096         (gcc::jit::playback::compile_to_memory::compile_to_memory): New
1097         function.
1098         (gcc::jit::playback::compile_to_memory::postprocess): New
1099         function, based on playback::context::compile.
1100         (gcc::jit::playback::compile_to_file::compile_to_file): New
1101         function.
1102         (gcc::jit::playback::compile_to_file::postprocess): New function.
1103         (gcc::jit::playback::compile_to_file::copy_file): New function.
1104         (gcc::jit::playback::context::convert_to_dso): Move internals
1105         to...
1106         (gcc::jit::playback::context::invoke_driver): New method.  Add
1107         "-shared" and "-c" options to driver's argv as needed.
1108         * jit-playback.h: Include "timevar.h".
1109         (gcc::jit::playback::context::compile): Convert return type from
1110         result * to void.
1111         (gcc::jit::playback::context::postprocess): New pure virtual
1112         function, making this an abstract base class.
1113         (gcc::jit::playback::context::get_tempdir): New accessor.
1114         (gcc::jit::playback::context::invoke_driver): New function.
1115         (class gcc::jit::playback::compile_to_memory): New subclass of
1116         playback::context.
1117         (class gcc::jit::playback::compile_to_file): Likewise.
1118         * jit-recording.c (gcc::jit::recording::context::compile): Use a
1119         playback::compile_to_memory, and extract its result.
1120         (gcc::jit::recording::context::compile_to_file): New function.
1121         * jit-recording.h (gcc::jit::recording::context::compile_to_file):
1122         New function.
1123         * libgccjit++.h (gccjit::context::compile_to_file): New method.
1124         * libgccjit.c (gcc_jit_context_compile): Update log message to
1125         clarify that this is an in-memory compile.
1126         (gcc_jit_context_compile_to_file): New function.
1127         * libgccjit.h (gcc_jit_context): Clarify that you can compile
1128         a context more than once, and that you can compile to a file
1129         as well as to memory.
1130         (gcc_jit_result): Clarify that this is the result of an
1131         in-memory compilation.
1132         (gcc_jit_context_compile): Clarify that you can compile, and that
1133         this is an in-memory compilation.
1134         (enum gcc_jit_output_kind): New enum.
1135         (gcc_jit_context_compile_to_file): New function.
1136         (gcc_jit_context_enable_dump): Clarify comment to cover both forms
1137         of compilation.
1138         * libgccjit.map (gcc_jit_context_compile_to_file): New API
1139         entrypoint.
1140         * notes.txt: Update to show the playback::context::postprocess
1141         virtual function.
1143 2015-01-19  David Malcolm  <dmalcolm@redhat.com>
1145         * jit-recording.c
1146         (gcc::jit::recording::memento_of_new_string_literal::make_debug_string):
1147         Add missing format string.
1149 2015-01-16  David Malcolm  <dmalcolm@redhat.com>
1151         * Make-lang.in (lang_checks_parallelized): Add "check-jit".
1152         (check_jit_parallelize): Set this to an arbitrary value (10).
1154 2015-01-16  Jakub Jelinek  <jakub@redhat.com>
1156         * jit-builtins.h (DEF_FUNCTION_TYPE_VAR_5): Fix spelling of
1157         last argument.
1158         (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): Define and
1159         undef afterwards.
1160         * jit-builtins.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
1161         Likewise.
1163 2015-01-15  Richard Sandiford  <richard.sandiford@arm.com>
1165         Update copyright years in docs/.
1167 2015-01-15  David Malcolm  <dmalcolm@redhat.com>
1169         * libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
1170         lvalue and the rvalue are of compatible type.
1172 2015-01-13  David Malcolm  <dmalcolm@redhat.com>
1174         * docs/cp/topics/contexts.rst (Debugging): Add
1175         gccjit::context::dump_reproducer_to_file.
1176         * docs/internals/index.rst (Design notes): New section,
1177         discussing input validation and
1178         gcc_jit_context_dump_reproducer_to_file.
1179         * docs/topics/contexts.rst (Debugging): Add
1180         gcc_jit_context_dump_reproducer_to_file.
1181         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1182         * jit-common.h (gcc::jit::dump::get_context): New accessor.
1183         * jit-recording.c: Include "hash-map.h".
1184         Within namespace ::gcc::jit...
1185         (dump::write): Flush each line.
1186         (dump::make_location): Pass false for new param "created_by_user".
1187         (class allocator): New class.
1188         (allocator::~allocator): New function.
1189         (allocator::xstrdup_printf): New function.
1190         (allocator::xstrdup_printf_va): New function.
1191         (class reproducer): New subclass of dump.
1192         (reproducer::reproducer): New function.
1193         (reproducer::write_params): New function.
1194         (reproducer::write_args): New function.
1195         (reproducer::make_identifier): New function.
1196         (reproducer::make_tmp_identifier): New function.
1197         (reproducer::get_identifier): New pair of functions.
1198         (reproducer::get_identifier_as_rvalue): New function.
1199         (reproducer::get_identifier_as_lvalue): New function.
1200         (reproducer::get_identifier_as_type): New function.
1201         (reproducer::xstrdup_printf): New function.
1202         (recording::context::context): Initialize m_toplevel_ctxt.
1203         (recording::context::new_location): Add param created_by_user.
1204         (str_option_reproducer_strings): New table of strings.
1205         (int_option_reproducer_strings): Likewise.
1206         (bool_option_reproducer_strings): Likewise.
1207         (get_type_enum_strings): Likewise.
1208         (names_of_function_kinds): Likewise.
1209         (global_kind_reproducer_strings): Likewise.
1210         (unary_op_reproducer_strings): Likewise.
1211         (binary_op_reproducer_strings): Likewise.
1212         (comparison_reproducer_strings): Likewise.
1213         Within namespace ::gcc::jit::recording::...
1214         (context::dump_reproducer_to_file): New function.
1215         (string::write_reproducer): Likewise.
1216         (location::write_reproducer): Likewise.
1217         (type::access_as_type): Likewise.
1218         (memento_of_get_type::write_reproducer): Likewise.
1219         (memento_of_get_pointer::write_reproducer): Likewise.
1220         (memento_of_get_const::write_reproducer): Likewise.
1221         (memento_of_get_volatile::write_reproducer): Likewise.
1222         (array_type::write_reproducer): Likewise.
1223         (function_type::write_reproducer): Likewise.
1224         (function_type::write_deferred_reproducer): Likewise.
1225         (field::write_reproducer): Likewise.
1226         (struct_::access_as_type): Likewise.
1227         (struct_::write_reproducer): Likewise.
1228         (union_::write_reproducer): Likewise.
1229         (fields::write_reproducer): Likewise.
1230         (rvalue::access_as_rvalue): Likewise.
1231         (lvalue::access_as_rvalue): Likewise.
1232         (lvalue::access_as_lvalue): Likewise.
1233         (param::access_as_rvalue): Likewise.
1234         (param::access_as_lvalue): Likewise.
1235         (param::write_reproducer): Likewise.
1236         (function::write_reproducer): Likewise.
1237         (block::write_reproducer): Likewise.
1238         (global::write_reproducer): Likewise.
1239         (memento_of_new_rvalue_from_const <int>::write_reproducer):
1240         Likewise.
1241         (memento_of_new_rvalue_from_const <long>::write_reproducer):
1242         Likewise.
1243         (memento_of_new_rvalue_from_const <double>::write_reproducer):
1244         Likewise.
1245         (memento_of_new_rvalue_from_const <void *>::write_reproducer):
1246         Likewise.
1247         (memento_of_new_string_literal::write_reproducer): Likewise.
1248         (unary_op::write_reproducer): Likewise.
1249         (binary_op::write_reproducer): Likewise.
1250         (comparison::write_reproducer): Likewise.
1251         (cast::write_reproducer): Likewise.
1252         (call::write_reproducer): Likewise.
1253         (call_through_ptr::write_reproducer): Likewise.
1254         (array_access::write_reproducer): Likewise.
1255         (access_field_of_lvalue::write_reproducer): Likewise.
1256         (access_field_rvalue::write_reproducer): Likewise.
1257         (dereference_field_rvalue::write_reproducer): Likewise.
1258         (dereference_rvalue::write_reproducer): Likewise.
1259         (get_address_of_lvalue::write_reproducer): Likewise.
1260         (local::write_reproducer): Likewise.
1261         (eval::write_reproducer): Likewise.
1262         (assignment::write_reproducer): Likewise.
1263         (assignment_op::write_reproducer): Likewise.
1264         (comment::write_reproducer): Likewise.
1265         (conditional::write_reproducer): Likewise.
1266         (jump::write_reproducer): Likewise.
1267         (return_::write_reproducer): Likewise.
1268         * jit-recording.h (gcc::jit::reproducer): New forward declararion.
1269         Within namespace ::gcc::jit::recording::...
1270         (context::new_location): Add "created_by_user" param.
1271         (context::dump_reproducer_to_file): New method.
1272         (context::m_toplevel_ctxt): New field.
1273         (memento::write_reproducer): New pure virtual function.
1274         (memento::dyn_cast_location): New virtual function.
1275         (string::write_reproducer):
1276         (location::location): Add "created_by_user" param.
1277         (location::dyn_cast_location): New function.
1278         (location::created_by_user): New accessor.
1279         (location::write_reproducer): New function.
1280         (location::m_created_by_user): New field.
1281         (type::access_as_type): New virtual function.
1282         (location::write_reproducer): Likewise.
1283         (type::access_as_type): Likewise.
1284         (memento_of_get_type::write_reproducer): Likewise.
1285         (memento_of_get_pointer::write_reproducer): Likewise.
1286         (memento_of_get_const::write_reproducer): Likewise.
1287         (memento_of_get_volatile::write_reproducer): Likewise.
1288         (array_type::write_reproducer): Likewise.
1289         (function_type::write_reproducer): Likewise.
1290         (function_type::write_deferred_reproducer): Likewise.
1291         (field::write_reproducer): Likewise.
1292         (struct_::access_as_type): Likewise.
1293         (struct_::write_reproducer): Likewise.
1294         (union_::write_reproducer): Likewise.
1295         (union_::m_fields): Remove stray unused field.
1296         (fields::length): New accessor.
1297         (fields::get_field): New accessor.
1298         (fields::write_reproducer): New function.
1299         (rvalue::access_as_rvalue): Likewise.
1300         (lvalue::access_as_rvalue): Likewise.
1301         (lvalue::access_as_lvalue): Likewise.
1302         (param::access_as_rvalue): Likewise.
1303         (param::access_as_lvalue): Likewise.
1304         (param::write_reproducer): Likewise.
1305         (function::write_reproducer): Likewise.
1306         (block::write_reproducer): Likewise.
1307         (global::write_reproducer): Likewise.
1308         (memento_of_new_rvalue_from_const <HOST_TYPE>::write_reproducer):
1309         Likewise.
1310         (memento_of_new_string_literal::write_reproducer): Likewise.
1311         (unary_op::write_reproducer): Likewise.
1312         (binary_op::write_reproducer): Likewise.
1313         (comparison::write_reproducer): Likewise.
1314         (cast::write_reproducer): Likewise.
1315         (call::write_reproducer): Likewise.
1316         (call_through_ptr::write_reproducer): Likewise.
1317         (array_access::write_reproducer): Likewise.
1318         (access_field_of_lvalue::write_reproducer): Likewise.
1319         (access_field_rvalue::write_reproducer): Likewise.
1320         (dereference_field_rvalue::write_reproducer): Likewise.
1321         (dereference_rvalue::write_reproducer): Likewise.
1322         (get_address_of_lvalue::write_reproducer): Likewise.
1323         (local::write_reproducer): Likewise.
1324         (eval::write_reproducer): Likewise.
1325         (assignment::write_reproducer): Likewise.
1326         (assignment_op::write_reproducer): Likewise.
1327         (comment::write_reproducer): Likewise.
1328         (conditional::write_reproducer): Likewise.
1329         (jump::write_reproducer): Likewise.
1330         (return_::write_reproducer): Likewise.
1331         * libgccjit++.h (gccjit::context::dump_reproducer_to_file): New.
1332         * libgccjit.c (gcc_jit_context_new_location): Pass "true" as
1333         param "created_by_user".
1334         (gcc_jit_context_dump_reproducer_to_file): New API entrypoint.
1335         * libgccjit.h (gcc_jit_context_dump_reproducer_to_file): New API
1336         entrypoint.
1337         * libgccjit.map (gcc_jit_context_dump_reproducer_to_file): New API
1338         entrypoint.
1340 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1342         * jit-recording.c (class gcc::jit::rvalue_usage_validator): New.
1343         (gcc::jit::rvalue_usage_validator::rvalue_usage_validator): New
1344         ctor.
1345         (gcc::jit::rvalue_usage_validator::visit): New function.
1346         (gcc::jit::recording::rvalue::verify_valid_within_stmt): New
1347         function.
1348         (gcc::jit::recording::rvalue::set_scope): New function.
1349         (gcc::jit::recording::function::function): Call set_scope on each
1350         param, issuing errors for any params that already have a function.
1351         (gcc::jit::recording::block::add_eval): Return the new statement;
1352         update the comment given that some error-checking now happens after
1353         this returns.
1354         (gcc::jit::recording::block::add_assignment): Likewise.
1355         (gcc::jit::recording::block::add_assignment_op): Likewise.
1356         (gcc::jit::recording::block::add_comment): Likewise.
1357         (gcc::jit::recording::block::end_with_conditional): Likewise.
1358         (gcc::jit::recording::block::end_with_jump): Likewise.
1359         (gcc::jit::recording::block::end_with_return): Likewise.
1360         (gcc::jit::recording::block::validate): Add a comment.
1361         (gcc::jit::recording::unary_op::visit_children): New function.
1362         (gcc::jit::recording::binary_op::visit_children): New function.
1363         (gcc::jit::recording::comparison::visit_children): New function.
1364         (gcc::jit::recording::cast::visit_children): New function.
1365         (gcc::jit::recording::call::visit_children): New function.
1366         (gcc::jit::recording::call_through_ptr::visit_children): New function.
1367         (gcc::jit::recording::array_access::visit_children): New function.
1368         (gcc::jit::recording::access_field_of_lvalue::visit_children): New
1369         function.
1370         (gcc::jit::recording::access_field_rvalue::visit_children): New
1371         function.
1372         (gcc::jit::recording::dereference_field_rvalue::visit_children):
1373         New function.
1374         (gcc::jit::recording::dereference_rvalue::visit_children): New
1375         function.
1376         (gcc::jit::recording::get_address_of_lvalue::visit_children): New
1377         function.
1378         * jit-recording.h: Within namespace gcc::jit::recording...
1379         (class rvalue_visitor): New.
1380         (rvalue::rvalue): Initialize m_scope.
1381         (rvalue::get_loc): New accessor.
1382         (rvalue::verify_valid_within_stmt): New function.
1383         (rvalue::visit_children): New pure virtual function.
1384         (rvalue::set_scope): New function.
1385         (rvalue::get_scope): New function.
1386         (rvalue::dyn_cast_param): New function.
1387         (rvalue::m_scope): New field.
1388         (param::visit_children): New empty function.
1389         (param::dyn_cast_param): New function.
1390         (function::get_loc): New function.
1391         (block::add_eval): Return the new statement.
1392         (block::add_assignment): Likewise.
1393         (block::add_assignment_op): Likewise.
1394         (block::add_comment): Likewise.
1395         (block::end_with_conditional): Likewise.
1396         (block::end_with_jump): Likewise.
1397         (block::end_with_return): Likewise.
1398         (global::visit_children): New function.
1399         (memento_of_new_rvalue_from_const<HOST_TYPE>::visit_children):
1400         New function.
1401         (memento_of_new_string_literal::visit_children): New function.
1402         (unary_op::visit_children): New function.
1403         (binary_op::visit_children): New function.
1404         (comparison::visit_children): New function.
1405         (cast::visit_children): New function.
1406         (call::visit_children): New function.
1407         (call_through_ptr::visit_children): New function.
1408         (array_access::visit_children): New function.
1409         (access_field_of_lvalue::visit_children): New function.
1410         (access_field_rvalue::visit_children): New function.
1411         (dereference_field_rvalue::visit_children): New function.
1412         (dereference_rvalue::visit_children): New function.
1413         (get_address_of_lvalue::visit_children): New function.
1414         (local::local): Call set_scope.
1415         (local::visit_children): New function.
1416         (statement::get_block): Make public.
1417         * libgccjit.c (RETURN_VAL_IF_FAIL_PRINTF5): New macro.
1418         (RETURN_NULL_IF_FAIL_PRINTF5): New macro.
1419         (gcc_jit_context_new_function): Verify that each param has
1420         not yet been used for creating another function.
1421         (gcc_jit_block_add_eval): After creating the stmt, verify
1422         that the rvalue expression tree is valid to use within it.
1423         (gcc_jit_block_add_assignment): Likewise for the lvalue and
1424         rvalue expression trees.
1425         (gcc_jit_block_add_assignment_op): Likewise.
1426         (gcc_jit_block_end_with_conditional): Likewise for the boolval
1427         expression tree.
1428         (gcc_jit_block_end_with_return): Likewise for the rvalue
1429         expression tree.
1430         (gcc_jit_block_end_with_void_return): Remove return of "void",
1431         now that block::end_with_return is now non-void.
1433 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1435         * jit-playback.c (gcc::jit::playback::context::read_dump_file):
1436         Add missing fclose on error-handling path.
1438 2015-01-12  David Malcolm  <dmalcolm@redhat.com>
1440         * docs/cp/topics/expressions.rst (Global variables): Add
1441         enum gcc_jit_global_kind param to gccjit::context::new_global.
1442         * docs/topics/expressions.rst (Global variables): Likewise.
1443         Document the new enum.
1444         * docs/topics/results.rst (Compilation results): Document
1445         globals-handling.
1446         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1447         * dummy-frontend.c (jit_langhook_write_globals): Call into the
1448         playback context's write_global_decls_1 and write_global_decls_2
1449         before and after calling symtab->finalize_compilation_unit ().
1450         * jit-playback.c: Include "debug.h".
1451         (gcc::jit::playback::context::new_global): Add "kind" param and
1452         use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
1453         underlying VAR_DECL.  Call varpool_node::get_create on the
1454         VAR_DECL, and add it to m_globals.
1455         (gcc::jit::playback::context::write_global_decls_1): New function.
1456         (gcc::jit::playback::context::write_global_decls_2): New function.
1457         * jit-playback.h (gcc::jit::playback::context::context): Call
1458         create on m_globals.
1459         (gcc::jit::playback::context::new_global): Add "kind" param.
1460         (gcc::jit::playback::context::write_global_decls_1): New function.
1461         (gcc::jit::playback::context::write_global_decls_2): New function.
1462         (gcc::jit::playback::context::m_globals): New field.
1463         * jit-recording.c (gcc::jit::recording::context::context):
1464         Initialize m_globals.
1465         (gcc::jit::recording::context::new_global): Add param "kind".
1466         Add the new global to m_globals.
1467         (gcc::jit::recording::context::dump_to_file): Dump the globals.
1468         (gcc::jit::recording::global::replay_into): Add field m_kind.
1469         (gcc::jit::recording::global::write_to_dump): New override.
1470         * jit-recording.h (gcc::jit::recording::context::new_global): Add
1471         param "kind".
1472         (gcc::jit::recording::context::m_globals): New field.
1473         (gcc::jit::recording::global::global): Add param kind.
1474         (gcc::jit::recording::global::write_to_dump): New override.
1475         (gcc::jit::recording::global::m_kind): New field.
1476         * jit-result.c (gcc::jit::result::get_global): New function.
1477         * jit-result.h (gcc::jit::result::get_global): New function.
1478         * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
1479         * libgccjit.c (gcc_jit_context_new_global): Likewise.
1480         (gcc_jit_result_get_global): New API entrypoint.
1481         * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
1482         (enum gcc_jit_global_kind): New enum.
1483         (gcc_jit_context_new_global): API change: add "kind" param.
1484         * libgccjit.map (gcc_jit_result_get_global): New symbol.
1486 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1488         * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
1489         "symtab.h", "inchash.h".  Move include of "hash-set.h" much
1490         earlier.
1491         * jit-builtins.c: Remove redundant includes of "opts.h" and
1492         "tree.h".
1493         * jit-common.h: Include "hash-set.h", "input.h", "vec.h",
1494         "double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
1495         * jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
1496         "statistics.h", "vec.h", "double-int.h", "real.h",
1497         "fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
1498         "inchash.h", "fold-const.h".  Move include of "hash-set.h" to
1499         earlier.
1500         * jit-recording.c: Remove redundant includes of "opts.h" and
1501         "tree.h".
1503 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1505         * docs/cp/topics/expressions.rst (Simple expressions): Use
1506         ":c:type:" for C types.  Document new overload of
1507         gcc::jit::context::new_rvalue.
1508         * docs/topics/expressions.rst (Simple expressions): Use
1509         ":c:type:" for C types.  Document new entrypoint
1510         gcc_jit_context_new_rvalue_from_long.
1511         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1512         * jit-playback.c: Within namespace gcc::jit::playback...
1513         (context::new_rvalue_from_int): Eliminate in favor of...
1514         (context::new_rvalue_from_const <int>): ...this.
1515         (context::new_rvalue_from_double): Eliminate in favor of...
1516         (context::new_rvalue_from_const <double>): ...this.
1517         (context::new_rvalue_from_const <long>): New.
1518         (context::new_rvalue_from_ptr): Eliminate in favor of...
1519         (context::new_rvalue_from_const <void *>): ...this.
1520         * jit-playback.h: Within namespace gcc::jit::playback...
1521         (context::new_rvalue_from_int): Eliminate in favor of...
1522         (context::new_rvalue_from_const <HOST_TYPE>): ...this.
1523         (context::new_rvalue_from_double): Likewise.
1524         (context::new_rvalue_from_ptr): Likewise.
1525         * jit-recording.c: Within namespace gcc::jit::recording...
1526         (context::new_rvalue_from_int): Eliminate.
1527         (context::new_rvalue_from_double): Likewise.
1528         (context::new_rvalue_from_ptr): Likewise.
1529         (class memento_of_new_rvalue_from_const <int>):
1530         Add explicit specialization.
1531         (class memento_of_new_rvalue_from_const <long>):
1532         Likewise.
1533         (class memento_of_new_rvalue_from_const <double>):
1534         Likewise.
1535         (class memento_of_new_rvalue_from_const <void *>):
1536         Likewise.
1537         (memento_of_new_rvalue_from_int::replay_into):
1538         Generalize into...
1539         (memento_of_new_rvalue_from_const <HOST_TYPE>::replay_into):
1540         ...this...
1541         (memento_of_new_rvalue_from_double::replay_into):
1542         ...allowing this...
1543         (memento_of_new_rvalue_from_ptr::replay_into):
1544         ...and this to be deleted.
1545         (memento_of_new_rvalue_from_int::make_debug_string):
1546         Convert to...
1547         (memento_of_new_rvalue_from_const <int>::make_debug_string):
1548         ...this.
1549         (memento_of_new_rvalue_from_double::make_debug_string):
1550         Convert to...
1551         (memento_of_new_rvalue_from_const <double>::make_debug_string):
1552         ...this.
1553         (memento_of_new_rvalue_from_ptr::make_debug_string)
1554         Convert to...
1555         (memento_of_new_rvalue_from_const <void *>::make_debug_string):
1556         ...this.
1557         (memento_of_new_rvalue_from_const <long>::make_debug_string):
1558         New function.
1559         * jit-recording.h: Within namespace gcc::jit::recording...
1560         (context::new_rvalue_from_int): Eliminate.
1561         (context::new_rvalue_from_double): Likewise.
1562         (context::new_rvalue_from_ptr): Likewise, all in favor of...
1563         (context::new_rvalue_from_const <HOST_TYPE>): New family of
1564         methods.
1565         (class memento_of_new_rvalue_from_int): Eliminate.
1566         (class memento_of_new_rvalue_from_double): Likewise.
1567         (class memento_of_new_rvalue_from_ptr): Likewise.
1568         (class memento_of_new_rvalue_from_const <HOST_TYPE>): New family
1569         of rvalue subclasses.
1570         * libgccjit++.h (gccjit::context::new_rvalue): New overload, for
1571         "long".
1572         * libgccjit.c (gcc_jit_context_new_rvalue_from_int): Update for
1573         rewriting of recording::context::new_rvalue_from_int to
1574         recording::context::new_rvalue_from_const <int>.
1575         (gcc_jit_context_new_rvalue_from_long): New API entrypoint.
1576         (gcc_jit_context_new_rvalue_from_double): Update for
1577         rewriting of recording::context::new_rvalue_from_double to
1578         recording::context::new_rvalue_from_const <double>.
1579         (gcc_jit_context_new_rvalue_from_ptr): Update for
1580         rewriting of recording::context::new_rvalue_from_ptr to
1581         recording::context::new_rvalue_from_const <void *>.
1582         * libgccjit.h (gcc_jit_context_new_rvalue_from_long): New API
1583         entrypoint.
1584         * libgccjit.map (gcc_jit_context_new_rvalue_from_long): Likewise.
1586 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
1588         PR jit/64206
1589         * docs/internals/test-hello-world.exe.log.txt: Update, the log now
1590         shows tempdir creation/cleanup.
1591         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1592         * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir
1593         to the list of subclasses in the comment.
1594         * jit-playback.c (gcc::jit::playback::context::context): Add a
1595         comment clarifying when the tempdir gets cleaned up.
1596         (gcc::jit::playback::context::compile): Pass the context's logger,
1597         if any, to the tempdir.
1598         (gcc::jit::playback::context::dlopen_built_dso): When creating the
1599         gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand
1600         over ownership of the tempdir to it.
1601         * jit-result.c: Include "jit-tempdir.h".
1602         (gcc::jit::result::result): Add tempdir param, saving it as
1603         m_tempdir.
1604         (gcc::jit::result::~result): Delete m_tempdir.
1605         * jit-result.h (gcc::jit::result::result): Add tempdir param.
1606         (gcc::jit::result::m_tempdir): New field.
1607         * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param;
1608         add JIT_LOG_SCOPE.
1609         (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit,
1610         and log m_path_template and m_path_tempdir.
1611         (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log
1612         entry/exit, and log the unlink and rmdir calls.
1613         * jit-tempdir.h: Include "jit-logging.h".
1614         (class gcc::jit::tempdir): Make this be a subclass of log_user.
1615         (gcc::jit::tempdir::tempdir): Add logger param.
1616         * notes.txt: Update to show the two possible places where the
1617         tempdir can be cleaned up.
1619 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1621         * libgccjit.h (struct gcc_jit_context): Rewrite the descriptive
1622         comment.
1624 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1626         * docs/topics/contexts.rst (Error-handling): Document new
1627         entrypoint gcc_jit_context_get_last_error.
1628         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1629         * jit-recording.c (gcc::jit::recording::context::context):
1630         Initialize new fields "m_last_error_str" and
1631         "m_owns_last_error_str".
1632         (gcc::jit::recording::context::~context): Clean up
1633         m_last_error_str, if needed.
1634         (gcc::jit::recording::context::add_error_va): Update
1635         m_last_error_str and m_owns_last_error_str, freeing the old
1636         value if appropriate.
1637         (gcc::jit::recording::context::get_last_error): New function.
1638         * jit-recording.h (gcc::jit::recording::context::get_last_error):
1639         New function.
1640         (gcc::jit::recording::context): New fields m_last_error_str and
1641         m_owns_last_error_str.
1642         * libgccjit.c (gcc_jit_context_get_last_error): New function.
1643         * libgccjit.h (gcc_jit_context_get_last_error): New declaration.
1644         * libgccjit.map (gcc_jit_context_get_last_error): New function.
1646 2015-01-08  David Malcolm  <dmalcolm@redhat.com>
1648         * Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
1649         * docs/internals/index.rst (Overview of code structure): Mention
1650         gcc_jit_context_set_logfile, and embed the example logfile.
1651         * docs/internals/test-hello-world.exe.log.txt: New file: example
1652         of a logfile.
1653         * docs/topics/contexts.rst (Debugging): Add documentation
1654         for gcc_jit_context_set_logfile.
1655         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1656         * dummy-frontend.c: Include "jit-logging.h".
1657         (jit_langhook_init): Assert that there is an active playback
1658         context.  If it has a logger, log entry/exit to this function.
1659         (jit_langhook_write_globals): Likewise.
1660         * jit-common.h (gcc::jit::logger): New forward declaration.
1661         * jit-logging.c: New file.
1662         * jit-logging.h: New file.
1663         * jit-playback.c: Include "jit-logging.h".
1664         (gcc::jit::playback::context::context): Initialize the log_user
1665         base class from the recording context's logger (if any).  Use
1666         JIT_LOG_SCOPE to log entry/exit from the function body.
1667         (gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
1668         log entry/exit from the function body.
1669         (gcc::jit::playback::build_stmt_list): Likewise.
1670         (gcc::jit::playback::function::postprocess): Likewise.
1671         (gcc::jit::playback::context::compile): Likewise.  Log the
1672         entry/exit to toplev::main and toplev::finalize.  Log the
1673         fake argv passed to toplev::main.
1674         (gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
1675         log entry/exit from the function body.
1676         (gcc::jit::playback::context::release_mutex): Likewise.
1677         (gcc::jit::playback::context::make_fake_args): Likewise.
1678         (gcc::jit::playback::context::extract_any_requested_dumps):
1679         Likewise.
1680         (gcc::jit::playback::context::convert_to_dso): Likewise. Also,
1681         log the arguments that the driver is invoked with.
1682         (gcc::jit::playback::context::dlopen_built_dso): Likewise.  Pass
1683         the logger to the result object.
1684         (gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
1685         log entry/exit from the function body.
1686         (gcc::jit::playback::context::dump_generated_code): Likewise.
1687         (gcc::jit::playback::context::handle_locations): Likewise.
1688         * jit-playback.h (gcc::jit::playback::context): Make this be
1689         a subclass of gcc::jit::log_user.
1690         * jit-recording.c: Include "jit-logging.h".
1691         (gcc::jit::recording::context::context: Initialize the logger to
1692         NULL for root contexts, or to the parent's logger for child
1693         contexts.
1694         (gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
1695         log entry/exit from the function body.
1696         (gcc::jit::recording::context::replay_into): Likewise.
1697         (gcc::jit::recording::context::disassociate_from_playback):
1698         Likewise.
1699         (gcc::jit::recording::context::compile): Likewise.
1700         (recording::context::add_error_va): Likewise.  Also, log the
1701         error.
1702         (gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
1703         log entry/exit from the function body.
1704         * jit-recording.h: Include "jit-logging.h".
1705         (gcc::jit::recording::context): Make this be a subclass of
1706         gcc::jit::log_user.
1707         * jit-result.c: Include "jit-common.h" and "jit-logging.h".
1708         (gcc::jit::result::result): Add logger param, recording it.
1709         Use JIT_LOG_SCOPE to log entry/exit from the function body.
1710         (gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
1711         log entry/exit from the function body.
1712         (gcc::jit::result::get_code): Likewise.
1713         * jit-result.h (gcc::jit::result): Make this be a subclass of
1714         gcc::jit::log_user.
1715         (gcc::jit::result::result): Add logger parameter.
1716         * libgccjit++.h (gccjit::context::set_logfile): New function.
1717         * libgccjit.c: Include "jit-logging.h".
1718         (gcc_jit_context_acquire): Log the context.
1719         (gcc_jit_context_release): Use JIT_LOG_FUNC to
1720         log entry/exit from the function body, and log the context.
1721         (gcc_jit_context_new_child_context): Likewise, logging both
1722         contexts.
1723         (gcc_jit_context_new_location): Use JIT_LOG_FUNC to
1724         log entry/exit from the function body.
1725         (gcc_jit_context_get_type): Likewise.
1726         (gcc_jit_context_get_int_type): Likewise.
1727         (gcc_jit_context_new_array_type): Likewise.
1728         (gcc_jit_context_new_field): Likewise.
1729         (gcc_jit_context_new_struct_type): Likewise.
1730         (gcc_jit_context_new_opaque_struct): Likewise.
1731         (gcc_jit_struct_set_fields): Likewise.
1732         (gcc_jit_context_new_union_type): Likewise.
1733         (gcc_jit_context_new_function_ptr_type): Likewise.
1734         (gcc_jit_context_new_param): Likewise.
1735         (gcc_jit_context_new_function): Likewise.
1736         (gcc_jit_context_get_builtin_function): Likewise.
1737         (gcc_jit_function_get_param): Likewise.
1738         (gcc_jit_function_dump_to_dot): Likewise.
1739         (gcc_jit_function_new_block): Likewise.
1740         (gcc_jit_context_new_global): Likewise.
1741         (gcc_jit_context_new_rvalue_from_int): Likewise.
1742         (gcc_jit_context_zero): Likewise.
1743         (gcc_jit_context_one): Likewise.
1744         (gcc_jit_context_new_rvalue_from_double): Likewise.
1745         (gcc_jit_context_new_rvalue_from_ptr): Likewise.
1746         (gcc_jit_context_null): Likewise.
1747         (gcc_jit_context_new_string_literal): Likewise.
1748         (gcc_jit_context_new_unary_op): Likewise.
1749         (gcc_jit_context_new_binary_op): Likewise.
1750         (gcc_jit_context_new_comparison): Likewise.
1751         (gcc_jit_context_new_call): Likewise.
1752         (gcc_jit_context_new_call_through_ptr): Likewise.
1753         (gcc_jit_context_new_cast): Likewise.
1754         (gcc_jit_context_new_array_access): Likewise.
1755         (gcc_jit_lvalue_access_field): Likewise.
1756         (gcc_jit_rvalue_access_field): Likewise.
1757         (gcc_jit_rvalue_dereference_field): Likewise.
1758         (gcc_jit_rvalue_dereference): Likewise.
1759         (gcc_jit_lvalue_get_address): Likewise.
1760         (gcc_jit_function_new_local): Likewise.
1761         (gcc_jit_block_add_eval): Likewise.
1762         (gcc_jit_block_add_assignment): Likewise.
1763         (gcc_jit_block_add_assignment_op): Likewise.
1764         (gcc_jit_block_end_with_conditional): Likewise.
1765         (gcc_jit_block_add_comment): Likewise.
1766         (gcc_jit_block_end_with_jump): Likewise.
1767         (gcc_jit_block_end_with_return): Likewise.
1768         (gcc_jit_block_end_with_void_return): Likewise.
1769         (gcc_jit_context_set_str_option): Likewise.
1770         (gcc_jit_context_set_int_option): Likewise.
1771         (gcc_jit_context_set_bool_option): Likewise.
1772         (gcc_jit_context_enable_dump): Likewise.
1773         (gcc_jit_context_compile): Likewise.  Also log the context,
1774         and the result.
1775         (gcc_jit_context_dump_to_file): Likewise.
1776         (gcc_jit_context_set_logfile): New function.
1777         (gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
1778         log entry/exit from the function body.
1779         (gcc_jit_result_get_code): Likewise.  Also log the fnname)
1780         and the ptr to be returned.
1781         (gcc_jit_result_release): Likewise.  Also log the result.
1782         * libgccjit.h: Include <stdio.h>, since we need FILE *.
1783         (gcc_jit_context_set_logfile): New declaration.
1784         * libgccjit.map (gcc_jit_context_set_logfile): New.
1786 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1788         * jit-recording.h (gcc::jit::recording::type::is_void): New
1789         virtual function.
1790         (gcc::jit::recording::memento_of_get_type::is_void): New
1791         function, overriding default implementation.
1792         * libgccjit.c (gcc_jit_rvalue_dereference): Verify that
1793         the underlying type is not "void".
1795 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1797         * docs/topics/expressions.rst (Unary Operations): Add
1798         GCC_JIT_UNARY_OP_ABS.
1799         * jit-playback.c (gcc::jit::playback::context::new_unary_op):
1800         Likewise.
1801         * jit-recording.c (unary_op_strings): Likewise.
1802         * libgccjit.c (gcc_jit_context_new_unary_op): Update checking
1803         of "op" to reflect addition of GCC_JIT_UNARY_OP_ABS.
1804         * libgccjit.h (enum gcc_jit_unary_op): Add GCC_JIT_UNARY_OP_ABS.
1805         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1807 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1809         * jit-recording.h (gcc::jit::recording::memento_of_get_type): Fix
1810         typo in comment.
1812 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1814         * TODO.rst (Test suite): Remove item about running C++ testcases.
1815         * docs/internals/index.rst (Working on the JIT library): Add
1816         "c++" to the enabled languages in the suggested "configure"
1817         invocation, and add a description of why this is necessary.
1818         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1820 2015-01-07  David Malcolm  <dmalcolm@redhat.com>
1822         * docs/internals/index.rst: Update to reflect that built
1823         testcases are now test-foo.c.exe, rather than test-foo.exe.
1824         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1826 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
1828         Update copyright years.
1830 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1832         * jit-playback.c (gcc::jit::playback::context::build_cast): In
1833         case BOOLEAN_TYPE, don't assume that the source expression is
1834         of type "int".
1836 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1838         * jit-recording.c (gcc::jit::recording::context::context): When
1839         copying string options from a parent context, take a copy of the
1840         underlying buffers, rather than simply copying the pointer.
1842 2014-12-19  David Malcolm  <dmalcolm@redhat.com>
1844         * jit-recording.c (gcc::jit::recording::context::set_str_option):
1845         Handle NULL.
1847 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
1849         * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
1850         Document new function.
1851         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1853 2014-12-10  Ulrich Drepper  <drepper@gmail.com>
1855         Minor interface cleanups of libgccjit
1856         * jit-playback.c (convert_to_dso): Use auto_vec instead
1857         of automatic array to build up command line.
1858         * jit-recording.c (recording::context::set_str_option):
1859         Make copy of the string.
1860         (recording::context::~context): Free string options.
1861         * jit-recording.h (recording::context): Adjust type
1862         of m_str_options member.
1863         * libgccjit.h: Adjust comment about
1864         gcc_jit_context_set_str_option parameter being used after
1865         the call.
1866         Update comment now that all interfaces are copy strings
1867         if necessary.
1868         * libgccjit++.h (gccjit::context): Add set_str_option
1869         member function.
1871 2014-12-10  David Malcolm  <dmalcolm@redhat.com>
1873         * docs/cp/index.rst: New file.
1874         * docs/cp/intro/index.rst: New file.
1875         * docs/cp/intro/tutorial01.rst: New file.
1876         * docs/cp/intro/tutorial02.rst: New file.
1877         * docs/cp/intro/tutorial03.rst: New file.
1878         * docs/cp/intro/tutorial04.rst: New file.
1879         * docs/cp/topics/contexts.rst: New file.
1880         * docs/cp/topics/expressions.rst: New file.
1881         * docs/cp/topics/functions.rst: New file.
1882         * docs/cp/topics/index.rst: New file.
1883         * docs/cp/topics/locations.rst: New file.
1884         * docs/cp/topics/objects.rst: New file.
1885         * docs/cp/topics/results.rst: New file.
1886         * docs/cp/topics/types.rst: New file.
1887         * docs/examples/tut01-hello-world.cc: New file.
1888         * docs/examples/tut02-square.c: Fix missing newline in output.
1889         * docs/examples/tut02-square.cc: New file.
1890         * docs/examples/tut03-sum-of-squares.cc: New file.
1891         * docs/examples/tut04-toyvm/toyvm.cc: New file.
1892         * docs/index.rst: Move summary to above the table of contents.
1893         Add text about the C vs C++ APIs.
1894         * docs/topics/contexts.rst: Fix a typo.
1896         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1897         * docs/_build/texinfo/factorial1.png: New file.
1898         * docs/_build/texinfo/sum-of-squares1.png: New file.
1900 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1902         * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
1903         logic for determine "funcname" to new function...
1904         (get_function_name): ...here, adding logic to skip any leading
1905         path from the filename.
1906         (toyvm_function_parse): Use the filename for fn_filename, rather
1907         than "name", so that the debugger can locate the source .toy
1908         file.
1909         (toyvm_function_parse): Don't fclose a NULL FILE *.
1911 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1913         PR jit/63854
1914         * docs/internals/index.rst (Running under valgrind): New
1915         subsection.
1916         (docs/_build/texinfo/libgccjit.texi): Regenerate.
1918 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1920         PR jit/64206
1921         * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
1922         * jit-common.h (gcc::jit::tempdir): New forward decl.
1923         * jit-playback.c: Include jit-tempdir.h.
1924         (gcc::jit::playback::context::context): Initialize m_tempdir.
1925         (gcc::jit::playback::context::~context): Move tempdir
1926         cleanup to new file jit-tempdir.c
1927         (make_tempdir_path_template): Move to new file jit-tempdir.c.
1928         (gcc::jit::playback::context::compile): Move tempdir creation
1929         to new tempdir object in new file jit-tempdir.c.
1930         (gcc::jit::playback::context::make_fake_args): Get path from
1931         tempdir object rather than from member data.
1932         (gcc::jit::playback::context::convert_to_dso): Likewise.
1933         (gcc::jit::playback::context::dlopen_built_dso): Likewise.
1934         (gcc::jit::playback::context::dump_generated_code): Likewise.
1935         (gcc::jit::playback::context::get_path_c_file): New function.
1936         (gcc::jit::playback::context::get_path_s_file): New function.
1937         (gcc::jit::playback::context::get_path_so_file): New function.
1938         * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
1939         New function.
1940         (gcc::jit::playback::context::get_path_s_file): New function.
1941         (gcc::jit::playback::context::get_path_so_file): New function.
1942         (gcc::jit::playback::context): Move fields "m_path_template",
1943         "m_path_tempdir", "m_path_c_file", "m_path_s_file",
1944         "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
1945         * jit-tempdir.c: New file.
1946         * jit-tempdir.h: New file.
1948 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1950         * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
1951         mutex here, immediately before using toplev, and release it here, on
1952         each exit path after acquisition.
1953         (jit_mutex): Move this variable here, from jit-recording.c.
1954         (gcc::jit::playback::context::acquire_mutex): New function, based on
1955         code in jit-recording.c.
1956         (gcc::jit::playback::context::release_mutex): Likewise.
1957         * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
1958         function.
1959         (gcc::jit::playback::context::release_mutex): New function.
1960         * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
1961         (gcc::jit::recording::context::compile): Move mutex-handling from
1962         here into jit-playback.c's gcc::jit::playback::context::compile.
1963         * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
1964         and RELEASE_MUTEX.
1966 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1968         * jit-playback.c (gcc::jit::playback::context::compile): Move the
1969         dlopen code into...
1970         (gcc::jit::playback::context::dlopen_built_dso): ...this new
1971         function.
1972         * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
1973         New function.
1975 2014-12-09  David Malcolm  <dmalcolm@redhat.com>
1977         PR jit/64166
1978         * docs/topics/contexts.rst (Debugging): Add description of
1979         gcc_jit_context_enable_dump.
1980         * docs/_build/texinfo/libgccjit.texi: Regenerate.
1981         * jit-playback.c: Include context.h.
1982         (class auto_argvec): New class.
1983         (auto_argvec::~auto_argvec): New function.
1984         (gcc::jit::playback::context::compile): Convert fake_args to be
1985         an auto_argvec, so that it can contain dynamically-allocated
1986         strings.   Construct a vec of all requested dumps, and pass it to
1987         make_fake_args.  Extract requested dumps between the calls to
1988         toplev::main and toplev::finalize.
1989         (gcc::jit::playback::context::make_fake_args): Convert param
1990         "argvec" to be a vec <char *>, and gain a "requested_dumps"
1991         param.  Convert to dynamically-allocated arg strings by converting
1992         ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
1993         for args that are already a copy.  Add args for all requested dumps.
1994         (gcc::jit::playback::context::extract_any_requested_dumps): New
1995         function.
1996         (gcc::jit::playback::context::read_dump_file): New function.
1997         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
1998         Convert param "argvec" to be a vec <char *>, and gain a
1999         "requested_dumps" param.
2000         (gcc::jit::playback::context::extract_any_requested_dumps): New
2001         function.
2002         (gcc::jit::playback::context::read_dump_file): New function.
2003         * jit-recording.c (gcc::jit::recording::context::enable_dump): New
2004         function.
2005         (gcc::jit::recording::context::get_all_requested_dumps): New
2006         function.
2007         * jit-recording.h (gcc::jit::recording::requested_dump): New
2008         struct.
2009         (gcc::jit::recording::context::enable_dump): New function.
2010         (gcc::jit::recording::context::get_all_requested_dumps): New
2011         function.
2012         (gcc::jit::recording::context::m_requested_dumps): New field.
2013         * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
2014         * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
2015         * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
2017 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
2019         * libgccjit++.h: Indent the forward declarations of the classes to
2020         show the inheritance hierarchy.
2022 2014-12-08  David Malcolm  <dmalcolm@redhat.com>
2024         * notes.txt: Show the beginning and ending of
2025         recording::context::compile vs playback::context::compile.  Show
2026         the creation and unlinking of the tempdir.  Show toplev::finalize.
2027         Move "RELEASE MUTEX" to the correct location.  Show
2028         gcc_jit_result_release, and indicate where the
2029         dlopen/dlsym/dlclose occur.
2031 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2033         * docs/examples/tut02-square.c (main): Release the context
2034         earlier, to show that this is possible.  Update error-handling
2035         to avoid a double-release of the context, and to avoid
2036         releasing a NULL result.
2037         * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
2038         * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
2039         * docs/topics/results.rst (gcc_jit_result): Mention that this
2040         controls the lifetimes of machine code functions.
2041         (gcc_jit_result_get_code): Spell out the requirements for this
2042         to succeed, and the lifetime of the result.
2043         (gcc_jit_result_release): Mention that this invalidates any code
2044         that was obtained from the result.
2045         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2047 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2049         PR jit/64018
2050         * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
2051         Add description of error-handling, taken in part from...
2052         * docs/topics/contexts.rst (Error-handling): Expand, and move some
2053         content to tutorial02.rst.
2054         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2056 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2058         PR jit/64020
2059         * docs/topics/types.rst (Standard types) Add new enum values to
2060         the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
2061         GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2062         Widen the left-hand column so that
2063         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
2064         * docs/_build/texinfo/libgccjit.texi: Regenerate.
2066         * jit-builtins.c: Include stringpool.h and jit-playback.h.
2067         Move everything out of the gcc::jit::recording namespace into
2068         just gcc::jit.
2069         (struct builtin_data): Add fields "fnclass", "attr", and
2070         "implicit_p".
2071         (DEF_BUILTIN): Update macro so populate the new fields.
2072         (builtins_manager::builtins_manager): Update for move out of
2073         recording namespace.  Initialize the m_attributes array.
2074         (builtins_manager::get_builtin_function): Likewise.
2075         (builtins_manager::get_builtin_function_by_id): New function.
2076         (builtins_manager::make_builtin_function): Update for move out of
2077         recording namespace.  Add fix for PR jit/64020 by detecting
2078         specific builtin ids and having them ensure that builtins for
2079         other ids are created as necessary.
2080         (builtins_manager::get_type): Update for move out of recording
2081         namespace.
2082         (builtins_manager::make_type): Likewise.  Add some missing
2083         #undefs.
2084         (builtins_manager::make_primitive_type): Update for move out of
2085         recording namespace.  Implement the three BT_COMPLEX_ cases and
2086         BT_DOUBLE_PTR.
2087         (builtins_manager::make_fn_type): Update for move out of recording
2088         namespace.
2089         (builtins_manager::make_ptr_type): Likewise.
2090         (builtins_manager::finish_playback): New function.
2091         (builtins_manager::get_class): New function.
2092         (builtins_manager::implicit_p): New function.
2093         (builtins_manager::get_attrs_tree): Two new functions.
2094         (builtins_manager::make_attrs_tree): New function.
2096         * jit-builtins.h: Move everything out of the gcc::jit::recording
2097         namespace into just gcc::jit.
2098         (enum built_in_attribute): New.
2099         (builtins_manager::builtins_manager): Update decl for namespace
2100         change.
2101         (builtins_manager::get_builtin_function): Likewise.
2102         (builtins_manager::get_class): New.
2103         (builtins_manager::implicit_p): New.
2104         (builtins_manager::get_attrs_tree): Two new functions.
2105         (builtins_manager::make_attrs_tree): New function.
2106         (builtins_manager::finish_playback): New.
2107         (builtins_manager::get_builtin_function_by_id): New.
2108         (builtins_manager::make_builtin_function): Update decl for
2109         namespace change.
2110         (builtins_manager::get_type): Likewise.
2111         (builtins_manager::make_type): Likewise.
2112         (builtins_manager::make_primitive_type): Likewise.
2113         (builtins_manager::make_fn_type): Likewise.
2114         (builtins_manager::make_ptr_type): Likewise.
2115         (builtins_manager): Likewise for fields.  Add new field
2116         "m_attributes".
2118         * jit-common.h (NUM_GCC_JIT_TYPES): Update.
2119         (builtins_manager): Update forward decl to reflect namespace
2120         change.
2122         * jit-playback.c: Include attribs.h and jit-builtins.h.
2123         (gcc::jit::playback::context::get_tree_node_for_type): Add cases
2124         for the new COMPLEX_ types.
2125         (gcc::jit::playback::context::new_function): If creating a
2126         builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
2127         and call set_builtin_decl.
2128         (gcc::jit::playback::context::replay): If we have a
2129         builtins_manager, call its finish_playback method when we're done.
2131         * jit-playback.h:
2132         (gcc::jit::playback::context::get_builtins_manager): New function.
2134         * jit-recording.c
2135         (gcc::jit::recording::context::get_builtins_manager): New function.
2136         (gcc::jit::recording::get_builtin_function): Use
2137         get_builtins_manager, in case we're a child context.
2138         (gcc::jit::recording::memento_of_get_type::dereference): Add the
2139         COMPLEX_ types.
2140         (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
2141         (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
2142         (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
2143         (get_type_strings): Likewise.
2145         * jit-recording.h
2146         (gcc::jit::recording::context::get_builtins_manager): New.
2148         * libgccjit.h (enum gcc_jit_types): Add
2149         GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
2150         GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
2152 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2154         * jit-builtins.c
2155         (gcc::jit::recording::builtins_manager::get_builtin_function):
2156         Check for NULL return from make_builtin_function.
2157         (gcc::jit::recording::builtins_manager::make_builtin_function):
2158         Check for NULL return from get_type.
2160 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2162         * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
2163         creation code into...
2164         (gcc::jit::playback::context::convert_to_dso): New function.
2165         * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
2166         New function.
2168 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2170         * jit-playback.c (gcc::jit::playback::context::compile): Use an
2171         auto_vec<const char *> rather than a const char *[20] for the
2172         top-level argv, and move the logic to build it to...
2173         (gcc::jit::playback::context::make_fake_args): New function.
2174         * jit-playback.h (gcc::jit::playback::context::make_fake_args):
2175         New function.
2177 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2179         * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
2180         * jit-playback.c: Include new header jit-result.h.
2181         (gcc::jit::result::result): Move to new file jit-result.c.
2182         (gcc::jit::result::~result): Likewise.
2183         (gcc::jit::playback::result): Likewise.
2184         * jit-recording.h (class gcc::jit::result): Move to new
2185         header jit-result.h.
2186         * jit-result.c: New file, to contain...
2187         (gcc::jit::result::result): Move here from jit-playback.c,
2188         removing erroneous "playback" namespace from comment.
2189         (gcc::jit::result::~result): Likewise.
2190         (gcc::jit::playback::result): Likewise.
2191         * jit-result.h: New file, to contain...
2192         (class gcc::jit::result): Move from jit-recording.h.
2193         * libgccjit.c: Include jit-result.h.
2194         (gcc_jit_result_get_code): Update comment to reflect move
2195         of implementation.
2196         (gcc_jit_result_release): Likewise.
2198 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2200         PR jit/63854
2201         * docs/examples/tut04-toyvm/toyvm.c
2202         (toyvm_compiled_function): New typedef.
2203         (toyvm_compiled_func) Rename to...
2204         (toyvm_compiled_code) ...this.
2205         (struct toyvm_compiled_function): New struct.
2206         (toyvm_function_compile): Return a toyvm_compiled_function *
2207         rather than a toyvm_compiled_func, so that the caller can fully
2208         clean things up.  Free "funcname".
2209         (test_script): Update for change to toyvm_function_compile.
2210         Clean up the toyvm_compiled_function.
2211         (main): Likewise.
2212         (docs/intro/tutorial04.rst): Update to reflect the above changes,
2213         and to better spell out the lifetime of the compiled code.
2215 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2217         PR jit/63854
2218         * jit-builtins.c
2219         (gcc::jit::recording::builtins_manager::make_fn_type): Call the
2220         context's new_function_type method, rather than directly creating
2221         a function_type instance.
2222         * jit-recording.c
2223         (gcc::jit::recording::context::new_function_type): New method,
2224         adapted from part of...
2225         (gcc::jit::recording::context::new_function_ptr_type): ...this.
2226         Update to call new_function_type.
2227         * jit-recording.h
2228         (gcc::jit::recording::context::new_function_type): New method.
2230 2014-12-01  David Malcolm  <dmalcolm@redhat.com>
2232         PR jit/63969
2233         * jit-playback.c: Ensure that ctxt_progname is non-NULL.
2235 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
2237         PR jit/63854
2238         * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
2239         Convert param from const vec<playback::field *> & to
2240         const auto_vec<playback::field *> *.
2241         (gcc::jit::playback::context::new_function_type): Convert param
2242         "param_types" from vec<type *> * to const auto_vec<type *> *.
2243         (gcc::jit::playback::context::new_function): Convert param
2244         "params" from vec<param *> * to const auto_vec<param *> *.
2245         (gcc::jit::playback::context::build_call): Convert param "args"
2246         from vec<rvalue *> to const auto_vec<rvalue *> *.
2247         (gcc::jit::playback::context::new_call): Likewise.
2248         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
2249         (wrapper_finalizer): New function.
2250         (gcc::jit::playback::wrapper::operator new): Call the finalizer
2251         variant of ggc_internal_cleared_alloc, supplying
2252         wrapper_finalizer.
2253         (gcc::jit::playback::function::finalizer): New.
2254         (gcc::jit::playback::block::finalizer): New.
2255         (gcc::jit::playback::source_file::finalizer): New.
2256         (gcc::jit::playback::source_line::finalizer): New.
2258         * jit-playback.h
2259         (gcc::jit::playback::context::new_function_type): Convert param
2260         "param_types" from vec<type *> * to const auto_vec<type *> *.
2261         (gcc::jit::playback::context::new_function): Convert param
2262         "params" from vec<param *> * to const auto_vec<param *> *.
2263         (gcc::jit::playback::context::new_call): Convert param
2264         "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
2265         (gcc::jit::playback::context::new_call_through_ptr): Likewise.
2266         (gcc::jit::playback::context::build_call): Likewise.
2267         (gcc::jit::playback::context): Convert fields "m_functions",
2268         "m_source_files", "m_cached_locations" from vec to auto_vec.
2269         (gcc::jit::playback::wrapper::finalizer): New virtual function.
2270         (gcc::jit::playback::compound_type::set_fields): Convert param fro
2271         const vec<playback::field *> & to
2272         const auto_vec<playback::field *> *.
2273         (gcc::jit::playback::function::finalizer): New.
2274         (gcc::jit::playback::block::finalizer): New.
2275         (gcc::jit::playback::source_file::finalizer): New.
2276         (gcc::jit::playback::source_line::finalizer): New.
2278         * jit-recording.c
2279         (gcc::jit::recording::function_type::replay_into): Convert local
2280         from a vec into an auto_vec.
2281         (gcc::jit::recording::fields::replay_into): Likewise.
2282         (gcc::jit::recording::function::replay_into): Likewise.
2283         (gcc::jit::recording::call::replay_into): Likewise.
2284         (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
2286         * jit-recording.h (gcc::jit::recording::context): Convert fields
2287         "m_mementos", "m_compound_types", "m_functions" from vec<> to
2288         auto_vec <>.
2289         (gcc::jit::recording::function_type::get_param_types): Convert
2290         return type from vec<type *> to const vec<type *> &.
2291         (gcc::jit::recording::function_type): Convert field
2292         "m_param_types" from a vec<> to an auto_vec<>.
2293         (gcc::jit::recording::fields): Likewise for field "m_fields".
2294         (gcc::jit::recording::function::get_params): Convert return type
2295         from vec <param *> to const vec<param *> &.
2296         (gcc::jit::recording::function): Convert fields "m_params",
2297         "m_locals", "m_blocks" from vec<> to auto_vec<>.
2298         (gcc::jit::recording::block): Likewise for field "m_statements".
2299         vec<> to auto_vec<>.
2300         (gcc::jit::recording::call): Likewise for field "m_args".
2301         (gcc::jit::recording::call_through_ptr): Likewise.
2303 2014-11-19  David Malcolm  <dmalcolm@redhat.com>
2305         PR jit/63854
2306         * jit-recording.c (recording::function::validate): Convert
2307         "worklist" from vec<> to autovec<> to fix a leak.
2309 2014-11-11  David Malcolm  <dmalcolm@redhat.com>
2311         * ChangeLog.jit: New.
2312         * ChangeLog: New.
2313         * Make-lang.in: New.
2314         * TODO.rst: New.
2315         * config-lang.in: New.
2316         * docs/Makefile: New.
2317         * docs/_build/texinfo/Makefile: New.
2318         * docs/_build/texinfo/factorial.png: New.
2319         * docs/_build/texinfo/libgccjit.texi: New.
2320         * docs/_build/texinfo/sum-of-squares.png: New.
2321         * docs/conf.py: New.
2322         * docs/examples/tut01-hello-world.c: New.
2323         * docs/examples/tut02-square.c: New.
2324         * docs/examples/tut03-sum-of-squares.c: New.
2325         * docs/examples/tut04-toyvm/Makefile: New.
2326         * docs/examples/tut04-toyvm/factorial.toy: New.
2327         * docs/examples/tut04-toyvm/fibonacci.toy: New.
2328         * docs/examples/tut04-toyvm/toyvm.c: New.
2329         * docs/index.rst: New.
2330         * docs/internals/index.rst: New.
2331         * docs/intro/factorial.png: New.
2332         * docs/intro/index.rst: New.
2333         * docs/intro/sum-of-squares.png: New.
2334         * docs/intro/tutorial01.rst: New.
2335         * docs/intro/tutorial02.rst: New.
2336         * docs/intro/tutorial03.rst: New.
2337         * docs/intro/tutorial04.rst: New.
2338         * docs/topics/contexts.rst: New.
2339         * docs/topics/expressions.rst: New.
2340         * docs/topics/functions.rst: New.
2341         * docs/topics/index.rst: New.
2342         * docs/topics/locations.rst: New.
2343         * docs/topics/objects.rst: New.
2344         * docs/topics/results.rst: New.
2345         * docs/topics/types.rst: New.
2346         * dummy-frontend.c: New.
2347         * jit-builtins.c: New.
2348         * jit-builtins.h: New.
2349         * jit-common.h: New.
2350         * jit-playback.c: New.
2351         * jit-playback.h: New.
2352         * jit-recording.c: New.
2353         * jit-recording.h: New.
2354         * libgccjit++.h: New.
2355         * libgccjit.c: New.
2356         * libgccjit.h: New.
2357         * libgccjit.map: New.
2358         * notes.txt: New.
2360 2013-07-26  David Malcolm  <dmalcolm@redhat.com>
2362         * Initial creation
2364 Copyright (C) 2013-2017 Free Software Foundation, Inc.
2366 Copying and distribution of this file, with or without modification,
2367 are permitted in any medium without royalty provided the copyright
2368 notice and this notice are preserved.