aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/docs/topics
AgeCommit message (Collapse)AuthorFilesLines
2025-01-02Update copyright years.Jakub Jelinek12-12/+12
2024-11-20libgccjit: Add support for setting the comment identAntoni Boucher2-0/+37
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_34): New ABI tag. * docs/topics/contexts.rst: Document gcc_jit_context_set_output_ident. * jit-playback.cc (set_output_ident): New method. * jit-playback.h (set_output_ident): New method. * jit-recording.cc (recording::context::set_output_ident, recording::output_ident::output_ident, recording::output_ident::~output_ident, recording::output_ident::replay_into, recording::output_ident::make_debug_string, recording::output_ident::write_reproducer): New methods. * jit-recording.h (class output_ident): New class. * libgccjit.cc (gcc_jit_context_set_output_ident): New function. * libgccjit.h (gcc_jit_context_set_output_ident): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-output-ident.c: New test.
2024-01-18libgccjit: Add support for creating temporary variablesAntoni Boucher2-0/+29
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_33): New ABI tag. * docs/topics/functions.rst: Document gcc_jit_function_new_temp. * jit-playback.cc (new_local): Add support for temporary variables. * jit-recording.cc (recording::function::new_temp): New method. (recording::local::write_reproducer): Support temporary variables. * jit-recording.h (new_temp): New method. * libgccjit.cc (gcc_jit_function_new_temp): New function. * libgccjit.h (gcc_jit_function_new_temp): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Mention test-temp.c. * jit.dg/test-temp.c: New test.
2024-11-20libgccjit: Add support for machine-dependent builtinsAntoni Boucher2-1/+28
gcc/jit/ChangeLog: PR jit/108762 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_32): New ABI tag. * docs/topics/functions.rst: Add documentation for the function gcc_jit_context_get_target_builtin_function. * dummy-frontend.cc: Include headers target.h, jit-recording.h, print-tree.h, unordered_map and string, new variables (target_builtins, target_function_types, and target_builtins_ctxt), new function (tree_type_to_jit_type). * jit-builtins.cc: Specify that the function types are not from target builtins. * jit-playback.cc: New argument is_target_builtin to new_function. * jit-playback.h: New argument is_target_builtin to new_function. * jit-recording.cc: New argument is_target_builtin to new_function_type, function_type constructor and function constructor, new function (get_target_builtin_function). * jit-recording.h: Include headers string and unordered_map, new variable target_function_types, new argument is_target_builtin to new_function_type, function_type and function, new functions (get_target_builtin_function, copy). * libgccjit.cc: New function (gcc_jit_context_get_target_builtin_function). * libgccjit.h: New function (gcc_jit_context_get_target_builtin_function). * libgccjit.map: New functions (gcc_jit_context_get_target_builtin_function). gcc/testsuite: PR jit/108762 * jit.dg/all-non-failing-tests.h: New test test-target-builtins.c. * jit.dg/test-target-builtins.c: New test.
2024-11-20libgccjit: Add option to allow special characters in function namesAntoni Boucher1-2/+7
gcc/jit/ChangeLog: * docs/topics/contexts.rst: Add documentation for new option. * jit-recording.cc (recording::context::get_str_option): New method. * jit-recording.h (get_str_option): New method. * libgccjit.cc (gcc_jit_context_new_function): Allow special characters in function names. * libgccjit.h (enum gcc_jit_str_option): New option. gcc/testsuite/ChangeLog: * jit.dg/test-special-chars.c: New test.
2024-11-20libgccjit: Add vector permutation and vector access operationsAntoni Boucher2-0/+63
gcc/jit/ChangeLog: PR jit/112602 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_31): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_context_new_rvalue_vector_perm and gcc_jit_context_new_vector_access. * jit-playback.cc (playback::context::new_rvalue_vector_perm, common_mark_addressable_vec, gnu_vector_type_p, lvalue_p, convert_vector_to_array_for_subscript, new_vector_access): new functions. * jit-playback.h (new_rvalue_vector_perm, new_vector_access): New functions. * jit-recording.cc (recording::context::new_rvalue_vector_perm, recording::context::new_vector_access, memento_of_new_rvalue_vector_perm, recording::memento_of_new_rvalue_vector_perm::replay_into, recording::memento_of_new_rvalue_vector_perm::visit_children, recording::memento_of_new_rvalue_vector_perm::make_debug_string, recording::memento_of_new_rvalue_vector_perm::write_reproducer, recording::vector_access::replay_into, recording::vector_access::visit_children, recording::vector_access::make_debug_string, recording::vector_access::write_reproducer): New methods. * jit-recording.h (class memento_of_new_rvalue_vector_perm, class vector_access): New classes. * libgccjit.cc (gcc_jit_context_new_vector_access, gcc_jit_context_new_rvalue_vector_perm): New functions. * libgccjit.h (gcc_jit_context_new_rvalue_vector_perm, gcc_jit_context_new_vector_access): New functions. * libgccjit.map: New functions. gcc/testsuite/ChangeLog: PR jit/112602 * jit.dg/all-non-failing-tests.h: New test test-vector-perm.c. * jit.dg/test-vector-perm.c: New test.
2024-11-04libgccjit: Add convert vectorAntoni Boucher2-0/+26
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_30): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_context_convert_vector. * jit-playback.cc (convert_vector): New method. * jit-playback.h: New method. * jit-recording.cc (recording::context::new_convert_vector, recording::convert_vector::replay_into, recording::convert_vector::visit_children, recording::convert_vector::make_debug_string, recording::convert_vector::write_reproducer): New methods. * jit-recording.h (class convert_vector): New class. (context::new_convert_vector): New method. * libgccjit.cc (gcc_jit_context_convert_vector): New function. * libgccjit.h (gcc_jit_context_convert_vector): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-convert-vector.c: New test.
2024-11-04libgccjit: Add gcc_jit_global_set_readonlyAntoni Boucher2-0/+19
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_29): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_global_set_readonly. * jit-playback.cc (global_new_decl, new_global, new_global_initialized): New parameter readonly. * jit-playback.h (global_new_decl, new_global, new_global_initialized): New parameter readonly. * jit-recording.cc (recording::global::replay_into): Use m_readonly. (recording::global::write_reproducer): Dump reproducer for gcc_jit_global_set_readonly. * jit-recording.h (get_readonly, set_readonly): New methods. (m_readonly): New attribute. * libgccjit.cc (gcc_jit_global_set_readonly): New function. (gcc_jit_block_add_assignment): Check that we don't assign to a readonly variable. * libgccjit.h (gcc_jit_global_set_readonly): New function. (LIBGCCJIT_HAVE_gcc_jit_global_set_readonly): New define. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Mention test-readonly.c. * jit.dg/test-error-assign-readonly.c: New test. * jit.dg/test-readonly.c: New test.
2024-07-05libgccjit: Add support for the type bfloat16Antoni Boucher1-0/+2
gcc/jit/ChangeLog: PR jit/112574 * docs/topics/types.rst: Document GCC_JIT_TYPE_BFLOAT16. * jit-common.h: Update NUM_GCC_JIT_TYPES. * jit-playback.cc (get_tree_node_for_type): Support bfloat16. * jit-recording.cc (recording::memento_of_get_type::get_size, recording::memento_of_get_type::dereference, recording::memento_of_get_type::is_int, recording::memento_of_get_type::is_signed, recording::memento_of_get_type::is_float, recording::memento_of_get_type::is_bool): Support bfloat16. * libgccjit.h (enum gcc_jit_types): Add GCC_JIT_TYPE_BFLOAT16. gcc/testsuite/ChangeLog: PR jit/112574 * jit.dg/all-non-failing-tests.h: New test test-bfloat16.c. * jit.dg/test-types.c: Test GCC_JIT_TYPE_BFLOAT16. * jit.dg/test-bfloat16.c: New test.
2024-06-27libgccjit: Add ability to get the alignment of a typeAntoni Boucher2-0/+21
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_28): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_context_new_alignof. * jit-playback.cc (new_alignof): New method. * jit-playback.h: New method. * jit-recording.cc (recording::context::new_alignof): New method. (recording::memento_of_sizeof::replay_into, recording::memento_of_typeinfo::replay_into, recording::memento_of_sizeof::make_debug_string, recording::memento_of_typeinfo::make_debug_string, recording::memento_of_sizeof::write_reproducer, recording::memento_of_typeinfo::write_reproducer): Rename. * jit-recording.h (enum type_info_type): New enum. (class memento_of_sizeof class memento_of_typeinfo): Rename. * libgccjit.cc (gcc_jit_context_new_alignof): New function. * libgccjit.h (gcc_jit_context_new_alignof): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-alignof.c: New test.
2024-04-09Fix up duplicated words mostly in comments, part 2Jakub Jelinek1-1/+1
Another patch from eyeballing git grep -v 'long long\|optab optab\|template template\|double double' | grep ' \([a-zA-Z]\+\) \1 ' output, this time in gcc/ subdirectory. 2024-04-09 Jakub Jelinek <jakub@redhat.com> gcc/ * expr.cc (convert_mode_scalar): Fix duplicated words in comment; into into -> it into. * function.h (function::cond_uids): Fix duplicated words in comment; same same -> same. * config/riscv/riscv-vector-costs.cc (costs::adjust_vect_cost_per_loop): Fix duplicated words in comment; model model -> model. * config/riscv/riscv-vector-builtins-shapes.cc (build_base): Fix duplicated words in comment; for for -> for. * config/riscv/riscv-avlprop.cc (pass_avlprop::execute): Fix duplicated words in comment; more more -> more. * config/aarch64/driver-aarch64.cc (host_detect_local_cpu): Fix duplicated words in comment; be be -> be. * tree-profile.cc (masking_vectors): Fix duplicated words in comment; has has -> has, the the -> the. * value-range.cc (irange::set_range_from_bitmask): Fix duplicated words in comment; the the -> the. * gcov.cc (add_condition_counts): Fix duplicated words in comment; to to -> to. * vr-values.cc (get_scev_info): Fix duplicated words in comment; the the -> to the. * tree-vrp.cc (fully_replaceable): Fix duplicated words in comment; by by -> by. * mode-switching.cc (single_succ_confluence_n): Fix duplicated words in comment; the the -> the. * tree-ssa-phiopt.cc (value_replacement): Fix duplicated words in comment; can can -> we can. * gimple-range-phi.cc (phi_analyzer::process_phi): Fix duplicated words in comment; it it -> it is. * tree-ssa-sccvn.cc (visit_phi): Fix duplicated words in comment; to to -> to. * rtl-ssa/accesses.h (use_info::next_debug_insn_use): Fix duplicated words in comment; if if -> if. * doc/options.texi (InverseMask): Fix duplicated words; and and -> and. Change take to takes. * doc/invoke.texi (fanalyzer-undo-inlining): Fix duplicated words; be be -> be. (-minline-memops-threshold): Likewise. gcc/analyzer/ * analyzer.opt (Wanalyzer-undefined-behavior-strtok): Fix duplicated words; in in -> in. * program-state.cc (sm_state_map::replay_call_summary): Fix duplicated words in comment; to to -> to. (program_state::replay_call_summary): Likewise. * region-model.cc (region_model::replay_call_summary): Likewise. gcc/c/ * c-decl.cc (previous_tag): Fix duplicated words in comment; the the -> the. (diagnose_mismatched_decls): Fix duplicated words in comment; about about -> about. gcc/cp/ * constexpr.cc (build_new_constexpr_heap_type): Fix duplicated words in comment; is is -> is. * cp-tree.def (CO_RETURN_EXPR): Fix duplicated words in comment; for for -> for. * parser.cc (fixup_blocks_walker): Fix duplicated words in comment; is is -> is. * semantics.cc (fixup_template_type): Fix duplicated words in comment; for for -> for. (finish_omp_for): Fix duplicated words in comment; the the -> the. * pt.cc (more_specialized_fn): Fix duplicated words in comment; think think -> think. (type_targs_deducible_from): Fix duplicated words in comment; the the -> the. gcc/jit/ * docs/topics/expressions.rst (Constructor expressions): Fix duplicated words; have have -> have.
2024-02-02libgccjit: Implement sizeof operatorAntoni Boucher2-0/+21
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_27): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_context_new_sizeof. * jit-playback.cc (new_sizeof): New method. * jit-playback.h (new_sizeof): New method. * jit-recording.cc (recording::context::new_sizeof, recording::memento_of_sizeof::replay_into, recording::memento_of_sizeof::make_debug_string, recording::memento_of_sizeof::write_reproducer): New methods. * jit-recording.h (class memento_of_sizeof): New class. * libgccjit.cc (gcc_jit_context_new_sizeof): New function. * libgccjit.h (gcc_jit_context_new_sizeof): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-sizeof.c: New test.
2024-01-12[PATCH] libgccjit: Add support for function attributes and variable attributes.Guillaume Gomez3-0/+92
gcc/jit/ChangeLog: * dummy-frontend.cc (handle_alias_attribute): New function. (handle_always_inline_attribute): New function. (handle_cold_attribute): New function. (handle_fnspec_attribute): New function. (handle_format_arg_attribute): New function. (handle_format_attribute): New function. (handle_noinline_attribute): New function. (handle_target_attribute): New function. (handle_used_attribute): New function. (handle_visibility_attribute): New function. (handle_weak_attribute): New function. (handle_alias_ifunc_attribute): New function. * jit-playback.cc (fn_attribute_to_string): New function. (variable_attribute_to_string): New function. (global_new_decl): Add attributes support. (set_variable_attribute): New function. (new_global): Add attributes support. (new_global_initialized): Add attributes support. (new_local): Add attributes support. * jit-playback.h (fn_attribute_to_string): New function. (set_variable_attribute): New function. * jit-recording.cc (recording::lvalue::add_attribute): New function. (recording::function::function): New function. (recording::function::write_to_dump): Add attributes support. (recording::function::add_attribute): New function. (recording::function::add_string_attribute): New function. (recording::function::add_integer_array_attribute): New function. (recording::global::replay_into): Add attributes support. (recording::local::replay_into): Add attributes support. * jit-recording.h: Add attributes support. * libgccjit.cc (gcc_jit_function_add_attribute): New function. (gcc_jit_function_add_string_attribute): New function. (gcc_jit_function_add_integer_array_attribute): New function. (gcc_jit_lvalue_add_attribute): New function. * libgccjit.h (enum gcc_jit_fn_attribute): New enum. (gcc_jit_function_add_attribute): New function. (gcc_jit_function_add_string_attribute): New function. (gcc_jit_function_add_integer_array_attribute): New function. (enum gcc_jit_variable_attribute): New function. (gcc_jit_lvalue_add_string_attribute): New function. * libgccjit.map: Declare new functions. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Add new attributes tests. * jit.dg/jit.exp: Add `jit-verify-assembler-output-not` test command. * jit.dg/test-restrict-attribute.c: New test. * jit.dg/test-alias-attribute.c: New test. * jit.dg/test-always_inline-attribute.c: New test. * jit.dg/test-cold-attribute.c: New test. * jit.dg/test-const-attribute.c: New test. * jit.dg/test-noinline-attribute.c: New test. * jit.dg/test-nonnull-attribute.c: New test. * jit.dg/test-pure-attribute.c: New test. * jit.dg/test-used-attribute.c: New test. * jit.dg/test-variable-attribute.c: New test. * jit.dg/test-weak-attribute.c: New test. gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Add documentation for LIBGCCJIT_ABI_26. * docs/topics/functions.rst: Add documentation for new functions. * docs/topics/expressions.rst: Add documentation for new functions. Co-authored-by: Antoni Boucher <bouanto@zoho.com> Signed-off-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-01-03Update copyright years.Jakub Jelinek12-12/+12
2023-08-29libgccjit: add support for `restrict` attribute on function parametersGuillaume Gomez2-0/+19
gcc/jit/Changelog: * jit-playback.cc: Remove trailing whitespace characters. * jit-playback.h: Add get_restrict method. * jit-recording.cc: Add get_restrict methods. * jit-recording.h: Add get_restrict methods. * libgccjit++.h: Add get_restrict methods. * libgccjit.cc: Add gcc_jit_type_get_restrict. * libgccjit.h: Declare gcc_jit_type_get_restrict. * libgccjit.map: Declare gcc_jit_type_get_restrict. gcc/testsuite/ChangeLog: * jit.dg/test-restrict.c: Add test for __restrict__ attribute. * jit.dg/all-non-failing-tests.h: Add test-restrict.c to the list. gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Add documentation for LIBGCCJIT_ABI_25. * docs/topics/types.rst: Add documentation for gcc_jit_type_get_restrict. Signed-off-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2023-01-16Update copyright years.Jakub Jelinek12-12/+12
2022-11-14Revert "sphinx: jit: port libgccjit to shared Sphinx"Martin Liska12-0/+4057
This reverts commit 94246daa3efba88d4ae6619f24d737c01ba3dc89.
2022-11-09sphinx: jit: port libgccjit to shared SphinxMartin Liska12-4057/+0
gcc/jit/ChangeLog: * Make-lang.in: * docs/cp/index.rst: Moved to... * doc/cp/index.rst: ...here. * docs/cp/intro/index.rst: Moved to... * doc/cp/intro/index.rst: ...here. * docs/cp/intro/tutorial01.rst: Moved to... * doc/cp/intro/tutorial01.rst: ...here. * docs/cp/intro/tutorial02.rst: Moved to... * doc/cp/intro/tutorial02.rst: ...here. * docs/cp/intro/tutorial03.rst: Moved to... * doc/cp/intro/tutorial03.rst: ...here. * docs/cp/intro/tutorial04.rst: Moved to... * doc/cp/intro/tutorial04.rst: ...here. * docs/cp/topics/asm.rst: Moved to... * doc/cp/topics/asm.rst: ...here. * docs/cp/topics/compilation.rst: Moved to... * doc/cp/topics/compilation.rst: ...here. * docs/cp/topics/contexts.rst: Moved to... * doc/cp/topics/contexts.rst: ...here. * docs/cp/topics/expressions.rst: Moved to... * doc/cp/topics/expressions.rst: ...here. * docs/cp/topics/functions.rst: Moved to... * doc/cp/topics/functions.rst: ...here. * docs/cp/topics/index.rst: Moved to... * doc/cp/topics/index.rst: ...here. * docs/cp/topics/locations.rst: Moved to... * doc/cp/topics/locations.rst: ...here. * docs/cp/topics/objects.rst: Moved to... * doc/cp/topics/objects.rst: ...here. * docs/cp/topics/types.rst: Moved to... * doc/cp/topics/types.rst: ...here. * docs/examples/emit-alphabet.bf: Moved to... * doc/examples/emit-alphabet.bf: ...here. * docs/examples/tut01-hello-world.c: Moved to... * doc/examples/tut01-hello-world.c: ...here. * docs/examples/tut01-hello-world.cc: Moved to... * doc/examples/tut01-hello-world.cc: ...here. * docs/examples/tut02-square.c: Moved to... * doc/examples/tut02-square.c: ...here. * docs/examples/tut02-square.cc: Moved to... * doc/examples/tut02-square.cc: ...here. * docs/examples/tut03-sum-of-squares.c: Moved to... * doc/examples/tut03-sum-of-squares.c: ...here. * docs/examples/tut03-sum-of-squares.cc: Moved to... * doc/examples/tut03-sum-of-squares.cc: ...here. * docs/examples/tut04-toyvm/Makefile: Moved to... * doc/examples/tut04-toyvm/Makefile: ...here. * docs/examples/tut04-toyvm/factorial.toy: Moved to... * doc/examples/tut04-toyvm/factorial.toy: ...here. * docs/examples/tut04-toyvm/fibonacci.toy: Moved to... * doc/examples/tut04-toyvm/fibonacci.toy: ...here. * docs/examples/tut04-toyvm/toyvm.c: Moved to... * doc/examples/tut04-toyvm/toyvm.c: ...here. * docs/examples/tut04-toyvm/toyvm.cc: Moved to... * doc/examples/tut04-toyvm/toyvm.cc: ...here. * docs/examples/tut05-bf.c: Moved to... * doc/examples/tut05-bf.c: ...here. * docs/index.rst: Moved to... * doc/index.rst: ...here. * docs/internals/index.rst: Moved to... * doc/internals/index.rst: ...here. * docs/internals/test-hello-world.exe.log.txt: Moved to... * doc/internals/test-hello-world.exe.log.txt: ...here. * docs/_build/texinfo/libgccjit-figures/factorial.png: Moved to... * doc/intro/factorial.png: ...here. * docs/intro/index.rst: Moved to... * doc/intro/index.rst: ...here. * docs/_build/texinfo/libgccjit-figures/sum-of-squares.png: Moved to... * doc/intro/sum-of-squares.png: ...here. * docs/intro/tutorial01.rst: Moved to... * doc/intro/tutorial01.rst: ...here. * docs/intro/tutorial02.rst: Moved to... * doc/intro/tutorial02.rst: ...here. * docs/intro/tutorial03.rst: Moved to... * doc/intro/tutorial03.rst: ...here. * docs/intro/tutorial04.rst: Moved to... * doc/intro/tutorial04.rst: ...here. * docs/intro/tutorial05.rst: Moved to... * doc/intro/tutorial05.rst: ...here. * docs/topics/asm.rst: Moved to... * doc/topics/asm.rst: ...here. * docs/topics/compatibility.rst: Moved to... * doc/topics/compatibility.rst: ...here. * docs/topics/compilation.rst: Moved to... * doc/topics/compilation.rst: ...here. * docs/topics/contexts.rst: Moved to... * doc/topics/contexts.rst: ...here. * docs/topics/expressions.rst: Moved to... * doc/topics/expressions.rst: ...here. * docs/topics/function-pointers.rst: Moved to... * doc/topics/function-pointers.rst: ...here. * docs/topics/functions.rst: Moved to... * doc/topics/functions.rst: ...here. * docs/topics/index.rst: Moved to... * doc/topics/index.rst: ...here. * docs/topics/locations.rst: Moved to... * doc/topics/locations.rst: ...here. * docs/topics/objects.rst: Moved to... * doc/topics/objects.rst: ...here. * docs/topics/performance.rst: Moved to... * doc/topics/performance.rst: ...here. * docs/topics/types.rst: Moved to... * doc/topics/types.rst: ...here. * docs/Makefile: Removed. * docs/_build/texinfo/Makefile: Removed. * docs/_build/texinfo/libgccjit-figures/factorial1.png: Removed. * docs/_build/texinfo/libgccjit-figures/sum-of-squares1.png: Removed. * docs/_build/texinfo/libgccjit.texi: Removed. * docs/conf.py: Removed. * docs/intro/factorial.png: Removed. * docs/intro/sum-of-squares.png: Removed. * doc/conf.py: New file.
2022-07-28jit,docs: shorten assembly outputMartin Liška1-1/+1
Shorten the assembly example so that there is not slider. Ready for master? Thanks, Martin gcc/jit/ChangeLog: * docs/cp/intro/tutorial02.rst: Shorten the assembly example so that there is not slider. * docs/cp/intro/tutorial04.rst: Likewise. * docs/intro/tutorial02.rst: Likewise. * docs/intro/tutorial04.rst: Likewise. * docs/topics/contexts.rst: Likewise.
2022-07-28jit,docs: use :expr:`type *` for pointers to a typemarxin3-10/+10
gcc/jit/ChangeLog: * docs/cp/intro/tutorial02.rst: Use :expr:`type *` for pointers to a type * docs/cp/topics/asm.rst: Likewise. * docs/cp/topics/contexts.rst: Likewise. * docs/cp/topics/expressions.rst: Likewise. * docs/cp/topics/functions.rst: Likewise. * docs/cp/topics/objects.rst: Likewise. * docs/intro/tutorial02.rst: Likewise. * docs/intro/tutorial03.rst: Likewise. * docs/intro/tutorial04.rst: Likewise. * docs/intro/tutorial05.rst: Likewise. * docs/topics/compilation.rst: Likewise. * docs/topics/contexts.rst: Likewise. * docs/topics/objects.rst: Likewise.
2022-07-28jit,docs: use list-table instead of fixed tablemarxin3-82/+148
Use rather list-table that is easible to maintainer and one does not have to wrap lines. Moreover, it provides great attribute :widths: that correctly works (tested for HTML and PDF). gcc/jit/ChangeLog: * docs/cp/intro/tutorial04.rst: Use list-table. * docs/intro/tutorial04.rst: Likewise. * docs/intro/tutorial05.rst: Likewise. * docs/topics/compilation.rst: Likewise. * docs/topics/expressions.rst: Likewise. * docs/topics/types.rst: Likewise.
2022-07-28jit,docs: replace c:type:`int_type` with :expr:`int_type`marxin3-6/+6
Use expression that work fine for basic type. gcc/jit/ChangeLog: * docs/cp/topics/expressions.rst: Use :expr: for basic types. * docs/topics/compilation.rst: Likewise. * docs/topics/expressions.rst: Likewise. * docs/topics/function-pointers.rst: Likewise.
2022-07-28jit,docs: use enum directive for enumeral typesmarxin4-11/+11
gcc/jit/ChangeLog: * docs/conf.py: Add needs_sphinx = '3.0' where c:type was added. * docs/index.rst: Remove note about it. * docs/topics/compilation.rst: Use enum directive and reference. * docs/topics/contexts.rst: Likewise. * docs/topics/expressions.rst: Likewise. * docs/topics/functions.rst: Likewise.
2022-04-12libgccjit: Add support for setting the alignment [PR104293]Antoni Boucher2-0/+49
gcc/jit/ PR jit/104293 * docs/_build/texinfo/libgccjit.texi: Regenerate. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_24): New ABI tag. * docs/topics/expressions.rst: Add documentation for the functions gcc_jit_lvalue_set_alignment and gcc_jit_lvalue_get_alignment. * jit-playback.h: New function (set_alignment). * jit-recording.cc: New function (set_alignment). * jit-recording.h: New functions (set_alignment, get_alignment) and new field (m_alignment). * libgccjit.cc: New functions (gcc_jit_lvalue_get_alignment, gcc_jit_lvalue_set_alignment) * libgccjit.h: New functions (gcc_jit_lvalue_get_alignment, gcc_jit_lvalue_set_alignment) * libgccjit.map (LIBGCCJIT_ABI_24): New ABI tag. gcc/testsuite/ PR jit/104293 * jit.dg/all-non-failing-tests.h: Mention test-setting-alignment. * jit.dg/test-setting-alignment.c: New test.
2022-04-12libgccjit: Add function to hide stderr logs [PR104073]Antoni Boucher2-0/+24
gcc/jit/ PR jit/104073 * docs/_build/texinfo/libgccjit.texi: Regenerate. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_23): New ABI tag. * docs/topics/contexts.rst: Add documentation for the new function gcc_jit_context_set_bool_print_errors_to_stderr. * jit-common.h: New enum value (INNER_BOOL_OPTION_PRINT_ERRORS_TO_STDERR). * jit-recording.cc: Handle the new option INNER_BOOL_OPTION_PRINT_ERRORS_TO_STDERR. * libgccjit.cc: New function (gcc_jit_context_set_bool_print_errors_to_stderr). * libgccjit.h: New function (gcc_jit_context_set_bool_print_errors_to_stderr). * libgccjit.map (LIBGCCJIT_ABI_23): New ABI tag.
2022-04-12libgccjit: Add support for register variables [PR104072]Antoni Boucher2-0/+29
gcc/jit/ PR jit/104072 * docs/_build/texinfo/libgccjit.texi: Regenerate. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_22): New ABI tag. * docs/topics/expressions.rst: Add documentation for the function gcc_jit_lvalue_set_register_name. * jit-playback.h: New function (set_register_name). * jit-recording.cc: New function (set_register_name) and add support for register variables. * jit-recording.h: New field (m_reg_name) and new function (set_register_name). * libgccjit.cc: New function (gcc_jit_lvalue_set_register_name). * libgccjit.h: New function (gcc_jit_lvalue_set_register_name). * libgccjit.map (LIBGCCJIT_ABI_22): New ABI tag. gcc/ PR jit/104072 * reginfo.cc: New functions (clear_global_regs_cache, reginfo_cc_finalize) to avoid an issue where compiling the same code multiple times gives an error about assigning the same register to 2 global variables. * rtl.h: New function (reginfo_cc_finalize). * toplev.cc: Call it. gcc/testsuite/ PR jit/104072 * jit.dg/all-non-failing-tests.h: Add new test-register-variable. * jit.dg/harness.h: Add -fdiagnostics-color=never to context's command-line options. * jit.dg/test-error-register-variable-bad-name.c: New test. * jit.dg/test-error-register-variable-size-mismatch.c: New test. * jit.dg/test-register-variable.c: New test.
2022-04-12libgccjit: Add support for bitcasts [PR104071]Antoni Boucher2-0/+28
gcc/jit/ PR jit/104071 * docs/_build/texinfo/libgccjit.texi: Regenerate. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_21): New ABI tag. * docs/topics/expressions.rst: Add documentation for the function gcc_jit_context_new_bitcast. * jit-playback.cc: New function (new_bitcast). * jit-playback.h: New function (new_bitcast). * jit-recording.cc: New functions (new_bitcast, bitcast::replay_into, bitcast::visit_children, bitcast::make_debug_string, bitcast::write_reproducer). * jit-recording.h: New class (bitcast) and new function (new_bitcast, bitcast::replay_into, bitcast::visit_children, bitcast::make_debug_string, bitcast::write_reproducer, bitcast::get_precedence). * libgccjit.cc: New function (gcc_jit_context_new_bitcast) * libgccjit.h: New function (gcc_jit_context_new_bitcast) * libgccjit.map (LIBGCCJIT_ABI_21): New ABI tag. gcc/testsuite/ PR jit/104071 * jit.dg/all-non-failing-tests.h: Add new test-bitcast. * jit.dg/test-bitcast.c: New test. * jit.dg/test-error-bad-bitcast.c: New test. * jit.dg/test-error-bad-bitcast2.c: New test. gcc/ PR jit/104071 * toplev.cc: Call the new function tree_cc_finalize in toplev::finalize. * tree.cc: New functions (clear_nonstandard_integer_type_cache and tree_cc_finalize) to clear the cache of non-standard integer types to avoid having issues with some optimizations of bitcast where the SSA_NAME will have a size of a cached integer type that should have been invalidated, causing a comparison of integer constant to fail. * tree.h: New function (tree_cc_finalize).
2022-04-12libgccjit: Add support for sized integer types, including 128-bit integers ↵Antoni Boucher2-0/+61
[PR95325] gcc/jit/ PR target/95325 * docs/_build/texinfo/libgccjit.texi: Regenerate * docs/topics/compatibility.rst (LIBGCCJIT_ABI_20): New ABI tag. * docs/topics/types.rst: Add documentation for the new types GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T, GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T, GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T, GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T and new functions (gcc_jit_compatible_types, gcc_jit_type_get_size). * jit-builtins.cc: Add support for BT_UINT128. * jit-common.h: Update the value of NUM_GCC_JIT_TYPES. * jit-playback.cc: Add support for the sized integer types. * jit-recording.cc: Add support for the sized integer types. * jit-recording.h: Add support for comparing integer types and new function (is_signed). * libgccjit.cc (gcc_jit_compatible_types): New. (gcc_jit_type_get_size) New. * libgccjit.h: New enum variants for gcc_jit_types (GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T, GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T, GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T, GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T) and new functions (gcc_jit_compatible_types, gcc_jit_type_get_size). * libgccjit.map (LIBGCCJIT_ABI_20): New ABI tag. gcc/testsuite/ PR target/95325 * jit.dg/test-types.c: Add tests for sized integer types.
2022-04-01jit: further doc fixesDavid Malcolm2-7/+7
Further jit doc fixes, which fix links to gcc_jit_function_type_get_param_type and gcc_jit_struct_get_field. gcc/jit/ChangeLog: * docs/topics/expressions.rst: Fix formatting. * docs/topics/types.rst: Likewise. * docs/_build/texinfo/libgccjit.texi: Regenerate Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-04-01jit: Update docsPetter Tomner4-11/+29
Update docs concerning linking and fix formatting errors. gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Add 19 tag * docs/topics/compilation.rst: Linking * docs/topics/contexts.rst: Linking example * docs/topics/expressions.rst: Fix formatting and dropped 's' Signed-off-by: Petter Tomner 2022-02-19 <tomner@kth.se>
2022-01-03Update copyright years.Jakub Jelinek12-12/+12
2021-12-28docs: replace http:// with https://Martin Liska12-12/+12
I replaced and verified http:// links for various domains. gcc/ada/ChangeLog: * doc/share/gnu_free_documentation_license.rst: Replace http:// with https. * gnat-style.texi: Likewise. * gnat_rm.texi: Likewise. * gnat_ugn.texi: Likewise. gcc/d/ChangeLog: * gdc.texi: Replace http:// with https. gcc/ChangeLog: * doc/contrib.texi: Replace http:// with https. * doc/contribute.texi: Likewise. * doc/extend.texi: Likewise. * doc/gccint.texi: Likewise. * doc/gnu.texi: Likewise. * doc/implement-c.texi: Likewise. * doc/implement-cxx.texi: Likewise. * doc/include/fdl.texi: Likewise. * doc/include/gpl_v3.texi: Likewise. * doc/install.texi: Likewise. * doc/invoke.texi: Likewise. * doc/passes.texi: Likewise. * doc/service.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/standards.texi: Likewise. gcc/fortran/ChangeLog: * gfortran.texi: Replace http:// with https. * intrinsic.texi: Likewise. gcc/go/ChangeLog: * gccgo.texi: Replace http:// with https. gcc/jit/ChangeLog: * docs/_build/texinfo/libgccjit.texi: Replace http:// with https. * docs/cp/index.rst: Likewise. * docs/cp/intro/index.rst: Likewise. * docs/cp/intro/tutorial01.rst: Likewise. * docs/cp/intro/tutorial02.rst: Likewise. * docs/cp/intro/tutorial03.rst: Likewise. * docs/cp/intro/tutorial04.rst: Likewise. * docs/cp/topics/asm.rst: Likewise. * docs/cp/topics/compilation.rst: Likewise. * docs/cp/topics/contexts.rst: Likewise. * docs/cp/topics/expressions.rst: Likewise. * docs/cp/topics/functions.rst: Likewise. * docs/cp/topics/index.rst: Likewise. * docs/cp/topics/locations.rst: Likewise. * docs/cp/topics/objects.rst: Likewise. * docs/cp/topics/types.rst: Likewise. * docs/index.rst: Likewise. * docs/internals/index.rst: Likewise. * docs/intro/index.rst: Likewise. * docs/intro/tutorial01.rst: Likewise. * docs/intro/tutorial02.rst: Likewise. * docs/intro/tutorial03.rst: Likewise. * docs/intro/tutorial04.rst: Likewise. * docs/intro/tutorial05.rst: Likewise. * docs/topics/asm.rst: Likewise. * docs/topics/compatibility.rst: Likewise. * docs/topics/compilation.rst: Likewise. * docs/topics/contexts.rst: Likewise. * docs/topics/expressions.rst: Likewise. * docs/topics/function-pointers.rst: Likewise. * docs/topics/functions.rst: Likewise. * docs/topics/index.rst: Likewise. * docs/topics/locations.rst: Likewise. * docs/topics/objects.rst: Likewise. * docs/topics/performance.rst: Likewise. * docs/topics/types.rst: Likewise.
2021-12-14Add support for global rvalue initialization and constructorsPetter Tomner1-0/+173
This patch adds support for initialization of global variables with rvalues and creating constructors for array, struct and union types which can be used as rvalues. Signed-off-by: 2021-12-14 Petter Tomner <tomner@kth.se> gcc/jit/ * jit-common.h: New enum * jit-playback.c : Folding an setting intitial (global_new_decl) : Handle const global generation (new_global) : New flag (global_set_init_rvalue) : New (new_ctor) : New (new_global_initialized) : Flag (as_truth_value) : Fold (new_unary_op) : Fold (new_binary_op) : Fold (new_comparison) : Fold (new_array_access) : Fold (new_dereference) : Fold (get_address) : Fold * jit-playback.h : (global_set_init_rvalue) : New (new_ctor) : New * jit-recording.c : * jit-recording.h : (new_global_init_rvalue) : New (new_ctor) : New (ctor) : New, inherits rvalue (global_init_rvalue) : New, inherits memento (type::is_union) : New * libgccjit++.h : New entrypoints, see C-header * libgccjit.c : See .h * libgccjit.h : New entrypoints (gcc_jit_context_new_array_constructor) : New (gcc_jit_context_new_struct_constructor) : New (gcc_jit_context_new_union_constructor) : New (gcc_jit_global_set_initializer_rvalue) : New (LIBGCCJIT_HAVE_CTORS) : New feuture macro * libgccjit.map : New entrypoints added to ABI 19 * docs/topics/expressions.rst : Updated docs gcc/testsuite/ * jit.dg/all-non-failing-tests.h: Added two tests * jit.dg/test-error-ctor-array-wrong-obj.c: New * jit.dg/test-error-ctor-struct-too-big.c: New * jit.dg/test-error-ctor-struct-wrong-field-obj.c: New * jit.dg/test-error-ctor-struct-wrong-type.c: New * jit.dg/test-error-ctor-struct-wrong-type2.c * jit.dg/test-error-ctor-union-wrong-field-name.c: New * jit.dg/test-error-global-already-init.c: New * jit.dg/test-error-global-common-section.c: New * jit.dg/test-error-global-init-too-small-array.c: New * jit.dg/test-error-global-lvalue-init.c: New * jit.dg/test-error-global-nonconst-init.c: New * jit.dg/test-global-init-rvalue.c: New * jit.dg/test-local-init-rvalue.c: New
2021-12-12libgccjit: Add support for setting the link section of global variables ↵Antoni Boucher2-0/+30
[PR100688] 2021-12-12 Antoni Boucher <bouanto@zoho.com> gcc/jit/ PR target/100688 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_18): New ABI tag. * docs/topics/expressions.rst: Add documentation for the function gcc_jit_lvalue_set_link_section. * jit-playback.h: New function (set_link_section). * jit-recording.c: New function (set_link_section) and support for setting the link section. * jit-recording.h: New function (set_link_section) and new field m_link_section. * libgccjit.c: New function (gcc_jit_lvalue_set_link_section). * libgccjit.h: New function (gcc_jit_lvalue_set_link_section). * libgccjit.map (LIBGCCJIT_ABI_18): New ABI tag. gcc/testsuite/ PR target/100688 * jit.dg/all-non-failing-tests.h: Mention new test link-section-assembler. * jit.dg/test-link-section-assembler.c: New test. * jit.dg/jit.exp: New helper function to test that the assembly contains a pattern.
2021-12-11libgccjit: Add support for TLS variable [PR95415]Antoni Boucher2-0/+46
2021-12-11 Antoni Boucher <bouanto@zoho.com> gcc/jit/ PR target/95415 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_17): New ABI tag. * docs/topics/expressions.rst: Add document for the function gcc_jit_lvalue_set_tls_model. * jit-playback.h: New function (set_tls_model). * jit-recording.c: New function (set_tls_model), new variables (tls_models and tls_model_enum_strings) and support for setting the tls model. * jit-recording.h: New function (set_tls_model) and new field m_tls_model. * libgccjit.c: New function (gcc_jit_lvalue_set_tls_model). * libgccjit.h: New function (gcc_jit_lvalue_set_tls_model) and new enum (gcc_jit_tls_model). * libgccjit.map (LIBGCCJIT_ABI_17): New ABI tag. gcc/testsuite/ PR target/95415 * jit.dg/all-non-failing-tests.h: Add test-tls.c. * jit.dg/test-tls.c: New test.
2021-11-19libgccjit: Add some reflection functions [PR96889]Antoni Boucher3-1/+190
2021-11-19 Antoni Boucher <bouanto@zoho.com> gcc/jit/ PR target/96889 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_16): New ABI tag. * docs/topics/functions.rst: Add documentation for the functions gcc_jit_function_get_return_type and gcc_jit_function_get_param_count * docs/topics/types.rst: Add documentation for the functions gcc_jit_function_type_get_return_type, gcc_jit_function_type_get_param_count, gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified, gcc_jit_type_dyncast_array, gcc_jit_type_is_bool, gcc_jit_type_dyncast_function_ptr_type, gcc_jit_type_is_integral, gcc_jit_type_is_pointer, gcc_jit_type_dyncast_vector, gcc_jit_vector_type_get_element_type, gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field, gcc_jit_type_is_struct, and gcc_jit_struct_get_field_count * libgccjit.c: (gcc_jit_function_get_return_type, gcc_jit_function_get_param_count, gcc_jit_function_type_get_return_type, gcc_jit_function_type_get_param_count, gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified, gcc_jit_type_dyncast_array, gcc_jit_type_is_bool, gcc_jit_type_dyncast_function_ptr_type, gcc_jit_type_is_integral, gcc_jit_type_is_pointer, gcc_jit_type_dyncast_vector, gcc_jit_vector_type_get_element_type, gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field, gcc_jit_type_is_struct, gcc_jit_struct_get_field_count): New functions. (struct gcc_jit_function_type, struct gcc_jit_vector_type): New types. * libgccjit.h: (gcc_jit_function_get_return_type, gcc_jit_function_get_param_count, gcc_jit_function_type_get_return_type, gcc_jit_function_type_get_param_count, gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified, gcc_jit_type_dyncast_array, gcc_jit_type_is_bool, gcc_jit_type_dyncast_function_ptr_type, gcc_jit_type_is_integral, gcc_jit_type_is_pointer, gcc_jit_type_dyncast_vector, gcc_jit_vector_type_get_element_type, gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field, gcc_jit_type_is_struct, gcc_jit_struct_get_field_count): New function declarations. (struct gcc_jit_function_type, struct gcc_jit_vector_type): New types. * jit-recording.h: New functions (is_struct and is_vector) * libgccjit.map (LIBGCCJIT_ABI_16): New ABI tag. gcc/testsuite/ PR target/96889 * jit.dg/all-non-failing-tests.h: Add test-reflection.c. * jit.dg/test-reflection.c: New test.
2021-01-04Update copyright years.Jakub Jelinek12-12/+12
2020-11-12jit: add support for inline asm [PR87291]David Malcolm5-0/+333
This patch adds various entrypoints to libgccjit for directly embedding asm statements into a compile, analogous to inline asm in the C frontend: gcc_jit_block_add_extended_asm gcc_jit_block_end_with_extended_asm_goto gcc_jit_extended_asm_as_object gcc_jit_extended_asm_set_volatile_flag gcc_jit_extended_asm_set_inline_flag gcc_jit_extended_asm_add_output_operand gcc_jit_extended_asm_add_input_operand gcc_jit_extended_asm_add_clobber gcc_jit_context_add_top_level_asm gcc/jit/ChangeLog: PR jit/87291 * docs/cp/topics/asm.rst: New file. * docs/cp/topics/index.rst (Topic Reference): Add it. * docs/topics/asm.rst: New file. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_15): New. * docs/topics/functions.rst (Statements): Add link to extended asm. * docs/topics/index.rst (Topic Reference): Add asm.rst. * docs/topics/objects.rst: Add gcc_jit_extended_asm to ASCII art. * docs/_build/texinfo/Makefile: Regenerate. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::recording::extended_asm): New forward decl. (gcc::jit::recording::top_level_asm): Likewise. * jit-playback.c: Include "stmt.h". (build_string): New. (gcc::jit::playback::context::new_string_literal): Disambiguate build_string call. (gcc::jit::playback::context::add_top_level_asm): New. (build_operand_chain): New. (build_clobbers): New. (build_goto_operands): New. (gcc::jit::playback::block::add_extended_asm): New. * jit-playback.h (gcc::jit::playback::context::add_top_level_asm): New decl. (struct gcc::jit::playback::asm_operand): New struct. (gcc::jit::playback::block::add_extended_asm): New decl. * jit-recording.c (gcc::jit::recording::context::dump_to_file): Dump top-level asms. (gcc::jit::recording::context::add_top_level_asm): New. (gcc::jit::recording::block::add_extended_asm): New. (gcc::jit::recording::block::end_with_extended_asm_goto): New. (gcc::jit::recording::asm_operand::asm_operand): New. (gcc::jit::recording::asm_operand::print): New. (gcc::jit::recording::asm_operand::make_debug_string): New. (gcc::jit::recording::output_asm_operand::write_reproducer): New. (gcc::jit::recording::output_asm_operand::print): New. (gcc::jit::recording::input_asm_operand::write_reproducer): New. (gcc::jit::recording::input_asm_operand::print): New. (gcc::jit::recording::extended_asm::add_output_operand): New. (gcc::jit::recording::extended_asm::add_input_operand): New. (gcc::jit::recording::extended_asm::add_clobber): New. (gcc::jit::recording::extended_asm::replay_into): New. (gcc::jit::recording::extended_asm::make_debug_string): New. (gcc::jit::recording::extended_asm::write_flags): New. (gcc::jit::recording::extended_asm::write_clobbers): New. (gcc::jit::recording::extended_asm_simple::write_reproducer): New. (gcc::jit::recording::extended_asm::maybe_populate_playback_blocks): New. (gcc::jit::recording::extended_asm_goto::extended_asm_goto): New. (gcc::jit::recording::extended_asm_goto::replay_into): New. (gcc::jit::recording::extended_asm_goto::write_reproducer): New. (gcc::jit::recording::extended_asm_goto::get_successor_blocks): New. (gcc::jit::recording::extended_asm_goto::maybe_print_gotos): New. (gcc::jit::recording::extended_asm_goto::maybe_populate_playback_blocks): New. (gcc::jit::recording::top_level_asm::top_level_asm): New. (gcc::jit::recording::top_level_asm::replay_into): New. (gcc::jit::recording::top_level_asm::make_debug_string): New. (gcc::jit::recording::top_level_asm::write_to_dump): New. (gcc::jit::recording::top_level_asm::write_reproducer): New. * jit-recording.h (gcc::jit::recording::context::add_top_level_asm): New decl. (gcc::jit::recording::context::m_top_level_asms): New field. (gcc::jit::recording::block::add_extended_asm): New decl. (gcc::jit::recording::block::end_with_extended_asm_goto): New decl. (gcc::jit::recording::asm_operand): New class. (gcc::jit::recording::output_asm_operand): New class. (gcc::jit::recording::input_asm_operand): New class. (gcc::jit::recording::extended_asm): New class. (gcc::jit::recording::extended_asm_simple): New class. (gcc::jit::recording::extended_asm_goto): New class. (gcc::jit::recording::top_level_asm): New class. * libgccjit++.h (gccjit::extended_asm): New forward decl. (gccjit::context::add_top_level_asm): New. (gccjit::block::add_extended_asm): New. (gccjit::block::end_with_extended_asm_goto): New. (gccjit::extended_asm): New class. (gccjit::extended_asm::extended_asm): New ctors. (gccjit::extended_asm::set_volatile_flag): New. (gccjit::extended_asm::set_inline_flag): New. (gccjit::extended_asm::add_output_operand): New. (gccjit::extended_asm::add_input_operand): New. (gccjit::extended_asm::add_clobber): New. (gccjit::extended_asm::get_inner_extended_asm): New. * libgccjit.c (struct gcc_jit_extended_asm): New. (jit_error): Make "loc" param take a gcc::jit::recording::location * rather than a gcc_jit_location *. (gcc_jit_block_add_extended_asm): New entrypoint. (gcc_jit_block_end_with_extended_asm_goto): New entrypoint. (gcc_jit_extended_asm_as_object): New entrypoint. (gcc_jit_extended_asm_set_volatile_flag): New entrypoint. (gcc_jit_extended_asm_set_inline_flag): New entrypoint. (gcc_jit_extended_asm_add_output_operand): New entrypoint. (gcc_jit_extended_asm_add_clobber): New entrypoint. (gcc_jit_context_add_top_level_asm): New entrypoint. * libgccjit.h: Add gcc_jit_extended_asm to ASCII art. (gcc_jit_extended_asm): New typedef. (LIBGCCJIT_HAVE_ASM_STATEMENTS): New define. (gcc_jit_block_add_extended_asm): New entrypoint. (gcc_jit_block_end_with_extended_asm_goto): New entrypoint. (gcc_jit_extended_asm_as_object): New entrypoint. (gcc_jit_extended_asm_set_volatile_flag): New entrypoint. (gcc_jit_extended_asm_set_inline_flag): New entrypoint. (gcc_jit_extended_asm_add_output_operand): New entrypoint. (gcc_jit_extended_asm_add_input_operand): New entrypoint. (gcc_jit_extended_asm_add_clobber): New entrypoint. (gcc_jit_context_add_top_level_asm): New entrypoint. * libgccjit.map (LIBGCCJIT_ABI_15): New. gcc/testsuite/ChangeLog: PR jit/87291 * jit.dg/jit.exp: Load target-supports-dg.exp. Set dg-do-what-default. (jit-dg-test): Set dg-do-what and call dg-get-options, skipping the test if it's not supported on the given target. * jit.dg/test-asm.c: New test. * jit.dg/test-asm.cc: New test.
2020-09-11libgccjit: Add new gcc_jit_global_set_initializer entry pointAndrea Corallo2-0/+28
gcc/jit/ChangeLog 2020-08-01 Andrea Corallo <andrea.corallo@arm.com> * docs/topics/compatibility.rst (LIBGCCJIT_ABI_14): New ABI tag. * docs/topics/expressions.rst (gcc_jit_global_set_initializer): Document new entry point in section 'Global variables'. * jit-playback.c (global_new_decl, global_finalize_lvalue): New method. (playback::context::new_global): Make use of global_new_decl, global_finalize_lvalue. (load_blob_in_ctor): New template function in use by the following. (playback::context::new_global_initialized): New method. * jit-playback.h (class context): Decl 'new_global_initialized', 'global_new_decl', 'global_finalize_lvalue'. (lvalue::set_initializer): Add implementation. * jit-recording.c (recording::memento_of_get_pointer::get_size) (recording::memento_of_get_type::get_size): Add implementation. (recording::global::write_initializer_reproducer): New function in use by 'recording::global::write_reproducer'. (recording::global::replay_into) (recording::global::write_to_dump) (recording::global::write_reproducer): Handle initialized case. * jit-recording.h (class type): Decl 'get_size' and 'num_elements'. * libgccjit++.h (class lvalue): Declare new 'set_initializer' method. (class lvalue): Decl 'is_global' and 'set_initializer'. (class global) Decl 'write_initializer_reproducer'. Add 'm_initializer', 'm_initializer_num_bytes' fields. Implement 'set_initializer'. Add a destructor to free 'm_initializer'. * libgccjit.c (gcc_jit_global_set_initializer): New function. * libgccjit.h (gcc_jit_global_set_initializer): New function declaration. * libgccjit.map (LIBGCCJIT_ABI_14): New ABI tag. gcc/testsuite/ChangeLog 2020-08-01 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/all-non-failing-tests.h: Add test-blob.c. * jit.dg/test-global-set-initializer.c: New testcase.
2020-05-26jit: fix missing types for builtins [PR 95306]David Malcolm1-0/+15
PR jit/95306 reports that attempts to use builtins __builtin_sadd_overflow" and "__builtin_memcpy" via gcc_jit_context_get_builtin_function lead to inscrutable error messages of the form: unimplemented primitive type for builtin: 42 and: unimplemented primitive type for builtin: 38 The root cause is that jit-builtins.c only implements a subset of the types defined via DEF_PRIMITIVE_TYPE in builtin-types.def. This patch: - implements enough types to enable the above two builtins to be referenced - documents gcc_jit_context_get_builtin_function, and notes the limitation that not all types are supported (supporting some of them would take a lot of extra work) - improves the error message for the unsupported cases - adds a testcase for __builtin_memcpy. This required jit_langhook_global_bindings_p to be implemented (otherwise the assertion there failed deep inside "expand" on the builtin) - adds test coverage for the above gcc/jit/ChangeLog: PR jit/95306 * docs/topics/functions.rst (gcc_jit_context_get_builtin_function): Document. * docs/_build/texinfo/libgccjit.texi: Regenerate. * dummy-frontend.c (jit_langhook_global_bindings_p): Remove gcc_unreachable. * jit-builtins.c (type_names): New array. (get_string_for_type_id): New function. (gcc::jit::builtins_manager::make_primitive_type): Show name of type in error messages. Update cases to reflect the order in builtin-types.def. Implement cases for BT_INT8, BT_INT16, BT_UINT8, BT_CONST_PTR, BT_VOLATILE_PTR, BT_INT_PTR, BT_FLOAT_PTR, BT_CONST_DOUBLE_PTR, BT_SIZE, BT_CONST_SIZE. gcc/testsuite/ChangeLog: PR jit/95306 * jit.dg/all-non-failing-tests.h: Add test-builtin-memcpy.c and test-pr95306-builtin-types.c. * jit.dg/test-builtin-memcpy.c: New test. * jit.dg/test-error-gcc_jit_context_get_builtin_function-unimplemented-type.c: New test. * jit.dg/test-pr95306-builtin-types.c: New test.
2020-05-26jit: fix sphinx formatting issues in docsDavid Malcolm2-1/+6
gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Fix underline. Fix missing labels. * docs/topics/types.rst: Fix missing blank line. * docs/_build/texinfo/libgccjit.texi: Regenerate.
2020-05-26jit: check for void types [PR 95296]David Malcolm4-2/+16
PR jit/95296 reports an ICE when using libgccjit to create a local of void type. This patch adds checking to various API entrypoints in libgccjit.c so that they fail gracefully with an error if the client code attempts to create various kinds of rvalues or types involving void types. The patch documents these and various pre-existing restrictions on types in the API. gcc/jit/ChangeLog: PR jit/95296 * docs/topics/expressions.rst (Unary Operations): Document that result_type of gcc_jit_context_new_unary_op must be a numeric type. (Binary Operations): Likewise for gcc_jit_context_new_binary_op. (Global variables): Document that "type" of gcc_jit_context_new_global must be non-`void`. * docs/topics/function-pointers.rst (gcc_jit_context_new_function_ptr_type): Document that the param_types must be non-void, but that return_type may be. * docs/topics/functions.rst (Params): Document that gcc_jit_context_new_param's type must be non-void. (Functions): Likewise for gcc_jit_function_new_local. * docs/topics/types.rst (gcc_jit_context_new_array_type): Document that the type must be non-void. (gcc_jit_context_new_field): Likewise. * docs/_build/texinfo/Makefile: Regenerate. * docs/_build/texinfo/libgccjit.texi: Regenerate. * libgccjit.c (gcc_jit_context_new_array_type): Fail if element_type is void. (gcc_jit_context_new_field): Likewise for "type". (gcc_jit_context_new_function_ptr_type): Likewise for each element of param_types. (gcc_jit_context_new_param): Likewise for "type". (gcc_jit_context_new_global): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_type_get_aligned): Likewise. gcc/testsuite/ChangeLog: PR jit/95296 * jit.dg/test-error-gcc_jit_context_new_global-void-type.c: New test. * jit.dg/test-error-gcc_jit_function_new_local-void-type.c: New test. * jit.dg/test-fuzzer.c (fuzzer_init): Allow for make_random_type to return NULL. (get_random_type): Allow for elements in f->types to be NULL.
2020-03-31libgccjit: add new version entry pointAndreaCorallo1-0/+33
gcc/jit/ChangeLog 2020-03-31 Andrea Corallo <andrea.corallo@arm.com> David Malcolm <dmalcolm@redhat.com> * docs/topics/compatibility.rst (LIBGCCJIT_ABI_13): New ABI tag plus add version paragraph. * libgccjit++.h (namespace gccjit::version): Add new namespace. * libgccjit.c (gcc_jit_version_major, gcc_jit_version_minor) (gcc_jit_version_patchlevel): New functions. * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_version): New macro. (gcc_jit_version_major, gcc_jit_version_minor) (gcc_jit_version_patchlevel): New functions. * libgccjit.map (LIBGCCJIT_ABI_13) New ABI tag. gcc/testsuite/ChangeLog 2020-03-31 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/test-version.c: New testcase. * jit.dg/all-non-failing-tests.h: Add test-version.c.
2020-01-01Update copyright years.Jakub Jelinek11-11/+11
From-SVN: r279813
2019-07-04introduce gcc_jit_context_new_bitfieldAndrea Corallo2-0/+29
gcc/jit/ChangeLog: 2019-07-04 Andrea Corallo <andrea.corallo@arm.com> * docs/topics/compatibility.rst (LIBGCCJIT_ABI_12): New ABI tag. * docs/topics/types.rst: Add gcc_jit_context_new_bitfield. * jit-common.h (namespace recording): Add class bitfield. * jit-playback.c: (DECL_C_BIT_FIELD, SET_DECL_C_BIT_FIELD): Add macros. (playback::context::new_bitfield): New method. (playback::compound_type::set_fields): Add bitfield support. (playback::lvalue::mark_addressable): Was jit_mark_addressable make this a method of lvalue plus return a bool to communicate success. (playback::lvalue::get_address): Check for jit_mark_addressable return value. * jit-playback.h (new_bitfield): New method. (class bitfield): New class. (class lvalue): Add jit_mark_addressable method. * jit-recording.c (recording::context::new_bitfield): New method. (recording::bitfield::replay_into): New method. (recording::bitfield::write_to_dump): Likewise. (recording::bitfield::make_debug_string): Likewise. (recording::bitfield::write_reproducer): Likewise. * jit-recording.h (class context): Add new_bitfield method. (class field): Make it derivable by class bitfield. (class bitfield): Add new class. * libgccjit++.h (class context): Add new_bitfield method. * libgccjit.c (struct gcc_jit_bitfield): New structure. (gcc_jit_context_new_bitfield): New function. * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_context_new_bitfield) New macro. (gcc_jit_context_new_bitfield): New function. * libgccjit.map (LIBGCCJIT_ABI_12) New ABI tag. gcc/testsuite/ChangeLog: 2019-07-04 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/all-non-failing-tests.h: Add test-accessing-bitfield.c. * jit.dg/test-accessing-bitfield.c: New testcase. * jit.dg/test-error-gcc_jit_context_new_bitfield-invalid-type.c: Likewise. * jit.dg/test-error-gcc_jit_context_new_bitfield-invalid-width.c: Likewise. * jit.dg/test-error-gcc_jit_lvalue_get_address-bitfield.c: Likewise. From-SVN: r273086
2019-02-05libgccjit: introduce gcc_jit_context_add_driver_optionAndrea Corallo2-1/+40
gcc/jit/ChangeLog: 2019-02-05 Andrea Corallo <andrea.corallo@arm.com> * docs/topics/compatibility.rst (LIBGCCJIT_ABI_11): New ABI tag. * docs/topics/contexts.rst (Additional driver options): New section. * jit-playback.c (invoke_driver): Add call to append_driver_options. * jit-recording.c: Within namespace gcc::jit... (recording::context::~context): Free the optnames within m_driver_options. (recording::context::add_driver_option): New method. (recording::context::append_driver_options): New method. (recording::context::dump_reproducer_to_file): Add driver options. * jit-recording.h: Within namespace gcc::jit... (recording::context::add_driver_option): New method. (recording::context::append_driver_options): New method. (recording::context::m_driver_options): New field. * libgccjit++.h (gccjit::context::add_driver_option): New method. * libgccjit.c (gcc_jit_context_add_driver_option): New API entrypoint. * libgccjit.h (gcc_jit_context_add_driver_option): New API entrypoint. (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option): New macro. * libgccjit.map (LIBGCCJIT_ABI_11): New ABI tag. gcc/testsuite/ChangeLog: 2019-02-05 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/add-driver-options-testlib.c: Add support file for test-add-driver-options.c testcase. * jit.dg/all-non-failing-tests.h: Add note about test-add-driver-options.c * jit.dg/jit.exp (jit-dg-test): Update to support add-driver-options-testlib.c compilation. * jit.dg/test-add-driver-options.c: New testcase. From-SVN: r268563
2019-01-01Update copyright years.Jakub Jelinek11-11/+11
From-SVN: r267494
2018-01-03Update copyright years.Jakub Jelinek11-11/+11
From-SVN: r256169
2017-10-04jit: implement gcc_jit_context_new_rvalue_from_vectorDavid Malcolm3-0/+35
This patch implements a new API entrypoint: /* Build a vector rvalue from an array of elements. "vec_type" should be a vector type, created using gcc_jit_type_get_vector. This API entrypoint was added in LIBGCCJIT_ABI_10; you can test for its presence using #ifdef LIBGCCJIT_HAVE_gcc_jit_context_new_rvalue_from_vector */ extern gcc_jit_rvalue * gcc_jit_context_new_rvalue_from_vector (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *vec_type, size_t num_elements, gcc_jit_rvalue **elements); gcc/jit/ChangeLog: * docs/cp/topics/expressions.rst (Vector expressions): New section. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_10): New ABI tag. * docs/topics/expressions.rst (Vector expressions): New section. * docs/topics/types.rst (gcc_jit_type_get_vector): Add link to gcc_jit_context_new_rvalue_from_vector. * jit-common.h (gcc::jit:recording::vector_type): New forward decl. * jit-playback.c (gcc::jit::playback::context::new_rvalue_from_vector): New method. * jit-playback.h (gcc::jit::playback::context::new_rvalue_from_vector): New method. * jit-recording.c: In namespace gcc::jit:: (class comma_separated_string): New class. (comma_separated_string::comma_separated_string): New ctor, adapted from recording::call::make_debug_string. (comma_separated_string::~comma_separated_string): New dtor. In namespace gcc::jit::recording:: (context::new_rvalue_from_vector): New method. (type::get_vector): Update for renaming of memento_of_get_vector. (class memento_of_get_vector): Rename to... (class vector_type): ..this. (memento_of_new_rvalue_from_vector::memento_of_new_rvalue_from_vector): New ctor. (memento_of_new_rvalue_from_vector::replay_into): New method. (memento_of_new_rvalue_from_vector::visit_children): New method. (memento_of_new_rvalue_from_vector::make_debug_string): New method. (memento_of_new_rvalue_from_vector::write_reproducer): New method. (call::make_debug_string): Split out arg-printing code into ctor for comma_separated_string. * jit-recording.h: In namespace gcc::jit::recording:: (context::new_rvalue_from_vector): New method. (type::dyn_cast_vector_type): New virtual function. (class memento_of_get_vector): Rename to... (class vector_type): ...this. (vector_type::unqualified): Remove this vfunc override in favor of... (vector_type::get_element_type): ...this new method. (vector_type::get_num_units): New method. (vector_type::dyn_cast_vector_type): New vfunc override. (class memento_of_new_rvalue_from_vector): New class. * libgccjit++.h (gccjit::context::new_rvalue): Add overload for vector of rvalue. * libgccjit.c (gcc_jit_context_new_binary_op): Strip off type qualifications when checking that both operands have same type. (gcc_jit_context_new_rvalue_from_vector): New API entrypoint. * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_context_new_rvalue_from_vector): New macro. (gcc_jit_context_new_rvalue_from_vector): New API entrypoint. * libgccjit.map (LIBGCCJIT_ABI_10): New ABI tag. gcc/testsuite/ChangeLog: * jit.dg/test-expressions.c (make_test_of_vectors): New function. (create_code): Call it. * jit.dg/test-vector-rvalues.cc: New test case. From-SVN: r253409
2017-09-28jit: document function pointersDavid Malcolm4-12/+96
gcc/jit/ChangeLog: * docs/topics/expressions.rst (Function calls): Add link to gcc_jit_context_new_function_ptr_type. (Function pointers): Convert to cross-references to function-pointers.rst, moving material there. * docs/topics/function-pointers.rst: New page. * docs/topics/index.rst: Add function-pointers.rst. * docs/topics/types.rst (Function pointer types): New section. * docs/_build/texinfo/libgccjit.texi: Regenerate. From-SVN: r253257