aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit
AgeCommit message (Collapse)AuthorFilesLines
2020-03-31libgccjit: add new version entry pointAndreaCorallo6-1/+138
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-03-23libgccjit: handle long literals in playback::context::new_string_literalAndreaCorallo3-9/+19
gcc/jit/ChangeLog 2020-03-23 Andrea Corallo <andrea.corallo@arm.com> * jit-playback.h (gcc::jit::playback::context m_recording_ctxt): Remove m_char_array_type_node field. * jit-playback.c (playback::context::context) Remove m_char_array_type_node from member initializer list. (playback::context::new_string_literal) Fix logic to handle string length > 200. gcc/testsuite/ChangeLog 2020-03-23 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/all-non-failing-tests.h: Add test-long-string-literal.c. * jit.dg/test-long-string-literal.c: New testcase.
2020-01-01Update copyright years.Jakub Jelinek65-104/+108
From-SVN: r279813
2019-11-29Remove unused decimal floating-point pointer typesJulian Brown2-3/+5
gcc/ * builtin-types.def (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR) Remove. * tree-core.h (TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE, TI_DFLOAT128_PTR_TYPE): Remove. * tree.c (build_common_type_nodes): Remove dfloat32_ptr_type_node, dfloat64_ptr_type_node and dfloat128_ptr_type_node initialisation. * tree.h (dfloat32_ptr_type_node, dfloat64_ptr_type_node, dfloat128_ptr_type_node): Remove macros. gcc/jit/ * jit-builtins.c (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR): Remove commented-out cases. Reviewed-by: Joseph Myers <joseph@codesourcery.com> From-SVN: r278826
2019-11-20jit: fix ICE with GCC_JIT_BOOL_OPTION_SELFCHECK_GC since r278084 (PR jit/92483)David Malcolm2-4/+8
Since r278084 (part of the params refactoring), most of libgccjit's test suite has been ICEing. The root cause is that jit-playback.c injects params to its fake_args here: /* Aggressively garbage-collect, to shake out bugs: */ if (get_bool_option (GCC_JIT_BOOL_OPTION_SELFCHECK_GC)) { ADD_ARG ("--param"); ADD_ARG ("ggc-min-expand=0"); ADD_ARG ("--param"); ADD_ARG ("ggc-min-heapsize=0"); } (building a vec of char * where the char * are allocated using xstrdup) and r278084 added this logic to decode_cmdline_options_to_array: 964 /* Interpret "--param" "key=name" as "--param=key=name". */ 965 const char *needle = "--param"; 966 if (i + 1 < argc && strcmp (opt, needle) == 0) 967 { 968 const char *replacement 969 = opts_concat (needle, "=", argv[i + 1], NULL); 970 argv[++i] = replacement; 971 } Note that at line 970 it manipulates the argv in-place, inserting a new option allocated with opts_concat, which uses opts_obstack (itself initialized from toplev::main). jit-playback.c cleans up its fake arguments using "free", at which point we have a free of the middle of an obstack and an ICE. This patch fixes the issue by using the new syntax for the params. Fixes all 60 FAILs in jit.sum, restoring the number of PASS results from 2033 to 10469. gcc/jit/ChangeLog: PR jit/92483 * jit-playback.c (gcc::jit::playback::context::make_fake_args): Update GCC_JIT_BOOL_OPTION_SELFCHECK_GC for new --param syntax. From-SVN: r278515
2019-08-13Use checking forms of DECL_FUNCTION_CODE (PR 91421)Richard Sandiford2-3/+7
We were shoe-horning all built-in enumerations (including frontend and target-specific ones) into a field of type built_in_function. This was accessed as either an lvalue or an rvalue using DECL_FUNCTION_CODE. The obvious danger with this (as was noted by several ??? comments) is that the ranges have nothing to do with each other, and targets can easily have more built-in functions than generic code. But my patch to make the field bigger was the straw that finally made the problem visible. This patch therefore: - replaces the field with a plain unsigned int - turns DECL_FUNCTION_CODE into an rvalue-only accessor that checks that the function really is BUILT_IN_NORMAL - adds corresponding DECL_MD_FUNCTION_CODE and DECL_FE_FUNCTION_CODE accessors for BUILT_IN_MD and BUILT_IN_FRONTEND respectively - adds DECL_UNCHECKED_FUNCTION_CODE for places that need to access the underlying field (should be low-level code only) - adds new helpers for setting the built-in class and function code - makes DECL_BUILT_IN_CLASS an rvalue-only accessor too, since all assignments should go through the new helpers 2019-08-13 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR middle-end/91421 * tree-core.h (function_decl::function_code): Change type to unsigned int. * tree.h (DECL_FUNCTION_CODE): Rename old definition to... (DECL_UNCHECKED_FUNCTION_CODE): ...this. (DECL_BUILT_IN_CLASS): Make an rvalue macro only. (DECL_FUNCTION_CODE): New function. Assert that the built-in class is BUILT_IN_NORMAL. (DECL_MD_FUNCTION_CODE, DECL_FE_FUNCTION_CODE): New functions. (set_decl_built_in_function, copy_decl_built_in_function): Likewise. (fndecl_built_in_p): Change the type of the "name" argument to unsigned int. * builtins.c (expand_builtin): Move DECL_FUNCTION_CODE use after check for DECL_BUILT_IN_CLASS. * cgraphclones.c (build_function_decl_skip_args): Use set_decl_built_in_function. * ipa-param-manipulation.c (ipa_modify_formal_parameters): Likewise. * ipa-split.c (split_function): Likewise. * langhooks.c (add_builtin_function_common): Likewise. * omp-simd-clone.c (simd_clone_create): Likewise. * tree-streamer-in.c (unpack_ts_function_decl_value_fields): Likewise. * config/darwin.c (darwin_init_cfstring_builtins): Likewise. (darwin_fold_builtin): Use DECL_MD_FUNCTION_CODE instead of DECL_FUNCTION_CODE. * fold-const.c (operand_equal_p): Compare DECL_UNCHECKED_FUNCTION_CODE instead of DECL_FUNCTION_CODE. * lto-streamer-out.c (hash_tree): Use DECL_UNCHECKED_FUNCTION_CODE instead of DECL_FUNCTION_CODE. * tree-streamer-out.c (pack_ts_function_decl_value_fields): Likewise. * print-tree.c (print_node): Use DECL_MD_FUNCTION_CODE when printing DECL_BUILT_IN_MD. Handle DECL_BUILT_IN_FRONTEND. * config/aarch64/aarch64-builtins.c (aarch64_expand_builtin) (aarch64_fold_builtin, aarch64_gimple_fold_builtin): Use DECL_MD_FUNCTION_CODE instead of DECL_FUNCTION_CODE. * config/aarch64/aarch64.c (aarch64_builtin_reciprocal): Likewise. * config/alpha/alpha.c (alpha_expand_builtin, alpha_fold_builtin): (alpha_gimple_fold_builtin): Likewise. * config/arc/arc.c (arc_expand_builtin): Likewise. * config/arm/arm-builtins.c (arm_expand_builtin): Likewise. * config/avr/avr-c.c (avr_resolve_overloaded_builtin): Likewise. * config/avr/avr.c (avr_expand_builtin, avr_fold_builtin): Likewise. * config/bfin/bfin.c (bfin_expand_builtin): Likewise. * config/c6x/c6x.c (c6x_expand_builtin): Likewise. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/gcn/gcn.c (gcn_expand_builtin_1): Likewise. (gcn_expand_builtin): Likewise. * config/i386/i386-builtins.c (ix86_builtin_reciprocal): Likewise. (fold_builtin_cpu): Likewise. * config/i386/i386-expand.c (ix86_expand_builtin): Likewise. * config/i386/i386.c (ix86_fold_builtin): Likewise. (ix86_gimple_fold_builtin): Likewise. * config/ia64/ia64.c (ia64_fold_builtin): Likewise. (ia64_expand_builtin): Likewise. * config/iq2000/iq2000.c (iq2000_expand_builtin): Likewise. * config/mips/mips.c (mips_expand_builtin): Likewise. * config/msp430/msp430.c (msp430_expand_builtin): Likewise. * config/nds32/nds32-intrinsic.c (nds32_expand_builtin_impl): Likewise. * config/nios2/nios2.c (nios2_expand_builtin): Likewise. * config/nvptx/nvptx.c (nvptx_expand_builtin): Likewise. * config/pa/pa.c (pa_expand_builtin): Likewise. * config/pru/pru.c (pru_expand_builtin): Likewise. * config/riscv/riscv-builtins.c (riscv_expand_builtin): Likewise. * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Likewise. * config/rs6000/rs6000-call.c (htm_expand_builtin): Likewise. (altivec_expand_dst_builtin, altivec_expand_builtin): Likewise. (rs6000_gimple_fold_builtin, rs6000_expand_builtin): Likewise. * config/rs6000/rs6000.c (rs6000_builtin_md_vectorized_function) (rs6000_builtin_reciprocal): Likewise. * config/rx/rx.c (rx_expand_builtin): Likewise. * config/s390/s390-c.c (s390_resolve_overloaded_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sh/sh.c (sh_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_expand_builtin): Likewise. (sparc_fold_builtin): Likewise. * config/spu/spu-c.c (spu_resolve_overloaded_builtin): Likewise. * config/spu/spu.c (spu_expand_builtin): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin): Likewise. * config/tilegx/tilegx.c (tilegx_expand_builtin): Likewise. * config/tilepro/tilepro.c (tilepro_expand_builtin): Likewise. * config/xtensa/xtensa.c (xtensa_fold_builtin): Likewise. (xtensa_expand_builtin): Likewise. gcc/ada/ PR middle-end/91421 * gcc-interface/trans.c (gigi): Call set_decl_buillt_in_function. (Call_to_gnu): Use DECL_FE_FUNCTION_CODE instead of DECL_FUNCTION_CODE. gcc/c/ PR middle-end/91421 * c-decl.c (merge_decls): Use copy_decl_built_in_function. gcc/c-family/ PR middle-end/91421 * c-common.c (resolve_overloaded_builtin): Use copy_decl_built_in_function. gcc/cp/ PR middle-end/91421 * decl.c (duplicate_decls): Use copy_decl_built_in_function. * pt.c (declare_integer_pack): Use set_decl_built_in_function. gcc/d/ PR middle-end/91421 * intrinsics.cc (maybe_set_intrinsic): Use set_decl_built_in_function. gcc/jit/ PR middle-end/91421 * jit-playback.c (new_function): Use set_decl_built_in_function. gcc/lto/ PR middle-end/91421 * lto-common.c (compare_tree_sccs_1): Use DECL_UNCHECKED_FUNCTION_CODE instead of DECL_FUNCTION_CODE. * lto-symtab.c (lto_symtab_merge_p): Likewise. From-SVN: r274404
2019-08-10Assorted ChangeLog cleanups.Jakub Jelinek1-4/+4
From-SVN: r274250
2019-07-22[jit] check result_type in gcc_jit_context_new_unary_opAndrea Corallo4-5/+26
2019-07-22 Andrea Corallo <andrea.corallo@arm.com> * jit-recording.c (unary_op_reproducer_strings): Make it extern. (binary_op_reproducer_strings): Likewise. * jit-recording.h (unary_op_reproducer_strings): Likewise. (binary_op_reproducer_strings): Likewise. * libgccjit.c (gcc_jit_context_new_unary_op): Check result_type to be a numeric type. * libgccjit.c (gcc_jit_context_new_binary_op): Improve error message. 2019-07-22 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/test-error-gcc_jit_context_new_unary_op-bad-res-type.c: New testcase. * jit.dg/test-error-gcc_jit_context_new_binary_op-bad-res-type.c: Adjust error message. From-SVN: r273700
2019-07-04jit: gcc_jit_context_new_binary_op check res typeAndrea Corallo2-0/+11
gcc/jit/ChangeLog: 2019-07-04 Andrea Corallo <andrea.corallo@arm.com> * libgccjit.c (gcc_jit_context_new_binary_op): Check result_type to be a numeric type. gcc/testsuite/ChangeLog: 2019-07-04 Andrea Corallo <andrea.corallo@arm.com> * jit.dg/test-error-gcc_jit_context_new_binary_op-bad-res-type.c: New testcase. From-SVN: r273089
2019-07-04introduce gcc_jit_context_new_bitfieldAndrea Corallo12-20/+341
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-03-21hash-table.h (hash_table): Add Lazy template parameter defaulted to false...Jakub Jelinek2-1/+6
* hash-table.h (hash_table): Add Lazy template parameter defaulted to false, if true, don't alloc_entries during construction, but defer it to the first method that needs m_entries allocated. (hash_table::hash_table, hash_table::~hash_table, hash_table::alloc_entries, hash_table::find_empty_slot_for_expand, hash_table::too_empty_p, hash_table::expand, hash_table::empty_slow, hash_table::clear_slot, hash_table::traverse_noresize, hash_table::traverse, hash_table::iterator::slide): Adjust all methods. * hash-set.h (hash_set): Add Lazy template parameter defaulted to false. (hash_set::contains): If Lazy is true, use find_slot_with_hash with NO_INSERT instead of find_with_hash. (hash_set::traverse, hash_set::iterator, hash_set::iterator::m_iter, hash_set::m_table): Add Lazy to template params of hash_table. (gt_ggc_mx, gt_pch_nx): Use false as Lazy in hash_set template param. * attribs.c (test_attribute_exclusions): Likewise. * hash-set-tests.c (test_set_of_strings): Add iterator tests for hash_set. Add tests for hash_set with Lazy = true. c-family/ * c-common.c (per_file_includes_t): Use false as Lazy in hash_set template param. jit/ * jit-recording.c (reproducer::m_set_identifiers): Use false as Lazy in hash_set template param. From-SVN: r269859
2019-02-05libgccjit: introduce gcc_jit_context_add_driver_optionAndrea Corallo10-1/+169
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 Jelinek65-104/+108
From-SVN: r267494
2018-11-15Machine-readable diagnostic output (PR other/19165)David Malcolm2-1/+7
This patch implements a -fdiagnostics-format=json option which converts the diagnostics to be output to stderr in a JSON format; see the documentation in invoke.texi. Logically-related diagnostics are nested at the JSON level, using the auto_diagnostic_group mechanism. gcc/ChangeLog: PR other/19165 * Makefile.in (OBJS): Move json.o to... (OBJS-libcommon): ...here and add diagnostic-format-json.o. * common.opt (fdiagnostics-format=): New option. (diagnostics_output_format): New enum. * diagnostic-format-json.cc: New file. * diagnostic.c (default_diagnostic_final_cb): New function, taken from start of diagnostic_finish. (diagnostic_initialize): Initialize final_cb to default_diagnostic_final_cb. (diagnostic_finish): Move "being treated as errors" messages to default_diagnostic_final_cb. Call any final_cb. (default_diagnostic_finalizer): Add diagnostic_t param. (diagnostic_report_diagnostic): Pass "orig_diag_kind" to diagnostic_finalizer callback. * diagnostic.h (enum diagnostics_output_format): New enum. (diagnostic_finalizer_fn): Reimplement, adding diagnostic_t param. (struct diagnostic_context): Add "final_cb". (default_diagnostic_finalizer): Add diagnostic_t param. (diagnostic_output_format_init): New decl. * doc/invoke.texi (-fdiagnostics-format): New option. * dwarf2out.c (gen_producer_string): Ignore OPT_fdiagnostics_format_. * gcc.c (driver_handle_option): Handle OPT_fdiagnostics_format_. * lto-wrapper.c (append_diag_options): Ignore it. * opts.c (common_handle_option): Handle it. gcc/c-family/ChangeLog: PR other/19165 * c-opts.c (c_diagnostic_finalizer): Add diagnostic_t param. gcc/fortran/ChangeLog: PR other/19165 * error.c (gfc_diagnostic_finalizer): Add diagnostic_t param. gcc/jit/ChangeLog: PR other/19165 * dummy-frontend.c (jit_begin_diagnostic): Add diagnostic_t param. gcc/testsuite/ChangeLog: PR other/19165 * c-c++-common/diagnostic-format-json-1.c: New test. * c-c++-common/diagnostic-format-json-2.c: New test. * c-c++-common/diagnostic-format-json-3.c: New test. * c-c++-common/diagnostic-format-json-4.c: New test. * c-c++-common/diagnostic-format-json-5.c: New test. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (custom_diagnostic_finalizer): Add diagnostic_t param. * gcc.dg/plugin/location_overflow_plugin.c (verify_unpacked_ranges): Likewise. (verify_no_columns): Likewise. * gfortran.dg/diagnostic-format-json-1.F90: New test. * gfortran.dg/diagnostic-format-json-2.F90: New test. * gfortran.dg/diagnostic-format-json-3.F90: New test. From-SVN: r266186
2018-11-13Eliminate source_location in favor of location_tDavid Malcolm3-3/+7
Historically GCC used location_t, while libcpp used source_location. This inconsistency has been annoying me for a while, so this patch removes source_location in favor of location_t throughout (as the latter is shorter). gcc/ChangeLog: * builtins.c: Replace "source_location" with "location_t". * diagnostic-show-locus.c: Likewise. * diagnostic.c: Likewise. * dumpfile.c: Likewise. * gcc-rich-location.h: Likewise. * genmatch.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * input.c: Likewise. * input.h: Likewise. Eliminate the typedef. * omp-expand.c: Likewise. * selftest.h: Likewise. * substring-locations.h (get_source_location_for_substring): Rename to.. (get_location_within_string): ...this. * tree-cfg.c: Replace "source_location" with "location_t". * tree-cfgcleanup.c: Likewise. * tree-diagnostic.c: Likewise. * tree-into-ssa.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa.c: Likewise. * tree-ssa.h: Likewise. * tree-vect-loop-manip.c: Likewise. gcc/c-family/ChangeLog: * c-common.c (c_get_substring_location): Update for renaming of get_source_location_for_substring to get_location_within_string. * c-lex.c: Replace "source_location" with "location_t". * c-opts.c: Likewise. * c-ppoutput.c: Likewise. gcc/c/ChangeLog: * c-decl.c: Replace "source_location" with "location_t". * c-tree.h: Likewise. * c-typeck.c: Likewise. * gimple-parser.c: Likewise. gcc/cp/ChangeLog: * call.c: Replace "source_location" with "location_t". * cp-tree.h: Likewise. * cvt.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * typeck.c: Likewise. gcc/fortran/ChangeLog: * cpp.c: Replace "source_location" with "location_t". * gfortran.h: Likewise. gcc/go/ChangeLog: * go-gcc-diagnostics.cc: Replace "source_location" with "location_t". * go-gcc.cc: Likewise. * go-linemap.cc: Likewise. * go-location.h: Likewise. * gofrontend/README: Likewise. gcc/jit/ChangeLog: * jit-playback.c: Replace "source_location" with "location_t". gcc/testsuite/ChangeLog: * g++.dg/plugin/comment_plugin.c: Replace "source_location" with "location_t". * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise. libcc1/ChangeLog: * libcc1plugin.cc: Replace "source_location" with "location_t". (plugin_context::get_source_location): Rename to... (plugin_context::get_location_t): ...this. * libcp1plugin.cc: Likewise. libcpp/ChangeLog: * charset.c: Replace "source_location" with "location_t". * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to MAX_LOCATION_T. * include/line-map.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * location-example.txt: Likewise. * macro.c: Likewise. * pch.c: Likewise. * traditional.c: Likewise. From-SVN: r266085
2018-10-17Run selftests for C++ as well as CDavid Malcolm2-0/+7
gcc/ChangeLog: * Makefile.in (SELFTEST_TARGETS): New. (selftest) Change from s-selftest-c to $(SELFTEST_TARGETS). (C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb) (selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move to c/Make-lang.in. (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++) (selftest-c++-gdb, selftest-c++-valgrind): Move to cp/Make-lang.in. * configure: Regenerate. * configure.ac (selftest_languages): New. gcc/brig/ChangeLog: * Make-lang.in (selftest-brig): New. gcc/c/ChangeLog: * Make-lang.in (selftest-c): New. (C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb) (selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move here from gcc/Makefile.in. gcc/cp/ChangeLog: * Make-lang.in (selftest-c++): New. (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++) (selftest-c++-gdb, selftest-c++-valgrind): Move here from gcc/Makefile.in. gcc/fortran/ChangeLog: * Make-lang.in (selftest-fortran): New. gcc/go/ChangeLog: * Make-lang.in (selftest-go): New. gcc/jit/ChangeLog: * Make-lang.in (selftest-jit): New. gcc/lto/ChangeLog: * Make-lang.in (selftest-lto): New. gcc/objc/ChangeLog: * Make-lang.in (selftest-objc): New. gcc/objcp/ChangeLog: * Make-lang.in (selftest-obj-c++): New. From-SVN: r265240
2018-08-27Replace 8 spaces with a tabular in ChangeLog files.Martin Liska1-1/+1
From-SVN: r263886
2018-06-28Makefile.in: Add opt-suggestions.o.Martin Liska2-0/+5
. 2018-06-28 Martin Liska <mliska@suse.cz> * Makefile.in: Add opt-suggestions.o. * gcc-main.c: Include opt-suggestions.h. * gcc.c (driver::driver): Likewise. (driver::~driver): Remove m_option_suggestions. (driver::build_option_suggestions): Moved to option_proposer. (driver::suggest_option): Likewise. (driver::handle_unrecognized_options): Use option_proposer. * gcc.h (class driver): Add new memver m_option_proposer. * opt-suggestions.c: New file. * opt-suggestions.h: New file. 2018-06-28 Martin Liska <mliska@suse.cz> * cppspec.c: Include opt-suggestions.h. 2018-06-28 Martin Liska <mliska@suse.cz> * gfortranspec.c: Include opt-suggestions.h. 2018-06-28 Martin Liska <mliska@suse.cz> * jit-playback.c: Include opt-suggestions.h. From-SVN: r262209
2018-06-28Introduce auto_string_vec class.Martin Liska2-22/+9
2018-06-28 Martin Liska <mliska@suse.cz> * vec.h (class auto_string_vec): New (moved from auto_argvec). (auto_string_vec::~auto_string_vec): Likewise. 2018-06-28 Martin Liska <mliska@suse.cz> * jit-playback.c (class auto_argvec): Moved to vec.h. (auto_argvec::~auto_argvec): Likewise. (compile): Use the renamed name. (invoke_driver): Likewise. From-SVN: r262208
2018-03-21Enable jit on Solaris: soname option and EXTRA_GCC_LIBS (PR jit/84288)Rainer Orth2-1/+6
gcc/jit: PR jit/84288 * Make-lang.in ($(LIBGCCJIT_FILENAME)): Add $(EXTRA_GCC_LIBS). gcc: PR jit/84288 * configure.ac (gcc_cv_ld_soname) <*-*-solaris2*>: Set. * configure: Regenerate. From-SVN: r258727
2018-03-09jit: use 'configure' to replace hard-coded linker options (PR jit/64089 and ↵David Malcolm2-2/+26
PR jit/84288) gcc/ChangeLog: PR jit/64089 PR jit/84288 * Makefile.in (LD_VERSION_SCRIPT_OPTION, LD_SONAME_OPTION): New. * configure: Regenerate. * configure.ac ("linker --version-script option"): New. ("linker soname option"): New. gcc/jit/ChangeLog: PR jit/64089 PR jit/84288 * Make-lang.in (COMMA): New. (LIBGCCJIT_VERSION_SCRIPT_OPTION): New. (LIBGCCJIT_SONAME_OPTION): New. (jit): Move --version-script and -soname linker options to the above. Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> From-SVN: r258388
2018-01-25jit: remove some unused fields from recording::union_ (PR jit/81672)David Malcolm2-4/+6
gcc::jit::recording::union_ has some stray fields, which are duplicates of those in the compound_type base class. It looks like these have been present since the initial merger of the jit branch to trunk (r217374), where it had three duplicate fields: location *m_loc; string *m_name; fields *m_fields; I removed the duplicate field "m_fields" in r219564 but missed the other two. This patch removes them. gcc/jit/ChangeLog: PR jit/81672 * jit-recording.h (gcc::jit::recording::union_): Remove fields "m_loc" and "m_name". From-SVN: r257066
2018-01-03Update copyright years.Jakub Jelinek65-104/+108
From-SVN: r256169
2017-12-19read-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order ↵Jakub Jelinek6-27/+36
conditions. * read-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order conditions. * sel-sched.c (extract_new_fences_from): Likewise. * config/visium/constraints.md (J, K, L): Likewise. * config/visium/predicates.md (const_shift_operand): Likewise. * config/visium/visium.c (visium_legitimize_address, visium_legitimize_reload_address): Likewise. * config/m68k/m68k.c (output_reg_adjust, emit_reg_adjust): Likewise. * config/arm/arm.c (arm_block_move_unaligned_straight): Likewise. * config/avr/constraints.md (Y01, Ym1, Y02, Ym2): Likewise. * config/avr/avr-log.c (avr_vdump, avr_log_set_avr_log, SET_DUMP_DETAIL): Likewise. * config/avr/predicates.md (const_8_16_24_operand): Likewise. * config/avr/avr.c (STR_PREFIX_P, avr_popcount_each_byte, avr_is_casesi_sequence, avr_casei_sequence_check_operands, avr_set_core_architecture, avr_set_current_function, avr_legitimize_reload_address, avr_asm_len, avr_print_operand, output_movqi, output_movsisf, avr_out_plus, avr_out_bitop, avr_out_fract, avr_adjust_insn_length, avr_encode_section_info, avr_2word_insn_p, output_reload_in_const, avr_has_nibble_0xf, avr_map_decompose, avr_fold_builtin): Likewise. * config/avr/driver-avr.c (avr_devicespecs_file): Likewise. * config/avr/gen-avr-mmcu-specs.c (str_prefix_p, print_mcu): Likewise. * config/i386/i386.c (ix86_parse_stringop_strategy_string): Likewise. * config/m32c/m32c-pragma.c (m32c_pragma_memregs): Likewise. * config/m32c/m32c.c (m32c_conditional_register_usage, m32c_address_cost): Likewise. * config/m32c/predicates.md (shiftcount_operand, longshiftcount_operand): Likewise. * config/iq2000/iq2000.c (iq2000_expand_prologue): Likewise. * config/nios2/nios2.c (nios2_handle_custom_fpu_insn_option, can_use_cdx_ldstw): Likewise. * config/nios2/nios2.h (CDX_REG_P): Likewise. * config/cr16/cr16.h (RETURN_ADDR_RTX, REGNO_MODE_OK_FOR_BASE_P): Likewise. * config/cr16/cr16.md (*mov<mode>_double): Likewise. * config/cr16/cr16.c (cr16_create_dwarf_for_multi_push): Likewise. * config/h8300/h8300.c (h8300_rtx_costs, get_shift_alg): Likewise. * config/vax/constraints.md (U06, U08, U16, CN6, S08, S16): Likewise. * config/vax/vax.c (adjacent_operands_p): Likewise. * config/ft32/constraints.md (L, b, KA): Likewise. * config/ft32/ft32.c (ft32_load_immediate, ft32_expand_prologue): Likewise. * cfgexpand.c (expand_stack_alignment): Likewise. * gcse.c (insert_expr_in_table): Likewise. * print-rtl.c (rtx_writer::print_rtx_operand_codes_E_and_V): Likewise. * cgraphunit.c (cgraph_node::expand): Likewise. * ira-build.c (setup_min_max_allocno_live_range_point): Likewise. * emit-rtl.c (add_insn): Likewise. * input.c (dump_location_info): Likewise. * passes.c (NEXT_PASS): Likewise. * read-rtl-function.c (parse_note_insn_name, function_reader::read_rtx_operand_r, function_reader::parse_mem_expr): Likewise. * sched-rgn.c (sched_rgn_init): Likewise. * diagnostic-show-locus.c (layout::show_ruler): Likewise. * combine.c (find_split_point, simplify_if_then_else, force_to_mode, if_then_else_cond, simplify_shift_const_1, simplify_comparison): Likewise. * explow.c (eliminate_constant_term): Likewise. * final.c (leaf_renumber_regs_insn): Likewise. * cfgrtl.c (print_rtl_with_bb): Likewise. * genhooks.c (emit_init_macros): Likewise. * poly-int.h (maybe_ne, maybe_le, maybe_lt): Likewise. * tree-data-ref.c (conflict_fn): Likewise. * selftest.c (assert_streq): Likewise. * expr.c (store_constructor_field, expand_expr_real_1): Likewise. * fold-const.c (fold_range_test, extract_muldiv_1, fold_truth_andor, fold_binary_loc, multiple_of_p): Likewise. * reload.c (push_reload, find_equiv_reg): Likewise. * et-forest.c (et_nca, et_below): Likewise. * dbxout.c (dbxout_symbol_location): Likewise. * reorg.c (relax_delay_slots): Likewise. * dojump.c (do_compare_rtx_and_jump): Likewise. * gengtype-parse.c (type): Likewise. * simplify-rtx.c (simplify_gen_ternary, simplify_gen_relational, simplify_const_relational_operation): Likewise. * reload1.c (do_output_reload): Likewise. * dumpfile.c (get_dump_file_info_by_switch): Likewise. * gengtype.c (type_for_name): Likewise. * gimple-ssa-sprintf.c (format_directive): Likewise. ada/ * gcc-interface/trans.c (Loop_Statement_to_gnu): Replace Yoda conditions with typical order conditions. * gcc-interface/misc.c (gnat_get_array_descr_info, default_pass_by_ref): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. * adaint.c (__gnat_tmp_name): Likewise. c-family/ * known-headers.cc (get_stdlib_header_for_name): Replace Yoda conditions with typical order conditions. c/ * c-typeck.c (comptypes_internal, function_types_compatible_p, perform_integral_promotions, digest_init): Replace Yoda conditions with typical order conditions. * c-decl.c (check_bitfield_type_and_width): Likewise. cp/ * name-lookup.c (get_std_name_hint): Replace Yoda conditions with typical order conditions. * class.c (check_bitfield_decl): Likewise. * pt.c (convert_template_argument): Likewise. * decl.c (duplicate_decls): Likewise. * typeck.c (commonparms): Likewise. fortran/ * scanner.c (preprocessor_line): Replace Yoda conditions with typical order conditions. * dependency.c (check_section_vs_section): Likewise. * trans-array.c (gfc_conv_expr_descriptor): Likewise. jit/ * jit-playback.c (get_type, playback::compile_to_file::copy_file, playback::context::acquire_mutex): Replace Yoda conditions with typical order conditions. * libgccjit.c (gcc_jit_context_new_struct_type, gcc_jit_struct_set_fields, gcc_jit_context_new_union_type, gcc_jit_context_new_function, gcc_jit_timer_pop): Likewise. * jit-builtins.c (matches_builtin): Likewise. * jit-recording.c (recording::compound_type::set_fields, recording::fields::write_reproducer, recording::rvalue::set_scope, recording::function::validate): Likewise. * jit-logging.c (logger::decref): Likewise. From-SVN: r255831
2017-11-30spellcheck-tree.c (test_find_closest_identifier): Use ; instead of ;;.Jakub Jelinek2-1/+7
* spellcheck-tree.c (test_find_closest_identifier): Use ; instead of ;;. * gengtype-state.c (read_state_pair): Likewise. * gimple-fold.c (gimple_fold_builtin_string_compare): Likewise. * sel-sched-dump.c (dump_insn_rtx_1): Likewise. * ipa-cp.c (intersect_aggregates_with_edge): Likewise. * ifcvt.c (noce_try_store_flag_constants): Likewise. * tree-ssa-ccp.c (ccp_finalize): Likewise. * omp-grid.c (grid_process_kernel_body_copy): Likewise. * builtins.c (fold_builtin_3): Likewise. * graphite-scop-detection.c (scop_detection::stmt_has_simple_data_refs_p): Likewise. * hsa-gen.c (hsa_function_representation::hsa_function_representation): Likewise. c/ * c-parser.c (c_parser_postfix_expression): Use ; instead of ;;. jit/ * jit-recording.c (recording::memento_of_new_rvalue_from_const <long>::write_reproducer): Use ; instead of ;;. lto/ * lto.c (create_subid_section_table): Use ; instead of ;;. objc/ * objc-next-runtime-abi-01.c (generate_dispatch_table): Use ; instead of ;;. From-SVN: r255284
2017-11-28tree.def (SWITCH_EXPR): Change from 3 operand to 2 operand tree.Jakub Jelinek2-15/+9
* tree.def (SWITCH_EXPR): Change from 3 operand to 2 operand tree. Adjust comment. * tree.h (SWITCH_LABELS): Remove. * gimplify.c (gimplify_switch_expr): Don't test SWITCH_LABELS, assert SWITCH_BODY is non-NULL. * tree-pretty-print.c (dump_generic_node): Remove SWITCH_LABELS handling. * tree.c (block_may_fallthru): Always return true; for SWITCH_EXPR. c/ * c-typeck.c (c_start_case): Build SWITCH_EXPR using build2 instead of build3. cp/ * cp-gimplify.c (genericize_switch_stmt): Build SWITCH_EXPR using build2_loc instead of build3_loc. ada/ * gcc-interface/trans.c (Case_Statement_to_gnu): Build SWITCH_EXPR using build2 instead of build3. jit/ * jit-playback.c (add_switch): Build SWITCH_EXPR using build2 instead of build3. Formatting fixes. Adjust funciton comment. fortran/ * trans-decl.c (gfc_trans_entry_master_switch): Build SWITCH_EXPR using fold_build2_loc instead of fold_build3_loc. * trans-io.c (io_result): Likewise. * trans-stmt.c (gfc_trans_integer_select, gfc_trans_character_select): Likewise. go/ * go-gcc.cc (Gcc_backend::switch_statement): Build SWITCH_EXPR using build2_loc instead of build3_loc. brig/ * brigfrontend/brig-branch-inst-handler.cc (brig_branch_inst_handler::operator): Build SWITCH_EXPR using build2 instead of build3. From-SVN: r255192
2017-11-23[libgccjit] Wrap RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE in ↵Tom de Vries2-1/+8
JIT_{BEGIN,END}_STMT. 2017-11-23 Tom de Vries <tom@codesourcery.com> * libgccjit.c (RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE): Wrap in JIT_{BEGIN,END}_STMT. From-SVN: r255101
2017-10-31jit: add a way to preserve testsuite executablesDavid Malcolm3-7/+28
gcc/jit/ChangeLog: * docs/internals/index.rst (Running the test suite): Document PRESERVE_EXECUTABLES. (Running under valgrind): Add markup to RUN_UNDER_VALGRIND. * docs/_build/texinfo/libgccjit.texi: Regenerate. gcc/testsuite/ChangeLog: * jit.dg/jit.exp (jit-dg-test): If PRESERVE_EXECUTABLES is set in the environment, don't delete the generated executable. From-SVN: r254282
2017-10-04jit: implement gcc_jit_context_new_rvalue_from_vectorDavid Malcolm15-521/+984
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 Malcolm6-483/+677
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
2017-09-28jit: handle equality of function pointer typesDavid Malcolm3-1/+65
gcc/jit/ChangeLog: * jit-recording.c (gcc::jit::recording::function_type::is_same_type_as): New function. * jit-recording.h: In namespace gcc::jit::recording:: (type::accepts_writes_from): Use is_same_type_as rather than pointer equality. (type::is_same_type_as): New virtual function. (function_type::is_same_type_as): New override. gcc/testsuite/ChangeLog: * jit.dg/test-error-mismatching-types-in-assignment-fn-ptr.c: New test case. * jit.dg/test-returning-function-ptr.c (create_code): Update to create a function pointer type independently of the call to gcc_jit_function_get_address, and assign the pointer to a local before returning it, to exercise the function pointer type comparison code. From-SVN: r253255
2017-09-27jit: implement gcc_jit_function_get_addressDavid Malcolm14-386/+677
gcc/jit/ChangeLog: * docs/cp/topics/expressions.rst (Function pointers): New section. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_9): New tag. * docs/topics/expressions.rst (Function pointers): New section. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (class gcc::jit::recording::function_pointer): New forward decl. * jit-playback.c (gcc::jit::playback::function::get_address): New method. * jit-playback.h (gcc::jit::playback::function::get_address): New method decl. * jit-recording.c: Within namespace gcc::jit::recording... (function::function): Initialize new field "m_fn_ptr_type". (function::get_address): New method. (function_pointer::replay_into): New method. (function_pointer::visit_children): New method. (function_pointer::make_debug_string): New method. (function_pointer::write_reproducer): New method. * jit-recording.h: Within namespace gcc::jit::recording... (function::get_address): New method. (function): Add field "m_fn_ptr_type". (class function_pointer): New subclass of rvalue. * libgccjit++.h (gccjit::function::get_address): New method. * libgccjit.c (gcc_jit_function_get_address): New function. * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_function_get_address): New macro. (gcc_jit_function_get_address): New API entrypoint. * libgccjit.map (LIBGCCJIT_ABI_9): New tag. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Add test-returning-function-ptr.c. * jit.dg/test-returning-function-ptr.c: New test case. From-SVN: r253244
2017-09-14Fix crash accessing builtins in sanitizer.def and after (PR jit/82174)David Malcolm2-1/+10
Calls to gcc_jit_context_get_builtin_function that accessed builtins in sanitizer.def and after (or failed to match any builtin) led to a crash accessing a NULL builtin name. The entries with the NULL name came from these lines in sanitizer.def: /* This has to come before all the sanitizer builtins. */ DEF_BUILTIN_STUB(BEGIN_SANITIZER_BUILTINS, (const char *)0) [...snip...] /* This has to come after all the sanitizer builtins. */ DEF_BUILTIN_STUB(END_SANITIZER_BUILTINS, (const char *)0) This patch updates jit-builtins.c to cope with such entries, fixing the crash. gcc/jit/ChangeLog: PR jit/82174 * jit-builtins.c (matches_builtin): Ignore entries with a NULL name. gcc/testsuite/ChangeLog: PR jit/82174 * jit.dg/test-error-gcc_jit_context_get_builtin_function-unknown-builtin.c: New test case. From-SVN: r252769
2017-08-18jit: fix segfault with autovectorization (PR tree-optimization/46805)David Malcolm2-0/+16
libgccjit ran into its own version of PR tree-optimization/46805 (seen with the Go frontend); this patch fixes it in the same way. gcc/jit/ChangeLog: PR tree-optimization/46805 * dummy-frontend.c (jit_langhook_parse_file): Handle vector types. gcc/testsuite/ChangeLog: PR tree-optimization/46805 * jit.dg/all-non-failing-tests.h: Add test-autovectorize.c. * jit.dg/test-autovectorize.c: New test case. From-SVN: r251192
2017-08-18jit: make simpler reproducersDavid Malcolm2-12/+62
The C reproducers generated by gcc_jit_context_dump_reproducer_to_file contain numerous pointer values (from %p) to ensure uniqueness of the identifiers, but this makes them less readable than they could be. This patch updates reproducer::make_identifier so that the pointer is only added if it's necessary for uniqueness. gcc/jit/ChangeLog: * jit-recording.c (class gcc::jit::reproducer): Rename field "m_identifiers" to "m_map_memento_to_identifier". Add field "m_set_identifiers" and struct hash_traits for it. (gcc::jit::reproducer::reproducer): Update for above. (convert_to_identifier): New function. (gcc::jit::reproducer::ensure_identifier_is_unique): New method. (gcc::jit::reproducer::make_identifier): Avoid appending the %p unless necessary for uniqueness. Update for field renaming. (gcc::jit::reproducer::get_identifier): Update for field renaming. From-SVN: r251191
2017-08-10jit: add gcc_jit_type_get_vectorDavid Malcolm13-464/+791
gcc/jit/ChangeLog: * docs/cp/topics/types.rst (Vector types): New section. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_8): New tag. * docs/topics/types.rst (gcc_jit_context_get_type): Fix typo in example. (Vector types): New section. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c (gcc::jit::playback::type::get_vector): New method. * jit-playback.h (gcc::jit::playback::type::get_vector): New method. * jit-recording.c: In namespace gcc::jit::recording:: (type::get_vector): New method. (memento_of_get_aligned::write_reproducer): Fix typo in leading comment. (memento_of_get_vector::replay_into): New method. (memento_of_get_vector::make_debug_string): New method. (memento_of_get_vector::write_reproducer): New method. * jit-recording.h: In namespace gcc::jit::recording:: (type::get_vector): New method. (class memento_of_get_vector): New class. * libgccjit++.h (gccjit::type::get_vector): New method. * libgccjit.c (gcc_jit_type_get_vector): New public entrypoint. * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_type_get_vector): New define. (gcc_jit_type_get_vector): New decl. * libgccjit.map (LIBGCCJIT_ABI_8): New ABI tag. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Add note about test-vector-types.cc. * jit.dg/test-error-gcc_jit_type_get_vector-bad-type.c: New test case. * jit.dg/test-error-gcc_jit_type_get_vector-non-power-of-two.c: New test case. * jit.dg/test-vector-types.cc: New test case. From-SVN: r251018
2017-07-05Remove enum before machine_modeRichard Sandiford2-1/+8
r216834 did a mass removal of "enum" before "machine_mode". This patch removes some new uses that have been added since then. 2017-07-05 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * combine.c (simplify_if_then_else): Remove "enum" before "machine_mode". * compare-elim.c (can_eliminate_compare): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_simd_builtin_std_type): Likewise. (aarch64_lookup_simd_builtin_type): Likewise. (aarch64_simd_builtin_type): Likewise. (aarch64_init_simd_builtin_types): Likewise. (aarch64_simd_expand_args): Likewise. * config/aarch64/aarch64-protos.h (aarch64_simd_attr_length_rglist): Likewise. (aarch64_reverse_mask): Likewise. (aarch64_simd_emit_reg_reg_move): Likewise. (aarch64_gen_adjusted_ldpstp): Likewise. (aarch64_ccmp_mode_to_code): Likewise. (aarch64_operands_ok_for_ldpstp): Likewise. (aarch64_operands_adjust_ok_for_ldpstp): Likewise. * config/aarch64/aarch64.c (aarch64_ira_change_pseudo_allocno_class): Likewise. (aarch64_min_divisions_for_recip_mul): Likewise. (aarch64_reassociation_width): Likewise. (aarch64_get_condition_code_1): Likewise. (aarch64_simd_emit_reg_reg_move): Likewise. (aarch64_simd_attr_length_rglist): Likewise. (aarch64_reverse_mask): Likewise. (aarch64_operands_ok_for_ldpstp): Likewise. (aarch64_operands_adjust_ok_for_ldpstp): Likewise. (aarch64_gen_adjusted_ldpstp): Likewise. * config/aarch64/cortex-a57-fma-steering.c (fma_node::rename): Likewise. * config/arc/arc.c (legitimate_offset_address_p): Likewise. * config/arm/arm-builtins.c (arm_simd_builtin_std_type): Likewise. (arm_lookup_simd_builtin_type): Likewise. (arm_simd_builtin_type): Likewise. (arm_init_simd_builtin_types): Likewise. (arm_expand_builtin_args): Likewise. * config/arm/arm-protos.h (arm_expand_builtin): Likewise. * config/ft32/ft32.c (ft32_libcall_value): Likewise. (ft32_setup_incoming_varargs): Likewise. (ft32_function_arg): Likewise. (ft32_function_arg_advance): Likewise. (ft32_pass_by_reference): Likewise. (ft32_arg_partial_bytes): Likewise. (ft32_valid_pointer_mode): Likewise. (ft32_addr_space_pointer_mode): Likewise. (ft32_addr_space_legitimate_address_p): Likewise. * config/i386/i386-protos.h (ix86_operands_ok_for_move_multiple): Likewise. * config/i386/i386.c (ix86_setup_incoming_vararg_bounds): Likewise. (ix86_emit_outlined_ms2sysv_restore): Likewise. (iamcu_alignment): Likewise. (canonicalize_vector_int_perm): Likewise. (ix86_noce_conversion_profitable_p): Likewise. (ix86_mpx_bound_mode): Likewise. (ix86_operands_ok_for_move_multiple): Likewise. * config/microblaze/microblaze-protos.h (microblaze_expand_conditional_branch_reg): Likewise. * config/microblaze/microblaze.c (microblaze_expand_conditional_branch_reg): Likewise. * config/powerpcspe/powerpcspe.c (rs6000_init_hard_regno_mode_ok): Likewise. (rs6000_reassociation_width): Likewise. (rs6000_invalid_binary_op): Likewise. (fusion_p9_p): Likewise. (emit_fusion_p9_load): Likewise. (emit_fusion_p9_store): Likewise. * config/riscv/riscv-protos.h (riscv_regno_mode_ok_for_base_p): Likewise. (riscv_hard_regno_mode_ok_p): Likewise. (riscv_address_insns): Likewise. (riscv_split_symbol): Likewise. (riscv_legitimize_move): Likewise. (riscv_function_value): Likewise. (riscv_hard_regno_nregs): Likewise. (riscv_expand_builtin): Likewise. * config/riscv/riscv.c (riscv_build_integer_1): Likewise. (riscv_build_integer): Likewise. (riscv_split_integer): Likewise. (riscv_legitimate_constant_p): Likewise. (riscv_cannot_force_const_mem): Likewise. (riscv_regno_mode_ok_for_base_p): Likewise. (riscv_valid_base_register_p): Likewise. (riscv_valid_offset_p): Likewise. (riscv_valid_lo_sum_p): Likewise. (riscv_classify_address): Likewise. (riscv_legitimate_address_p): Likewise. (riscv_address_insns): Likewise. (riscv_load_store_insns): Likewise. (riscv_force_binary): Likewise. (riscv_split_symbol): Likewise. (riscv_force_address): Likewise. (riscv_legitimize_address): Likewise. (riscv_move_integer): Likewise. (riscv_legitimize_const_move): Likewise. (riscv_legitimize_move): Likewise. (riscv_address_cost): Likewise. (riscv_subword): Likewise. (riscv_output_move): Likewise. (riscv_canonicalize_int_order_test): Likewise. (riscv_emit_int_order_test): Likewise. (riscv_function_arg_boundary): Likewise. (riscv_pass_mode_in_fpr_p): Likewise. (riscv_pass_fpr_single): Likewise. (riscv_pass_fpr_pair): Likewise. (riscv_get_arg_info): Likewise. (riscv_function_arg): Likewise. (riscv_function_arg_advance): Likewise. (riscv_arg_partial_bytes): Likewise. (riscv_function_value): Likewise. (riscv_pass_by_reference): Likewise. (riscv_setup_incoming_varargs): Likewise. (riscv_print_operand): Likewise. (riscv_elf_select_rtx_section): Likewise. (riscv_save_restore_reg): Likewise. (riscv_for_each_saved_reg): Likewise. (riscv_register_move_cost): Likewise. (riscv_hard_regno_mode_ok_p): Likewise. (riscv_hard_regno_nregs): Likewise. (riscv_class_max_nregs): Likewise. (riscv_memory_move_cost): Likewise. * config/rl78/rl78-protos.h (rl78_split_movsi): Likewise. * config/rl78/rl78.c (rl78_split_movsi): Likewise. (rl78_addr_space_address_mode): Likewise. * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Likewise. * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Likewise. (rs6000_reassociation_width): Likewise. (rs6000_invalid_binary_op): Likewise. (fusion_p9_p): Likewise. (emit_fusion_p9_load): Likewise. (emit_fusion_p9_store): Likewise. * config/visium/visium-protos.h (prepare_move_operands): Likewise. (ok_for_simple_move_operands): Likewise. (ok_for_simple_move_strict_operands): Likewise. (ok_for_simple_arith_logic_operands): Likewise. (visium_legitimize_reload_address): Likewise. (visium_select_cc_mode): Likewise. (output_cbranch): Likewise. (visium_split_double_move): Likewise. (visium_expand_copysign): Likewise. (visium_expand_int_cstore): Likewise. (visium_expand_fp_cstore): Likewise. * config/visium/visium.c (visium_pass_by_reference): Likewise. (visium_function_arg): Likewise. (visium_function_arg_advance): Likewise. (visium_libcall_value): Likewise. (visium_setup_incoming_varargs): Likewise. (visium_legitimate_constant_p): Likewise. (visium_legitimate_address_p): Likewise. (visium_legitimize_address): Likewise. (visium_secondary_reload): Likewise. (visium_register_move_cost): Likewise. (visium_memory_move_cost): Likewise. (prepare_move_operands): Likewise. (ok_for_simple_move_operands): Likewise. (ok_for_simple_move_strict_operands): Likewise. (ok_for_simple_arith_logic_operands): Likewise. (visium_function_value_1): Likewise. (rtx_ok_for_offset_p): Likewise. (visium_legitimize_reload_address): Likewise. (visium_split_double_move): Likewise. (visium_expand_copysign): Likewise. (visium_expand_int_cstore): Likewise. (visium_expand_fp_cstore): Likewise. (visium_split_cstore): Likewise. (visium_select_cc_mode): Likewise. (visium_split_cbranch): Likewise. (output_cbranch): Likewise. (visium_print_operand_address): Likewise. * expmed.c (flip_storage_order): Likewise. * expmed.h (emit_cstore): Likewise. (flip_storage_order): Likewise. * genrecog.c (validate_pattern): Likewise. * hsa-gen.c (gen_hsa_addr): Likewise. * internal-fn.c (expand_arith_overflow): Likewise. * ira-color.c (allocno_copy_cost_saving): Likewise. * lra-assigns.c (find_hard_regno_for_1): Likewise. * lra-constraints.c (prohibited_class_reg_set_mode_p): Likewise. (process_invariant_for_inheritance): Likewise. * lra-eliminations.c (move_plus_up): Likewise. * omp-low.c (lower_oacc_reductions): Likewise. * simplify-rtx.c (simplify_subreg): Likewise. * target.def (TARGET_SETUP_INCOMING_VARARG_BOUNDS): Likewise. (TARGET_CHKP_BOUND_MODE): Likewise.. * targhooks.c (default_chkp_bound_mode): Likewise. (default_setup_incoming_vararg_bounds): Likewise. * targhooks.h (default_chkp_bound_mode): Likewise. (default_setup_incoming_vararg_bounds): Likewise. * tree-ssa-math-opts.c (divmod_candidate_p): Likewise. * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Likewise. (have_whole_vector_shift): Likewise. * tree-vect-stmts.c (vectorizable_load): Likewise. * doc/tm.texi: Regenerate. gcc/brig/ * brig-c.h (brig_type_for_mode): Remove "enum" before "machine_mode". * brig-lang.c (brig_langhook_type_for_mode): Likewise. gcc/jit/ * dummy-frontend.c (jit_langhook_type_for_mode): Remove "enum" before "machine_mode". Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r250003
2017-04-24types.rst (gccjit::type::get_const): Remove comment.David Malcolm13-475/+784
gcc_jit_type_get_aligned gcc/jit/ChangeLog: * docs/cp/topics/types.rst (gccjit::type::get_const): Remove comment. (gccjit::type::get_aligned): Add. * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_7. * docs/topics/types.rst: Add gcc_jit_type_get_aligned. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-playback.c (gcc::jit::playback::type::get_aligned): New method. * jit-playback.h (gcc::jit::playback::type::get_aligned): New method. * jit-recording.c: Within namespace gcc::jit::recording... (type::get_aligned): New method. (memento_of_get_aligned::replay_into): New method. (memento_of_get_aligned::make_debug_string): New method. (memento_of_get_aligned::write_reproducer): New method. * jit-recording.h: Within namespace gcc::jit::recording... (type::get_aligned): New method. (type::accepts_writes_from): Strip off qualifications from this when comparing pointer equality. (decorated_type): New subclass of type, subsuming the commonality between memento_of_get_const and memento_of_get_volatile. (memento_of_get_const): Make a subclass of decorated_type, rather than type. (memento_of_get_volatile): Likewise. (memento_of_get_aligned): Likewise. * libgccjit++.h: Within namespace gccjit... (type::get_const): New method. (type::get_aligned): New method. * libgccjit.c (gcc_jit_type_get_aligned): New function. * libgccjit.h (gcc_jit_type_get_aligned): New decl. * libgccjit.map (LIBGCCJIT_ABI_7): New (gcc_jit_type_get_aligned): Add. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Add test-alignment.c. * jit.dg/test-alignment.c: New test case. * jit.dg/test-alignment.cc: New test case. * jit.dg/test-error-gcc_jit_type_get_aligned-non-power-of-two.c: New test case. From-SVN: r247111
2017-01-19Make LTO's implementation of LANG_HOOKS_TYPE_FOR_SIZE the defaultDavid Malcolm2-52/+5
gcc/jit/ChangeLog: * dummy-frontend.c (jit_langhook_type_for_size): Delete. (LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine. gcc/ChangeLog: * langhooks-def.h (lhd_type_for_size): New decl. (LANG_HOOKS_TYPE_FOR_SIZE): Define as lhd_type_for_size. * langhooks.c (lhd_type_for_size): New function, taken from lto_type_for_size. gcc/lto/ChangeLog: * lto-lang.c (builtin_type_for_size): Convert call to lto_type_for_size to one through the langhook. (lto_type_for_size): Move to langhooks.c and rename to lhd_type_for_size. (LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine. From-SVN: r244646
2017-01-18Implement LANG_HOOKS_TYPE_FOR_SIZE for jitDavid Malcolm2-4/+50
gcc/jit/ChangeLog: * dummy-frontend.c (jit_langhook_type_for_size): Implement, using lto's lto_type_for_size. From-SVN: r244600
2017-01-01Update copyright years.Jakub Jelinek64-102/+106
From-SVN: r243994
2016-05-20jit: implement gcc_jit_rvalue_set_bool_require_tail_callDavid Malcolm11-38/+214
This implements the libgccjit support for must-tail-call via a new: gcc_jit_rvalue_set_bool_require_tail_call API entrypoint. (I didn't implement a wrapper for this within the C++ bindings) gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_6. * docs/topics/expressions.rst (Function calls): Add documentation of gcc_jit_rvalue_set_bool_require_tail_call. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::recording::base_call): Add forward decl. * jit-playback.c: Within namespace gcc::jit::playback... (context::build_call) Add "require_tail_call" param and use it to set CALL_EXPR_MUST_TAIL_CALL. (context::new_call): Add "require_tail_call" param. (context::new_call_through_ptr): Likewise. * jit-playback.h: Within namespace gcc::jit::playback... (context::new_call: Add "require_tail_call" param. (context::new_call_through_ptr): Likewise. (context::build_call): Likewise. * jit-recording.c: Within namespace gcc::jit::recording... (base_call::base_call): New constructor. (base_call::write_reproducer_tail_call): New method. (call::call): Update for inheritance from base_call. (call::replay_into): Provide m_require_tail_call to call to new_call. (call::write_reproducer): Call write_reproducer_tail_call. (call_through_ptr::call_through_ptr): Update for inheritance from base_call. (call_through_ptr::replay_into): Provide m_require_tail_call to call to new_call_through_ptr. (recording::call_through_ptr::write_reproducer): Call write_reproducer_tail_call. * jit-recording.h: Within namespace gcc::jit::recording... (rvalue::dyn_cast_base_call): New virtual function. (class base_call): New subclass of class rvalue. (class call): Inherit from base_call rather than directly from rvalue, moving get_precedence and m_args to base_call. (class call_through_ptr): Likewise. * libgccjit.c (gcc_jit_rvalue_set_bool_require_tail_call): New function. * libgccjit.h (LIBGCCJIT_HAVE_gcc_jit_rvalue_set_bool_require_tail_call): New macro. (gcc_jit_rvalue_set_bool_require_tail_call): New function. * libgccjit.map (LIBGCCJIT_ABI_6): New. (gcc_jit_rvalue_set_bool_require_tail_call): Add. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Add test-factorial-must-tail-call.c. * jit.dg/test-error-impossible-must-tail-call.c: New test case. * jit.dg/test-factorial-must-tail-call.c: New test case. From-SVN: r236531
2016-05-17jit: gcc diagnostics are jit errorsDavid Malcolm4-0/+92
libgccjit performs numerous checks at the API boundary, but if these succeed, it ignores errors and other diagnostics emitted within the core of gcc, and treats the compile of a gcc_jit_context as having succeeded. This patch ensures that if any diagnostics are emitted, they are visible from the libgccjit API, and that the the context is flagged as having failed. For now any kind of diagnostic is treated as a jit error, so warnings and notes also count as errors. gcc/jit/ChangeLog: * dummy-frontend.c: Include diagnostic.h. (jit_begin_diagnostic): New function. (jit_end_diagnostic): New function. (jit_langhook_init): Register jit_begin_diagnostic and jit_end_diagnostic with the global_dc. * jit-playback.c: Include diagnostic.h. (gcc::jit::playback::context::add_diagnostic): New method. * jit-playback.h (struct diagnostic_context): Add forward declaration. (gcc::jit::playback::context::add_diagnostic): New method. gcc/testsuite/ChangeLog: * jit.dg/test-error-array-bounds.c: New test case. From-SVN: r236342
2016-05-17jit: document gcc_jit_context_new_call_through_ptrDavid Malcolm3-374/+411
gcc/jit/ChangeLog: * docs/topics/expressions.rst (Function calls): Document gcc_jit_context_new_call_through_ptr. * docs/_build/texinfo/libgccjit.texi: Regenerate. From-SVN: r236341
2016-05-13jit: use FINAL and OVERRIDE throughoutDavid Malcolm4-232/+514
Mark most virtual functions in gcc/jit as being FINAL OVERRIDE. gcc::jit::recording::lvalue::access_as_rvalue is the sole OVERRIDE that isn't a FINAL. gcc/jit/ChangeLog: * jit-playback.h: Within namespace gcc:jit::playback... (compile_to_memory::postprocess): Mark with FINAL OVERRIDE. (compile_to_file::postprocess): Likewise. (function::finalizer): Likewise. (block::finalizer): Likewise. (source_file::finalizer): Likewise. (source_line::finalizer): Likewise. * jit-recording.c (gcc::jit::rvalue_usage_validator):: Likewise. * jit-recording.h: Within namespace gcc::jit::recording... (string::replay_into): Mark with FINAL OVERRIDE. (string::make_debug_string): Likewise. (string::write_reproducer): Likewise. (location::replay_into): Likewise. (location::dyn_cast_location): Likewise. (location::make_debug_string): Likewise. (location::write_reproducer): Likewise. (memento_of_get_type::dereference): Likewise. (memento_of_get_type::accepts_writes_from): Likewise. (memento_of_get_type::is_int): Likewise. (memento_of_get_type::is_float): Likewise. (memento_of_get_type::is_bool): Likewise. (memento_of_get_type::is_pointer): Likewise. (memento_of_get_type::is_array): Likewise. (memento_of_get_type::is_void): Likewise. (memento_of_get_type::replay_into): Likewise. (memento_of_get_type::make_debug_string): Likewise. (memento_of_get_type::write_reproducer): Likewise. (memento_of_get_pointer::dereference): Likewise. (memento_of_get_pointer::accepts_writes_from): Likewise. (memento_of_get_pointer::replay_into): Likewise. (memento_of_get_pointer::is_int): Likewise. (memento_of_get_pointer::is_float): Likewise. (memento_of_get_pointer::is_bool): Likewise. (memento_of_get_pointer::is_pointer): Likewise. (memento_of_get_pointer::is_array): Likewise. (memento_of_get_pointer::make_debug_string): Likewise. (memento_of_get_pointer::write_reproducer): Likewise. (memento_of_get_const::dereference): Likewise. (memento_of_get_const::accepts_writes_from): Likewise. (memento_of_get_const::unqualified): Likewise. (memento_of_get_const::is_int): Likewise. (memento_of_get_const::is_float): Likewise. (memento_of_get_const::is_bool): Likewise. (memento_of_get_const::is_pointer): Likewise. (memento_of_get_const::is_array): Likewise. (memento_of_get_const::void replay_into): Likewise; (memento_of_get_const::make_debug_string): Likewise. (memento_of_get_const::write_reproducer): Likewise. (memento_of_get_volatile::dereference): Likewise. (memento_of_get_volatile::unqualified): Likewise. (memento_of_get_volatile::is_int): Likewise. (memento_of_get_volatile::is_float): Likewise. (memento_of_get_volatile::is_bool): Likewise. (memento_of_get_volatile::is_pointer): Likewise. (memento_of_get_volatile::is_array): Likewise. (memento_of_get_volatile::replay_into): Likewise; (memento_of_get_volatile::make_debug_string): Likewise. (memento_of_get_volatile::write_reproducer): Likewise. (array_type::dereference): Likewise. (array_type::is_int): Likewise. (array_type::is_float): Likewise. (array_type::is_bool): Likewise. (array_type::is_pointer): Likewise. (array_type::is_array): Likewise. (array_type::replay_into): Likewise; (array_type::make_debug_string): Likewise. (array_type::write_reproducer): Likewise. (function_type::dereference): Likewise. (function_type::function_dyn_cast_function_type): Likewise. (function_type::function_as_a_function_type): Likewise. (function_type::is_int): Likewise. (function_type::is_float): Likewise. (function_type::is_bool): Likewise. (function_type::is_pointer): Likewise. (function_type::is_array): Likewise. (function_type::replay_into): Likewise; (function_type::make_debug_string): Likewise. (function_type::write_reproducer): Likewise. (field::replay_into): Likewise; (field::write_to_dump): Likewise. (field::make_debug_string): Likewise. (field::write_reproducer): Likewise. (compound_type::dereference): Likewise. (compound_type::is_int): Likewise. (compound_type::is_float): Likewise. (compound_type::is_bool): Likewise. (compound_type::is_pointer): Likewise. (compound_type::is_array): Likewise. (compound_type::has_known_size): Likewise. (struct_::dyn_cast_struct): Likewise. (struct_::replay_into): Likewise. (struct_::access_as_type): Likewise. (struct_::make_debug_string): Likewise. (struct_::write_reproducer): Likewise. (fields::replay_into): Likewise. (fields::write_to_dump): Likewise. (fields::make_debug_string): Likewise. (fields::write_reproducer): Likewise. (union_::replay_into): Likewise. (union_::make_debug_string): Likewise. (union_::write_reproducer): Likewise. (lvalue::access_as_rvalue): Mark with OVERRIDE. (param::replay_into): Mark with FINAL OVERRIDE. (param::visit_children): Likewise. (param::dyn_cast_param): Likewise. (param::access_as_rvalue): Likewise. (param::access_as_lvalue): Likewise. (param::make_debug_string): Likewise. (param::write_reproducer): Likewise. (param::get_precedence): Likewise. (function::replay_into): Likewise. (function::write_to_dump): Likewise. (function::make_debug_string): Likewise. (function::write_reproducer): Likewise. (block::write_to_dump): Likewise. (block::make_debug_string): Likewise. (block::write_reproducer): Likewise. (block::replay_into): Likewise. (global::replay_into): Likewise; (global::visit_children): Likewise. (global::write_to_dump): Likewise. (global::make_debug_string): Likewise. (global::write_reproducer): Likewise. (global::get_precedence): Likewise. (memento_of_new_rvalue_from_const::replay_into): Likewise. (memento_of_new_rvalue_from_const::visit_children): Likewise. (memento_of_new_rvalue_from_const::is_constant): Likewise. (memento_of_new_rvalue_from_const::get_wide_int): Likewise. (memento_of_new_rvalue_from_const::make_debug_string): Likewise. (memento_of_new_rvalue_from_const::write_reproducer): Likewise. (memento_of_new_rvalue_from_const::get_precedence): Likewise. (memento_of_new_string_literal::replay_into): Likewise. (memento_of_new_string_literal::visit_children): Likewise. (memento_of_new_string_literal::make_debug_string): Likewise. (memento_of_new_string_literal::write_reproducer): Likewise. (memento_of_new_string_literal::get_precedence): Likewise. (unary_op::replay_into): Likewise. (unary_op::visit_children): Likewise. (unary_op::make_debug_string): Likewise. (unary_op::write_reproducer): Likewise. (unary_op::get_precedence): Likewise. (binary_op::replay_into): Likewise. (binary_op::visit_children): Likewise. (binary_op::make_debug_string): Likewise. (binary_op::write_reproducer): Likewise. (binary_op::get_precedence): Likewise. (comparison::replay_into): Likewise. (comparison::visit_children): Likewise. (comparison::make_debug_string): Likewise. (comparison::write_reproducer): Likewise. (comparison::get_precedence): Likewise. (cast::replay_into): Likewise. (cast::visit_children): Likewise. (cast::make_debug_string): Likewise. (cast::write_reproducer): Likewise. (cast::get_precedence): Likewise. (call::replay_into): Likewise. (call::visit_children): Likewise. (call::make_debug_string): Likewise. (call::write_reproducer): Likewise. (call::get_precedence): Likewise. (call_through_ptr::replay_into): Likewise. (call_through_ptr::visit_children): Likewise. (call_through_ptr::make_debug_string): Likewise. (call_through_ptr::write_reproducer): Likewise. (call_through_ptr::get_precedence): Likewise. (array_access::replay_into): Likewise. (array_access::visit_children): Likewise. (array_access::make_debug_string): Likewise. (array_access::write_reproducer): Likewise. (array_access::get_precedence): Likewise. (access_field_of_lvalue::replay_into): Likewise. (access_field_of_lvalue::visit_children): Likewise. (access_field_of_lvalue::make_debug_string): Likewise. (access_field_of_lvalue::write_reproducer): Likewise. (access_field_of_lvalue::get_precedence): Likewise. (access_field_rvalue::replay_into): Likewise. (access_field_rvalue::visit_children): Likewise. (access_field_rvalue::make_debug_string): Likewise. (access_field_rvalue::write_reproducer): Likewise. (access_field_rvalue::get_precedence): Likewise. (dereference_field_rvalue::replay_into): Likewise. (dereference_field_rvalue::visit_children): Likewise. (dereference_field_rvalue::make_debug_string): Likewise. (dereference_field_rvalue::write_reproducer): Likewise. (dereference_field_rvalue::get_precedence): Likewise. (dereference_rvalue::replay_into): Likewise. (dereference_rvalue::visit_children): Likewise. (dereference_rvalue::make_debug_string): Likewise. (dereference_rvalue::write_reproducer): Likewise. (dereference_rvalue::get_precedence): Likewise. (get_address_of_lvalue::replay_into): Likewise. (get_address_of_lvalue::visit_children): Likewise. (get_address_of_lvalue::make_debug_string): Likewise. (get_address_of_lvalue::write_reproducer): Likewise. (get_address_of_lvalue::get_precedence): Likewise. (local::replay_into): Likewise. (local::visit_children): Likewise. (local::write_to_dump): Likewise. (local::make_debug_string): Likewise. (local::write_reproducer): Likewise. (local::get_precedence): Likewise. (statement::write_to_dump): Likewise. (eval::replay_into): Likewise. (eval::make_debug_string): Likewise. (eval::write_reproducer): Likewise. (assignment::replay_into): Likewise. (assignment::make_debug_string): Likewise. (assignment::write_reproducer): Likewise. (assignment_op::replay_into): Likewise. (assignment_op::make_debug_string): Likewise. (assignment_op::write_reproducer): Likewise. (comment::replay_into): Likewise. (comment::make_debug_string): Likewise. (comment::write_reproducer): Likewise. (conditional::replay_into): Likewise. (conditional::get_successor_blocks): Likewise. (conditional::make_debug_string): Likewise. (conditional::write_reproducer): Likewise. (jump::replay_into): Likewise. (jump::get_successor_blocks): Likewise. (jump::make_debug_string): Likewise. (jump::write_reproducer): Likewise. (return_::replay_into): Likewise. (return_::get_successor_blocks): Likewise. (return_::make_debug_string): Likewise. (return_::write_reproducer): Likewise. (case_::replay_into): Likewise. (case_::write_reproducer): Likewise. (case_::make_debug_string): Likewise. (switch_::replay_into): Likewise. (switch_::get_successor_blocks): Likewise. (switch_::make_debug_string): Likewise. (switch_::write_reproducer): Likewise. From-SVN: r236223
2016-02-08jit: fix build after r233218 (build_common_tree_nodes)David Malcolm2-1/+7
gcc/jit/ChangeLog: * dummy-frontend.c (jit_langhook_init): Remove second argument to build_common_tree_nodes to track r233218. From-SVN: r233222
2016-01-26Add missing includes in JIT frontend.Iain Buclaw2-0/+6
gcc/jit/ * jit-playback.c: Include pthread.h. From-SVN: r232815
2016-01-19PR jit/69144: Ensure that libgccjit's tempdir is fully cleaned-upDavid Malcolm7-508/+691
There were a couple of ways that libgccjit could fail to unlink all of its tempfiles, leading to /tmp/libgccjit-* tempdirs lingering after the build: - dumpfiles requested by gcc_jit_context_enable_dump - ahead-of-time compilation artifacts which lingered in the tempdir after they've been copied up to the output_path. This was only the case for GCC_JIT_OUTPUT_KIND_OBJECT_FILE and GCC_JIT_OUTPUT_KIND_EXECUTABLE. The following patch fixes these by introducing a vec of additional cleanups to be performed by gcc:jit::tempdir's dtor. In addition, if a gcc_jit_result * is leaked and GCC_JIT_BOOL_OPTION_DEBUGINFO is enabled, the tempdir will also not be cleaned up. This was the case for tut04-toyvm/toyvm.cc which the patch fixes by introducing a wrapper around gcc_jit_result *. Doing this required some updates to the corresponding docs. gcc/jit/ChangeLog: PR jit/69144 * jit-playback.c (gcc::jit::playback::compile_to_file::postprocess): Potentially add the temporary artifact to the tempdir's list of tempfiles needing additional cleanup. (gcc::jit::playback::context::extract_any_requested_dumps): Likewise for the dumpfile. * jit-tempdir.c (gcc::jit::tempdir::~tempdir): Clean up additional tempfiles. * jit-tempdir.h (gcc::jit::tempdir::add_temp_file): New method. (gcc::jit::tempdir::m_tempfiles): New field. * docs/cp/intro/tutorial04.rst: Update for changes to toyvm.cc. * docs/examples/tut04-toyvm/toyvm.cc (class compilation_result): New. (toyvm_function::compile): Change return type from function ptr to a compilation_result. (toyvm_function::get_function_name): New accessor. (toyvm_function::m_funcname): New field. (get_function_name): Convert to... (toyvm_function::make_function_name): ...this new method. (toyvm_function::parse): Call make_function_name. (toyvm_function::compile): Convert return type from function ptr to a compilation_result. Use get_function_name. (compilation_state::compile): Convert return type from gcc_jit_result * to a compilation_result. (test_script): Update for above changes, extracting the code from the compilation_result. (main): Likewise. * docs/_build/texinfo/libgccjit.texi: Regenerate. From-SVN: r232582
2016-01-04Update copyright years.Jakub Jelinek64-103/+107
From-SVN: r232055
2015-11-11decl.c: Remove unused header files.Andrew MacLeod7-28/+9
ada * gcc-interface/decl.c: Remove unused header files. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c * c-array-notation.c: Remove unused header files. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * gccspec.c: Likewise. c-family * array-notation-common.c: Remove unused header files. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp * call.c: Remove unused header files. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * g++spec.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. Fortran * array.c: Remove unused header files. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go * go-backend.c: Remove unused header files. * go-gcc.cc: Likewise. * go-lang.c: Likewise. * gospec.c: Likewise. Java * boehm.c: Remove unused header files. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. * zextract.c: Likewise. jit * dummy-frontend.c: Remove unused header files. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * jit-spec.c: Likewise. * libgccjit.c: Likewise. lto * lto-lang.c: Remove unused header files. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc * objc-act.c: Remove unused header files. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp * objcp-decl.c: Remove unused header files. * objcp-lang.c: Likewise. From-SVN: r230166