aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
AgeCommit message (Collapse)AuthorFilesLines
2018-09-02* doc/standards.texi (Standards): Update Objective-C reference.Gerald Pfeifer1-1/+1
From-SVN: r264038
2018-09-01* doc/install.texi (Prerequisites): Update link for MPC.Gerald Pfeifer1-1/+1
From-SVN: r264033
2018-09-01generic.texi (OpenMP): Adjust link to openmp.org.Gerald Pfeifer2-2/+2
* doc/generic.texi (OpenMP): Adjust link to openmp.org. * doc/invoke.texi (C Dialect Options): Ditto. From-SVN: r264032
2018-09-01* doc/install.texi (Prerequisites): Adjust link mpfr.org.Gerald Pfeifer1-1/+1
From-SVN: r264028
2018-08-31[C++ PATCH] Remove K&R declaration hack.Nathan Sidwell1-3/+3
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01885.html gcc/ * doc/extend.texi (Backwards Compatibility): Remove implicit extern C leeway of () being (...). gcc/cp/ * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching of return types and parms. * parser.c (cp_parser_parameter_declaration_clause): Likewise, '()' always means '(void)'. From-SVN: r264013
2018-08-30target.def (custom_function_descriptors): Improve documentation.Sandra Loosemore2-54/+125
2018-08-30 Sandra Loosemore <sandra@codesourcery.com> gcc/ * target.def (custom_function_descriptors): Improve documentation. * doc/tm.texi.in (Trampolines): Expand discussion of function descriptors and move TARGET_CUSTOM_FUNCTION_DESCRIPTORS to the beginning of the section. * doc/tm.texi: Regenerated. From-SVN: r263999
2018-08-30altivec.md (altivec_eq<mode>): Remove star.Aaron Sawdey1-5/+3
2018-08-30 Aaron Sawdey <acsawdey@linux.ibm.com> * config/rs6000/altivec.md (altivec_eq<mode>): Remove star. (altivec_vcmpequ<VI_char>_p): Remove star. * config/rs6000/rs6000-string.c (do_load_for_compare): Support vector load modes. (expand_strncmp_vec_sequence): New function. (emit_final_str_compare_vec): New function. (expand_strn_compare): Add support for vector strncmp. * config/rs6000/rs6000.opt (-mstring-compare-inline-limit): Change length specification to bytes. * config/rs6000/vsx.md (vsx_ld_elemrev_v16qi_internal): Remove star. (vcmpnezb_p): New pattern. * doc/invoke.texi (RS/6000 and PowerPC Options): Update documentation for option -mstring-compare-inline-limit. From-SVN: r263991
2018-08-29doc: document -ftree-scev-cpropAlexander Monakov1-1/+11
PR other/86726 * invoke.texi (Optimization Options): List -ftree-scev-cprop. (-O): Ditto. (-ftree-scev-cprop): Document. From-SVN: r263955
2018-08-27cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.Richard Biener1-5/+6
2018-08-27 Richard Biener <rguenther@suse.de> * cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare. * cfganal.c (rev_post_order_and_mark_dfs_back_seme): New function. * tree-ssa-sccvn.h (struct vn_pval): New structure. (struct vn_nary_op_s): Add unwind_to member. Add predicated_values flag and put result into a union together with a linked list of vn_pval. (struct vn_ssa_aux): Add name member to make maintaining a map of SSA name to vn_ssa_aux possible. Remove no longer needed info, dfsnum, low, visited, on_sccstack, use_processed and range_info_anti_range_p members. (run_scc_vn, vn_eliminate, free_scc_vn, vn_valueize): Remove. (do_rpo_vn, run_rpo_vn, eliminate_with_rpo_vn, free_rpo_vn): New functions. (vn_valueize): New global. (vn_context_bb): Likewise. (VN_INFO_RANGE_INFO, VN_INFO_ANTI_RANGE_P, VN_INFO_RANGE_TYPE, VN_INFO_PTR_INFO): Remove. * tree-ssa-sccvn.c: ... (rewrite) (pass_fre::execute): For -O2+ initialize loops and run RPO VN in optimistic mode (iterating). For -O1 and -Og run RPO VN in non-optimistic mode. * params.def (PARAM_SCCVN_MAX_SCC_SIZE): Remove. (PARAM_RPO_VN_MAX_LOOP_DEPTH): Add. * doc/invoke.texi (sccvn-max-scc-size): Remove. (rpo-vn-max-loop-depth): Document. * tree-ssa-alias.c (walk_non_aliased_vuses): Stop walking when valuezing the VUSE signals we walked out of the region. * tree-ssa-pre.c (phi_translate_1): Ignore predicated values. (phi_translate): Set VN context block to use for availability lookup. (compute_avail): Likewise. (pre_valueize): New function. (pass_pre::execute): Adjust to the RPO VN API. * tree-ssa-loop-ivcanon.c: Include tree-ssa-sccvn.h. (propagate_constants_for_unrolling): Remove. (tree_unroll_loops_completely): Perform value-numbering on the unrolled bodies loop parent. * g++.dg/torture/20180705-1.C: New testcase. * gcc.dg/tree-ssa/ssa-fre-67.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-14.c: Scan FRE dump. * gcc.dg/tree-ssa/ssa-fre-46.c: Use -O2. * gcc.dg/tree-ssa/vrp92.c: Disable FRE. * gcc.dg/pr83666.c: Drop --param=sccvn-max-scc-size option. * gcc.dg/pr85195.c: Likewise. * gcc.dg/pr85467.c: Likewise. * gcc.dg/torture/pr81790.c: Likewise. * gfortran.dg/reassoc_4.f: Change max-completely-peeled-insns param to current default. From-SVN: r263875
2018-08-26PR c++/87029, Implement -Wredundant-move.Marek Polacek1-1/+45
* c.opt (Wredundant-move): New option. * typeck.c (treat_lvalue_as_rvalue_p): New function. (maybe_warn_pessimizing_move): Call convert_from_reference. Warn about redundant moves. * doc/invoke.texi: Document -Wredundant-move. * g++.dg/cpp0x/Wredundant-move1.C: New test. * g++.dg/cpp0x/Wredundant-move2.C: New test. * g++.dg/cpp0x/Wredundant-move3.C: New test. * g++.dg/cpp0x/Wredundant-move4.C: New test. From-SVN: r263863
2018-08-21PR c++/86981, Implement -Wpessimizing-move.Marek Polacek1-0/+27
* c.opt (Wpessimizing-move): New option. * typeck.c (decl_in_std_namespace_p): New. (is_std_move_p): New. (maybe_warn_pessimizing_move): New. (can_do_nrvo_p): New, factored out of ... (check_return_expr): ... here. Warn about potentially harmful std::move in a return statement. * doc/invoke.texi: Document -Wpessimizing-move. * g++.dg/cpp0x/Wpessimizing-move1.C: New test. * g++.dg/cpp0x/Wpessimizing-move2.C: New test. * g++.dg/cpp0x/Wpessimizing-move3.C: New test. * g++.dg/cpp0x/Wpessimizing-move4.C: New test. * g++.dg/cpp1z/Wpessimizing-move1.C: New test. From-SVN: r263741
2018-08-21[debug] Add debug and earlydebug dumpsTom de Vries1-0/+11
With the introduction of early debug, we've added a phase in the compiler which produces information which is not visible, unless we run the compiler in the debugger and call debug_dwarf from dwarf2out_early_finish or some such. This patch adds dumping of "early" and "final" debug info, into .earlydebug and .debug dump files, enabled by -fdump-earlydebug and -fdumpdebug, such that we can follow f.i. the upper bound of a vla type from early debug: ... DW_AT_upper_bound: location descriptor: (0x7f0d645b7550) DW_OP_GNU_variable_value , 0 ... to final debug: ... DW_AT_upper_bound: location descriptor: (0x7f0d645b7550) DW_OP_fbreg 18446744073709551592, 0 (0x7f0d645b7a00) DW_OP_deref 8, 0 ... to -dA annotated assembly file: ... .uleb128 0x3 # DW_AT_upper_bound .byte 0x91 # DW_OP_fbreg .sleb128 -24 .byte 0x6 # DW_OP_deref ... The .debug file shows the same information as the annotated assembly, but in the same format as the "early" debug info. Bootstrapped and reg-tested on x86_64. 2018-08-21 Tom de Vries <tdevries@suse.de> * cgraph.h (debuginfo_early_init, debuginfo_init, debuginfo_fini) (debuginfo_start, debuginfo_stop, debuginfo_early_start) (debuginfo_early_stop): Declare. * cgraphunit.c (debuginfo_early_init, debuginfo_init, debuginfo_fini) (debuginfo_start, debuginfo_stop, debuginfo_early_start) (debuginfo_early_stop): New function. (symbol_table::finalize_compilation_unit): Call debuginfo_early_start and debuginfo_early_stop. * dwarf2out.c (dwarf2out_finish, dwarf2out_early_finish): Dump dwarf. * toplev.c (compile_file): Call debuginfo_start and debuginfo_stop. (general_init): Call debuginfo_early_init. (finalize): Call debuginfo_fini. (do_compile): Call debuginfo_init. * doc/invoke.texi (@gccoptlist): Add -fdump-debug and -fdump-early-debug. (@item -fdump-debug, @item -fdump-earlydebug): Add. * lto.c (lto_main): Call debuginfo_early_start and debuginfo_early_stop. * gcc.c-torture/unsorted/dump-noaddr.x: Use -gno-record-gcc-switches to avoid mismatch in .debug and .earlydebug dump files. From-SVN: r263687
2018-08-17doc: Use @ref, not @xref, in the middle of a sentenceSegher Boessenkool1-1/+1
makeinfo warns about this. * doc/md.texi (Patterns): Use @ref instead of @xref in the middle of a sentence. From-SVN: r263633
2018-08-17C-SKY port: DocumentationSandra Loosemore3-0/+272
2018-08-17 Sandra Loosemore <sandra@codesourcery.com> C-SKY port: Documentation gcc/ * doc/extend.texi (C-SKY Function Attributes): New section. * doc/invoke.texi (Option Summary): Add C-SKY options. (C-SKY Options): New section. * doc/md.texi (Machine Constraints): Document C-SKY constraints. From-SVN: r263629
2018-08-16Remove rtl.texi references to old RTX code class namesMatthew Malcomson1-13/+16
Committed on behalf of Matthew Malcomson. 2018-08-16 Matthew Malcomson <matthew.malcomson@arm.com> gcc/ * doc/rtl.texi: Replace old RTX class names with new names. From-SVN: r263592
2018-08-15i386.opt (mmitigate-rop): Mark as deprecated.Uros Bizjak1-8/+1
* config/i386/i386.opt (mmitigate-rop): Mark as deprecated. * doc/invoke.texi (mmitigate-rop): Remove. * config/i386/i386.c: Do not include "regrename.h". (ix86_rop_should_change_byte_p, reg_encoded_number) (ix86_get_modrm_for_rop, set_rop_modrm_reg_bits, ix86_mitigate_rop): Remove. (ix86_reorg): Remove call to ix86_mitigate_rop. * config/i386/i386.md (attr "modrm_class"): Remove. (cmp<mode>_ccno_1, mov<mode>_xor, movstrict<mode>_xor) (x86_mov<mode>cc_0_m1. x86_mov<mode>cc_0_m1_se) (x86_mov<mode>cc_0_m1_neg): Remove modrm_class attribute override. testsuite/Changelog: * gcc.target/i386/rop1.c: Remove. * gcc.target/i386/pr83554 (dg-options): Remove -mmitigate-rop. From-SVN: r263572
2018-08-15diagnostics: add labeling of source rangesDavid Malcolm1-1/+18
This patch adds the ability to label source ranges within a rich_location, to be printed by diagnostic_show_locus. For example: pr69554-1.c:11:18: error: invalid operands to binary + (have 'const char *' and 'const char *') 11 | return (p + 1) + (q + 1); | ~~~~~~~ ^ ~~~~~~~ | | | | | const char * | const char * The patch implements labels for various type mismatch errors in the C and C++ frontends, and in -Wformat. I implemented it wherever accurate location information was guaranteed (there are other places that could benefit, but we need better location information in those places). The labels can be disabled via -fno-diagnostics-show-labels. Similarly: param-type-mismatch.C: In function 'int test_1(int, int, float)': param-type-mismatch.C:11:27: error: invalid conversion from 'int' to 'const char*' [-fpermissive] 11 | return callee_1 (first, second, third); | ^~~~~~ | | | int param-type-mismatch.C:7:43: note: initializing argument 2 of 'int callee_1(int, const char*, float)' 7 | extern int callee_1 (int one, const char *two, float three); | ~~~~~~~~~~~~^~~ where the first "error" describing the bad argument gets a label describing the type inline (since it's non-obvious from "second"). The "note" describing the type of the param of the callee *doesn't* get a label, since that information is explicit there in the source ("const char *two"). The idea is that in any diagnostic where two aspects of the source aren't in sync it ought to be easier for the user if we directly show them the mismatching aspects inline (e.g. types). As well as type mismatch errors, perhaps labels could also be used for buffer overflow warnings, for describing the capacity of the destination buffer vs the size of what's being written: sprintf (buf, "filename: %s\n", file); ^~~ ~~~~~~~~~~~^~~ | | capacity: 32 10 + strlen(file) + 2 or somesuch. Another idea might be for macro expansion warnings: warning: repeated side effects in macro expansion... x = MIN (p++, q++); ~~~~^~~~~~~~~~ note: ...expanded here as #define MIN(X,Y) (X<Y?X:Y) ^~~ ~ ~ ~ ~ ~ ~ | | | | | | | | | | | q++ | | | | p++ | | | q++ | q++ p++ p++ The patch removes some logic from multiline.exp which special-cased lines ending with a '|' character (thus complicating testing of this patch). I believe that this was a vestige from experiments I did to support strippng dg directives from the output; it was present in the earliest version of multiline.exp I posted: "[RFC, stage1] Richer source location information for gcc 6 (location ranges etc)" https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00837.html and I believe was neved used. gcc/c-family/ChangeLog: * c-format.c: Include "selftest-diagnostic.h" and "gcc-rich-location.h". (format_warning_at_char): Pass NULL for new label params of format_warning_va. (class indirection_suffix): New class. (class range_label_for_format_type_mismatch): New class. (format_type_warning): Move logic for generating "*" suffix to class indirection_suffix. Create "fmt_label" and "param_label" to show their types, and pass them to the format_warning_at_substring calls. (selftest::test_type_mismatch_range_labels): New test. (selftest::c_format_c_tests): Call it. gcc/c/ChangeLog: * c-objc-common.c: Include "gcc-rich-location.h". (c_tree_printer): Move implemenation of '%T' to... (print_type): ...this new function. (range_label_for_type_mismatch::get_text): New function. * c-typeck.c (convert_for_assignment): Add type labels to the rhs range for the various ic_argpass cases. (class maybe_range_label_for_tree_type_mismatch): New class. (build_binary_op): Use it when calling binary_op_error. gcc/cp/ChangeLog: * call.c: Include "gcc-rich-location.h". (convert_like_real): Add range label for "invalid conversion" diagnostic. (perform_implicit_conversion_flags): Add type label to the "could not convert" error. * error.c: Include "gcc-rich-location.h". (range_label_for_type_mismatch::get_text): New function. * typeck.c (convert_for_assignment): Add type label to the "cannot convert" error if a location is available. gcc/ChangeLog: * common.opt (fdiagnostics-show-labels): New option. * diagnostic-show-locus.c (class layout_range): Add field "m_label". (class layout): Add field "m_show_labels_p". (layout_range::layout_range): Add param "label" and use it to initialize m_label. (make_range): Pass in NULL for new "label" param of layout_range's ctor. (layout::layout): Initialize m_show_labels_p. (layout::maybe_add_location_range): Pass in loc_range->m_label when constructing layout_range instances. (struct line_label): New struct. (layout::print_any_labels): New member function. (layout::print_line): Call it if label-printing is enabled. (selftest::test_one_liner_labels): New test. (selftest::test_diagnostic_show_locus_one_liner): Call it. * diagnostic.c (diagnostic_initialize): Initialize context->show_labels_p. * diagnostic.h (struct diagnostic_context): Add field "show_labels_p". * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fno-diagnostics-show-labels. * dwarf2out.c (gen_producer_string): Add OPT_fdiagnostics_show_labels to the ignored options. * gcc-rich-location.c (gcc_rich_location::add_expr): Add "label" param. (gcc_rich_location::maybe_add_expr): Likewise. * gcc-rich-location.h (gcc_rich_location::gcc_rich_location): Add label" param, defaulting to NULL. (gcc_rich_location::add_expr): Add "label" param. (gcc_rich_location::maybe_add_expr): Likewise. (class text_range_label): New class. (class range_label_for_type_mismatch): New class. * gimple-ssa-sprintf.c (fmtwarn): Pass NULL for new label params of format_warning_va. (fmtwarn_n): Likewise for new params of format_warning_n_va. * lto-wrapper.c (merge_and_complain): Add OPT_fdiagnostics_show_labels to the "pick one setting" options. (append_compiler_options): Likewise to the dropped options. (append_diag_options): Likewise to the passed-on options. * opts.c (common_handle_option): Handle the new option. * selftest-diagnostic.c (test_diagnostic_context::test_diagnostic_context): Enable show_labels_p. * substring-locations.c: Include "gcc-rich-location.h". (format_warning_n_va): Add "fmt_label" and "param_label" params and use them as appropriate. (format_warning_va): Add "fmt_label" and "param_label" params, passing them on to format_warning_n_va. (format_warning_at_substring): Likewise. (format_warning_at_substring_n): Likewise. * substring-locations.h (format_warning_va): Add "fmt_label" and "param_label" params. (format_warning_n_va): Likewise. (format_warning_at_substring): Likewise. (format_warning_at_substring_n): Likewise. * toplev.c (general_init): Initialize global_dc->show_labels_p. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/aka3.C: New test. * g++.dg/diagnostic/param-type-mismatch-2.C: Update expected output to show range labels. * g++.dg/diagnostic/param-type-mismatch.C: Likewise. * g++.dg/plugin/plugin.exp (plugin_test_list): Add... * g++.dg/plugin/show-template-tree-color-labels.C: New test. * gcc.dg/bad-binary-ops.c: Update expected output to show range labels. Add an "aka" example. * gcc.dg/cpp/pr66415-1.c: Update expected output to show range labels. * gcc.dg/format/diagnostic-ranges.c: Likewise. * gcc.dg/format/pr72858.c: Likewise. * gcc.dg/format/pr78498.c: Likewise. * gcc.dg/param-type-mismatch.c: Add "-Wpointer-sign" to options. Update expected output to show range labels. Add examples of -Wincompatible-pointer-types and -Wpointer-sign for parameters. * gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c: Update expected output to show range labels. * gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise. (test_very_wide_line): Adjust so that label is at left-clipping boundary. (test_very_wide_line_2): New test. * gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c: Update expected output to show range labels. * gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise. * gcc.dg/plugin/diagnostic-test-show-locus-no-labels.c: New test. * gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update for new param to gcc_rich_location::add_expr. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (add_range): Add "label" param. (test_show_locus): Add examples of labels to various tests. Tweak the "very wide_line" test case and duplicate it, to cover the boundary values for clipping of labels against the left-margin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add diagnostic-test-show-locus-no-labels.c. * gcc.dg/pr69554-1.c: Update expected output to show range labels. Update line numbers of dg-locus directives. * gcc.dg/pr69627.c: Update expected output to show range labels. * lib/multiline.exp (proc _build_multiline_regex): Remove special-case handling of lines with trailing '|'. libcpp/ChangeLog: * include/line-map.h (struct location_range): Add "m_label" field. (class rich_location): Add description of labels to leading comment. (rich_location::rich_location): Add "label" param, defaulting to NULL. (rich_location::add_range): Likewise. (struct label_text): New struct. (class range_label): New abstract base class. * line-map.c (rich_location::rich_location): Add "label" param; use it. (rich_location::add_range): Likewise. From-SVN: r263564
2018-08-10Introduce __builtin_expect_with_probability (PR target/83610).Martin Liska2-0/+12
2018-08-10 Martin Liska <mliska@suse.cz> PR target/83610 * builtin-types.def (BT_FN_LONG_LONG_LONG_DOUBLE): Add new function type. * builtins.c (expand_builtin_expect_with_probability): New function. (expand_builtin_expect_with_probability): New function. (build_builtin_expect_predicate): Add new argumnet probability for BUILT_IN_EXPECT_WITH_PROBABILITY. (fold_builtin_expect): (fold_builtin_2): (fold_builtin_3): * builtins.def (BUILT_IN_EXPECT_WITH_PROBABILITY): * builtins.h (fold_builtin_expect): Set new argument. * doc/extend.texi: Document __builtin_expect_with_probability. * doc/invoke.texi: Likewise. * gimple-fold.c (gimple_fold_call): Pass new argument. * ipa-fnsummary.c (find_foldable_builtin_expect): Handle also BUILT_IN_EXPECT_WITH_PROBABILITY. * predict.c (get_predictor_value): New function. (expr_expected_value): Add new argument probability. Assume that predictor and probability are always non-null. (expr_expected_value_1): Likewise. For __builtin_expect and __builtin_expect_with_probability set probability. Handle combination in binary expressions. (tree_predict_by_opcode): Simplify code by simply calling get_predictor_value. (pass_strip_predict_hints::execute): Add handling of BUILT_IN_EXPECT_WITH_PROBABILITY. * predict.def (PRED_BUILTIN_EXPECT_WITH_PROBABILITY): Add new predictor. * tree.h (DECL_BUILT_IN_P): New function. 2018-08-10 Martin Liska <mliska@suse.cz> PR target/83610 * gcc.dg/predict-17.c: New test. * gcc.dg/predict-18.c: New test. * gcc.dg/predict-19.c: New test. From-SVN: r263466
2018-08-09diagnostics: add line numbers to source (PR other/84889)David Malcolm1-0/+8
This patch adds a left margin to the lines of source (and annotations) printed by diagnostic_show_locus, so that e.g. rather than: test.c: In function 'test': test.c:12:15: error: 'struct foo' has no member named 'm_bar'; did you mean 'bar'? return ptr->m_bar; ^~~~~ bar we print: test.c: In function 'test': test.c:12:15: error: 'struct foo' has no member named 'm_bar'; did you mean 'bar'? 12 | return ptr->m_bar; | ^~~~~ | bar Similarly, for a multiline case (in C++ this time), this: bad-binary-ops.C: In function 'int test_2()': bad-binary-ops.C:26:4: error: no match for 'operator+' (operand types are 's' and 't') return (some_function () ~~~~~~~~~~~~~~~~ + some_other_function ()); ^~~~~~~~~~~~~~~~~~~~~~~~ becomes: bad-binary-ops.C: In function 'int test_2()': bad-binary-ops.C:26:4: error: no match for 'operator+' (operand types are 's' and 't') 25 | return (some_function () | ~~~~~~~~~~~~~~~~ 26 | + some_other_function ()); | ^~~~~~~~~~~~~~~~~~~~~~~~ I believe this slightly improves the readability of the output, in that it: - distinguishes between the user's source code vs the annotation lines that we're adding (the underlinings and fix-it hints here) - shows the line numbers in another place (potentially helpful for multiline diagnostics, where the user can see the line numbers directly, rather than have to figure them out relative to the caret: in the 2nd example, note how the diagnostic is reported at line 26, but the first line printed is actually line 25) I'm not sure that this is the precise format we want to go with [1], but I think it's an improvement over the status quo, and we're in stage 1 of gcc 9, so there's plenty of time to shake out issues. I've turned it on by default; it can be disabled via -fno-diagnostics-show-line-numbers (it's also turned off in the testsuite, to avoid breaking numerous existing test cases). [1] Some possible variants: - maybe just "LL|" rather than "LL | " - maybe ':' rather than '|' - maybe we should have some leading indentation, to better split up the diagnostics visually via the left-hand column - etc gcc/ChangeLog: PR other/84889 * common.opt (fdiagnostics-show-line-numbers): New option. * diagnostic-show-locus.c (class layout): Add fields "m_show_line_numbers_p" and "m_linenum_width"; (num_digits): New function. (test_num_digits): New function. (layout::layout): Initialize new fields. Update m_x_offset logic to handle any left margin. (layout::print_source_line): Print line number when requested. (layout::start_annotation_line): New member function. (layout::print_annotation_line): Call it. (layout::print_leading_fixits): Likewise. (layout::print_trailing_fixits): Likewise. Update calls to move_to_column for new parameter. (layout::get_x_bound_for_row): Add "add_left_margin" param and use it to potentially call start_annotation_line. (layout::show_ruler): Call start_annotation_line. (selftest::test_line_numbers_multiline_range): New selftest. (selftest::diagnostic_show_locus_c_tests): Call test_num_digits and selftest::test_line_numbers_multiline_range. * diagnostic.c (diagnostic_initialize): Initialize show_line_numbers_p. * diagnostic.h (struct diagnostic_context): Add field "show_line_numbers_p". * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fno-diagnostics-show-line-numbers. * dwarf2out.c (gen_producer_string): Add OPT_fdiagnostics_show_line_numbers to the ignored options. * lto-wrapper.c (merge_and_complain): Likewise to the "pick one setting" options. (append_compiler_options): Likewise to the dropped options. (append_diag_options): Likewise to the passed-on options. * opts.c (common_handle_option): Handle the new option. * toplev.c (general_init): Set up global_dc->show_line_numbers_p. gcc/testsuite/ChangeLog: PR other/84889 * gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c: New test. * gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c: New test. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new tests. * lib/prune.exp: Add -fno-diagnostics-show-line-numbers to TEST_ALWAYS_FLAGS. From-SVN: r263450
2018-08-09extend.texi (PowerPC AltiVec Built-in Functions Available on ISA 2.07): ↵Kelvin Nilsen1-10/+10
Correct spelling of bcdsub to be __builtin_bcdsub. gcc/ChangeLog: 2018-08-09 Kelvin Nilsen <kelvin@gcc.gnu.org> * doc/extend.texi (PowerPC AltiVec Built-in Functions Available on ISA 2.07): Correct spelling of bcdsub to be __builtin_bcdsub. Add third argument of type "const signed char" to descriptions of __builtin_bcdadd, __builtin_bcdadd_lt, __builtin_bcdadd_eq, __builtin_bcdadd_gt, __builtin_bcdadd_ov, __builtin_bcdsub, __builtin_bcdsub_lt, __builtin_bcdsub_eq, __builtin_bcdsub_gt, __builtin_bcdsub_ov functions. From-SVN: r263449
2018-08-08[AArch64] Add HXT Phecda core supportHongbo Zhang1-1/+1
HXT semiconductor's CPU core Phecda, as a variant of Qualcomm qdf24xx, reuses the same tuning structure and pipeline with it. Applied on behalf of: Hongbo Zhang <hongbo.zhang@linaro.org> * config/aarch64/aarch64-cores.def: Add phecda core. * config/aarch64/aarch64-tune.md: Regenerate. * doc/invoke.texi: Add phecda core. From-SVN: r263404
2018-08-08S/390: Remove support for g5 and g6 machinesIlya Leoshkevich1-2/+1
g5 and g6 were deprecated since gcc 6.1.0 (commit 3bd8520f). gcc/ChangeLog: 2018-08-08 Ilya Leoshkevich <iii@linux.ibm.com> * common/config/s390/s390-common.c (processor_flags_table): Remove flags. * config.gcc: Remove with_arch/with_tune support. * config/s390/2064.md: Remove cpu attribute comparisons. * config/s390/driver-native.c (s390_host_detect_local_cpu): Remove MTN. * config/s390/linux.h (ASM_SPEC): Remove -march support. * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Use a table to get an arch level. * config/s390/s390-opts.h (enum processor_type): Remove enum values. * config/s390/s390.c (processor_table): Remove entries, add arch_level values. (s390_issue_rate): Remove cases. (s390_option_override): Adjust s390_option_override_internal() call. (s390_option_override_internal): Remove deprecation warning. (s390_valid_target_attribute_tree): Adjust s390_option_override_internal() call. * config/s390/s390.h (struct s390_processor): Share with s390-c.c, add arch_level field. * config/s390/s390.md: Remove occurrences in cpu attribute. * config/s390/s390.opt: Remove -march/-mtune support. * config/s390/tpf.h (ASM_SPEC): Remove -march support. * doc/invoke.texi: Remove deprecation warning. gcc/testsuite/ChangeLog: 2018-08-08 Ilya Leoshkevich <iii@linux.ibm.com> * gcc.target/s390/hotpatch-8.c: Remove. * gcc.target/s390/hotpatch-9.c: Remove. * gcc.target/s390/mnop-mcount-m31-fpic.c: Remove. * gcc.target/s390/mnop-mcount-m31.c: Remove. From-SVN: r263393
2018-08-07Add malloc predictor (PR middle-end/83023).Martin Liska1-1/+3
2018-08-07 Martin Liska <mliska@suse.cz> PR middle-end/83023 * predict.c (expr_expected_value_1): Handle DECL_IS_MALLOC, BUILT_IN_REALLOC and DECL_IS_OPERATOR_NEW. * predict.def (PRED_MALLOC_NONNULL): New predictor. * doc/extend.texi: Document that malloc attribute adds hit to compiler. 2018-08-07 Martin Liska <mliska@suse.cz> PR middle-end/83023 * gcc.dg/predict-16.c: New test. * g++.dg/predict-1.C: New test. From-SVN: r263355
2018-08-06Add CLOBBER_HIGH expressionAlan Hayward1-1/+14
Includes documentation. 2018-08-06 Alan Hayward <alan.hayward@arm.com> * doc/rtl.texi (clobber_high): Add. (parallel): Add in clobber high * rtl.c (rtl_check_failed_code3): Add function. * rtl.def (CLOBBER_HIGH): Add expression. * rtl.h (RTL_CHECKC3): Add macro. (rtl_check_failed_code3): Add declaration. (XC3EXP): Add macro. From-SVN: r263326
2018-08-03docs: fix stray duplicated wordsDavid Malcolm2-8/+8
gcc/ChangeLog: * doc/gcov.texi (-x): Remove duplicate "to". * doc/invoke.texi (-Wnoexcept-type): Remove duplicate "calls". (-Wif-not-aligned): Remove duplicate "is". (-flto): Remove duplicate "the". (MicroBlaze Options): In examples of "-mcpu=cpu-type", remove duplicate "v5.00.b". (MSP430 Options): Remove duplicate "and" from the description of "-mgprel-sec=regexp". (x86 Options): Remove duplicate copies of "vmldLog102" and vmlsLog104 from description of "-mveclibabi=type". From-SVN: r263295
2018-08-02Revert "[ARM] Fix PR85434: spilling of stack protector guard's address on ARM"Thomas Preud'homme1-47/+8
This reverts commit r263245. From-SVN: r263252
2018-08-02[gen/AArch64] Generate helpers for substituting iterator values into pattern ↵Richard Sandiford1-8/+117
names Given a pattern like: (define_insn "aarch64_frecpe<mode>" ...) the SVE ACLE implementation wants to generate the pattern for a particular (non-constant) mode. This patch automatically generates helpers to do that, specifically: // Return CODE_FOR_nothing on failure. insn_code maybe_code_for_aarch64_frecpe (machine_mode); // Assert that the code exists. insn_code code_for_aarch64_frecpe (machine_mode); // Return NULL_RTX on failure. rtx maybe_gen_aarch64_frecpe (machine_mode, rtx, rtx); // Assert that generation succeeds. rtx gen_aarch64_frecpe (machine_mode, rtx, rtx); Many patterns don't have sensible names when all <...>s are removed. E.g. "<optab><mode>2" would give a base name "2". The new functions therefore require explicit opt-in, which should also help to reduce code bloat. The (arbitrary) opt-in syntax I went for was to prefix the pattern name with '@', similarly to the existing '*' marker. The patch also makes config/aarch64 use the new routines in cases where they obviously apply. This was mostly straight-forward, but it seemed odd that we defined: aarch64_reload_movcp<...><P:mode> but then only used it with DImode, never SImode. If we should be using Pmode instead of DImode, then that's a simple change, but should probably be a separate patch. 2018-08-02 Richard Sandiford <richard.sandiford@arm.com> gcc/ * doc/md.texi: Expand the documentation of instruction names to mention port-local uses. Document '@' in pattern names. * read-md.h (overloaded_instance, overloaded_name): New structs. (mapping): Declare. (md_reader::handle_overloaded_name): New member function. (md_reader::get_overloads): Likewise. (md_reader::m_first_overload): New member variable. (md_reader::m_next_overload_ptr): Likewise. (md_reader::m_overloads_htab): Likewise. * read-md.c (md_reader::md_reader): Initialize m_first_overload, m_next_overload_ptr and m_overloads_htab. * read-rtl.c (iterator_group): Add "type" and "get_c_token" fields. (get_mode_token, get_code_token, get_int_token): New functions. (map_attr_string): Add an optional argument that passes back the associated iterator. (overloaded_name_hash, overloaded_name_eq_p, named_rtx_p): (md_reader::handle_overloaded_name, add_overload_instance): New functions. (apply_iterators): Handle '@' names. Report an error if '@' is used without iterators. (initialize_iterators): Initialize the new iterator_group fields. * genopinit.c (handle_overloaded_code_for) (handle_overloaded_gen): New functions. (main): Use them to print declarations of maybe_code_for_* and maybe_gen_* functions, and inline definitions of code_for_* and gen_*. * genemit.c (print_overload_arguments, print_overload_test) (handle_overloaded_code_for, handle_overloaded_gen): New functions. (main): Use it to print definitions of maybe_code_for_* and maybe_gen_* functions. * config/aarch64/aarch64.c (aarch64_split_128bit_move): Use gen_aarch64_mov{low,high}_di and gen_aarch64_movdi_{low,high} instead of explicit mode checks. (aarch64_split_simd_combine): Likewise gen_aarch64_simd_combine. (aarch64_split_simd_move): Likewise gen_aarch64_split_simd_mov. (aarch64_emit_load_exclusive): Likewise gen_aarch64_load_exclusive. (aarch64_emit_store_exclusive): Likewise gen_aarch64_store_exclusive. (aarch64_expand_compare_and_swap): Likewise gen_aarch64_compare_and_swap and gen_aarch64_compare_and_swap_lse (aarch64_gen_atomic_cas): Likewise gen_aarch64_atomic_cas. (aarch64_emit_atomic_swap): Likewise gen_aarch64_atomic_swp. (aarch64_constant_pool_reload_icode): Delete. (aarch64_secondary_reload): Use code_for_aarch64_reload_movcp instead of aarch64_constant_pool_reload_icode. Use code_for_aarch64_reload_mov instead of explicit mode checks. (rsqrte_type, get_rsqrte_type, rsqrts_type, get_rsqrts_type): Delete. (aarch64_emit_approx_sqrt): Use gen_aarch64_rsqrte instead of get_rsqrte_type and gen_aarch64_rsqrts instead of gen_rqrts_type. (recpe_type, get_recpe_type, recps_type, get_recps_type): Delete. (aarch64_emit_approx_div): Use gen_aarch64_frecpe instead of get_recpe_type and gen_aarch64_frecps instead of get_recps_type. (aarch64_atomic_load_op_code): Delete. (aarch64_emit_atomic_load_op): Likewise. (aarch64_gen_atomic_ldop): Use UNSPECV_ATOMIC_* instead of aarch64_atomic_load_op_code. Use gen_aarch64_atomic_load instead of aarch64_emit_atomic_load_op. * config/aarch64/aarch64.md (aarch64_reload_movcp<GPF_TF:mode><P:mode>) (aarch64_reload_movcp<VALL:mode><P:mode>, aarch64_reload_mov<mode>) (aarch64_movdi_<mode>low, aarch64_movdi_<mode>high) (aarch64_mov<mode>high_di, aarch64_mov<mode>low_di): Add a '@' character before the pattern name. * config/aarch64/aarch64-simd.md (aarch64_split_simd_mov<mode>) (aarch64_rsqrte<mode>, aarch64_rsqrts<mode>) (aarch64_simd_combine<mode>, aarch64_frecpe<mode>) (aarch64_frecps<mode>): Likewise. * config/aarch64/atomics.md (atomic_compare_and_swap<mode>) (aarch64_compare_and_swap<mode>, aarch64_compare_and_swap<mode>_lse) (aarch64_load_exclusive<mode>, aarch64_store_exclusive<mode>) (aarch64_atomic_swp<mode>, aarch64_atomic_cas<mode>) (aarch64_atomic_load<atomic_ldop><mode>): Likewise. From-SVN: r263251
2018-08-02[ARM] Fix PR85434: spilling of stack protector guard's address on ARMThomas Preud'homme1-8/+47
In case of high register pressure in PIC mode, address of the stack protector's guard can be spilled on ARM targets as shown in PR85434, thus allowing an attacker to control what the canary would be compared against. This is also known as CVE-2018-12886. ARM does lack stack_protect_set and stack_protect_test insn patterns, defining them does not help as the address is expanded regularly and the patterns only deal with the copy and test of the guard with the canary. This problem does not occur for x86 targets because the PIC access and the test can be done in the same instruction. Aarch64 is exempt too because PIC access insn pattern are mov of UNSPEC which prevents it from the second access in the epilogue being CSEd in cse_local pass with the first access in the prologue. The approach followed here is to create new "combined" set and test standard pattern names that take the unexpanded guard and do the set or test. This allows the target to use an opaque pattern (eg. using UNSPEC) to hide the individual instructions being generated to the compiler and split the pattern into generic load, compare and branch instruction after register allocator, therefore avoiding any spilling. This is here implemented for the ARM targets. For targets not implementing these new standard pattern names, the existing stack_protect_set and stack_protect_test pattern names are used. To be able to split PIC access after register allocation, the functions had to be augmented to force a new PIC register load and to control which register it loads into. This is because sharing the PIC register between prologue and epilogue could lead to spilling due to CSE again which an attacker could use to control what the canary gets compared against. 2018-08-02 Thomas Preud'homme <thomas.preudhomme@linaro.org> gcc/ PR target/85434 * target-insns.def (stack_protect_combined_set): Define new standard pattern name. (stack_protect_combined_test): Likewise. * cfgexpand.c (stack_protect_prologue): Try new stack_protect_combined_set pattern first. * function.c (stack_protect_epilogue): Try new stack_protect_combined_test pattern first. * config/arm/arm.c (require_pic_register): Add pic_reg and compute_now parameters to control which register to use as PIC register and force reloading PIC register respectively. Insert in the stream of insns if possible. (legitimize_pic_address): Expose above new parameters in prototype and adapt recursive calls accordingly. (arm_legitimize_address): Adapt to new legitimize_pic_address prototype. (thumb_legitimize_address): Likewise. (arm_emit_call_insn): Adapt to new require_pic_register prototype. * config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype change. * config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address prototype change. (stack_protect_combined_set): New insn_and_split pattern. (stack_protect_set): New insn pattern. (stack_protect_combined_test): New insn_and_split pattern. (stack_protect_test): New insn pattern. * config/arm/unspecs.md (UNSPEC_SP_SET): New unspec. (UNSPEC_SP_TEST): Likewise. * doc/md.texi (stack_protect_combined_set): Document new standard pattern name. (stack_protect_set): Clarify that the operand for guard's address is legal. (stack_protect_combined_test): Document new standard pattern name. (stack_protect_test): Clarify that the operand for guard's address is legal. gcc/testsuite/ PR target/85434 * gcc.target/arm/pr85434.c: New test. From-SVN: r263245
2018-07-31targhooks - provide an alternative hook for targets that never execute ↵Richard Earnshaw1-0/+5
speculatively This hook adds an alternative implementation for the target hook TARGET_HAVE_SPECULATION_SAFE_VALUE; it can be used by targets that have no CPU implementations that execute code speculatively. All that is needed for such targets now is to add: #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed. to where you have your other target hooks and you're done. gcc: * targhooks.h (speculation_safe_value_not_needed): New prototype. * targhooks.c (speculation_safe_value_not_needed): New function. * target.def (have_speculation_safe_value): Update documentation. * doc/tm.texi: Regenerated. From-SVN: r263175
2018-07-31AArch64 - new pass to add conditional-branch speculation trackingRichard Earnshaw1-1/+9
This patch is the main part of the speculation tracking code. It adds a new target-specific pass that is run just before the final branch reorg pass (so that it can clean up any new edge insertions we make). The pass is only run with -mtrack-speculation is passed on the command line. One thing that did come to light as part of this was that the stack pointer register was not being permitted in comparision instructions. We rely on that for moving the tracking state between SP and the scratch register at function call boundaries. * config/aarch64/aarch64-speculation.cc: New file. * config/aarch64/aarch64-passes.def (pass_track_speculation): Add before pass_reorder_blocks. * config/aarch64/aarch64-protos.h (make_pass_track_speculation): Add prototype. * config/aarch64/aarch64.c (aarch64_conditional_register_usage): Fix X14 and X15 when tracking speculation. * config/aarch64/aarch64.md (register name constants): Add SPECULATION_TRACKER_REGNUM and SPECULATION_SCRATCH_REGNUM. (unspec): Add UNSPEC_SPECULATION_TRACKER. (speculation_barrier): New insn attribute. (cmp<mode>): Allow SP in comparisons. (speculation_tracker): New insn. (speculation_barrier): Add speculation_barrier attribute. * config/aarch64/t-aarch64: Add make rule for aarch64-speculation.o. * config.gcc (aarch64*-*-*): Add aarch64-speculation.o to extra_objs. * doc/invoke.texi (AArch64 Options): Document -mtrack-speculation. From-SVN: r263173
2018-07-31Add __builtin_speculation_safe_valueRichard Earnshaw5-0/+145
This patch defines a new intrinsic function __builtin_speculation_safe_value. A generic default implementation is defined which will attempt to use the backend pattern "speculation_safe_barrier". If this pattern is not defined, or if it is not available, then the compiler will emit a warning, but compilation will continue. Note that the test spec-barrier-1.c will currently fail on all targets. This is deliberate, the failure will go away when appropriate action is taken for each target backend. gcc: * builtin-types.def (BT_FN_PTR_PTR_VAR): New function type. (BT_FN_I1_I1_VAR, BT_FN_I2_I2_VAR, BT_FN_I4_I4_VAR): Likewise. (BT_FN_I8_I8_VAR, BT_FN_I16_I16_VAR): Likewise. * builtin-attrs.def (ATTR_NOVOPS_NOTHROW_LEAF_LIST): New attribute list. * builtins.def (BUILT_IN_SPECULATION_SAFE_VALUE_N): New builtin. (BUILT_IN_SPECULATION_SAFE_VALUE_PTR): New internal builtin. (BUILT_IN_SPECULATION_SAFE_VALUE_1): Likewise. (BUILT_IN_SPECULATION_SAFE_VALUE_2): Likewise. (BUILT_IN_SPECULATION_SAFE_VALUE_4): Likewise. (BUILT_IN_SPECULATION_SAFE_VALUE_8): Likewise. (BUILT_IN_SPECULATION_SAFE_VALUE_16): Likewise. * builtins.c (expand_speculation_safe_value): New function. (expand_builtin): Call it. * doc/cpp.texi: Document predefine __HAVE_SPECULATION_SAFE_VALUE. * doc/extend.texi: Document __builtin_speculation_safe_value. * doc/md.texi: Document "speculation_barrier" pattern. * doc/tm.texi.in: Pull in TARGET_SPECULATION_SAFE_VALUE and TARGET_HAVE_SPECULATION_SAFE_VALUE. * doc/tm.texi: Regenerated. * target.def (have_speculation_safe_value, speculation_safe_value): New hooks. * targhooks.c (default_have_speculation_safe_value): New function. (default_speculation_safe_value): New function. * targhooks.h (default_have_speculation_safe_value): Add prototype. (default_speculation_safe_value): Add prototype. c-family: * c-common.c (speculation_safe_resolve_call): New function. (speculation_safe_resolve_params): New function. (speculation_safe_resolve_return): New function. (resolve_overloaded_builtin): Handle __builtin_speculation_safe_value. * c-cppbuiltin.c (c_cpp_builtins): Add pre-define for __HAVE_SPECULATION_SAFE_VALUE. testsuite: * c-c++-common/spec-barrier-1.c: New test. * c-c++-common/spec-barrier-2.c: New test. * gcc.dg/spec-barrier-3.c: New test. From-SVN: r263168
2018-07-31Add support for -nolibcOlivier Hainque1-3/+16
2018-06-07 Olivier Hainque <hainque@adacore.com> * common.opt (nolibc): New option. * doc/invoke.texi (Link Options): Document it. * gcc.c (LINK_GCC_C_SEQUENCE_SPEC): Honor nolibc. * config/alpha/linux.h: Likewise. * config/arc/elf.h: Likewise. * config/arm/uclinux-elf.h: Likewise. * config/arm/unknown-elf.h: Likewise. * config/avr/avrlibc.h: Likewise. * config/bfin/bfin.h: Likewise. * config/bfin/linux.h: Likewise. * config/bfin/uclinux.h: Likewise. * config/darwin.h: Likewise. * config/darwin10.h: Likewise. * config/darwin12.h: Likewise. * config/gnu-user.h: Likewise. * config/lm32/uclinux-elf.h: Likewise. * config/pa/pa-hpux11.h: Likewise. * config/pa/pa64-hpux.h: Likewise. * config/sparc/sparc.h: Likewise. From-SVN: r263083
2018-07-30doc: discourage const/volatile on register variables (PR 86673)Alexander Monakov1-0/+11
PR target/86673 * doc/extend.texi (Global Register Variables): Discourage use of type qualifiers. (Local Register Variables): Likewise. From-SVN: r263065
2018-07-27extend.texi (Basic PowerPC Built-in Functions Available on ISA 2.05): ↵Kelvin Nilsen1-45/+45
Replace __uint128_t with __uint128 and __int128_t with __int128 in built-in... gcc/ChangeLog: 2018-07-27 Kelvin Nilsen <kelvin@gcc.gnu.org> * doc/extend.texi (Basic PowerPC Built-in Functions Available on ISA 2.05): Replace __uint128_t with __uint128 and __int128_t with __int128 in built-in function prototypes. (PowerPC AltiVec Built-in Functions on ISA 2.07): Likewise. (PowerPC AltiVec Built-in Functions on ISA 3.0): Likewise. From-SVN: r263033
2018-07-22* doc/gcov.texi (Invoking Gcov): Editorial changes.Gerald Pfeifer1-3/+3
From-SVN: r262922
2018-07-20PR middle-end/82063 - issues with arguments enabled by -WallMartin Sebor2-54/+152
gcc/ada/ChangeLog: PR middle-end/82063 * gcc-interface/misc.c (gnat_handle_option): Change function argument to HOST_WIDE_INT. gcc/brig/ChangeLog: PR middle-end/82063 * brig/brig-lang.c (brig_langhook_handle_option): Change function argument to HOST_WIDE_INT. gcc/c-family/ChangeLog: PR middle-end/82063 * c-common.h (c_common_handle_option): Change function argument to HOST_WIDE_INT. * c-opts.c (c_common_init_options): Same. (c_common_handle_option): Same. Remove special handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * c.opt (-Walloc-size-larger-than, -Walloca-larger-than): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. (-Wvla-larger-than): Same. (-Wno-alloc-size-larger-than, -Wno-alloca-larger-than): New. (-Wno-vla-larger-than): Same. gcc/fortran/ChangeLog: PR middle-end/82063 * gfortran.h (gfc_handle_option): Change function argument to HOST_WIDE_INT. * options.c (gfc_handle_option): Same. gcc/go/ChangeLog: PR middle-end/82063 * go-lang.c (go_langhook_handle_option): Change function argument to HOST_WIDE_INT. gcc/lto/ChangeLog: PR middle-end/82063 * lto-lang.c (lto_handle_option): Change function argument to HOST_WIDE_INT. gcc/testsuite/ChangeLog: PR middle-end/82063 * gcc/testsuite/c-c++-common/pr68657-1.c: Adjust. * gcc/testsuite/c-c++-common/pr68657-2.c: Same. * gcc/testsuite/c-c++-common/pr68657-3.c: Same. * gcc.dg/Walloc-size-larger-than-16.c: Same. * gcc.dg/Walloca-larger-than.c: New test. * gcc.dg/Walloca-larger-than-2.c: New test. * gcc.dg/Wframe-larger-than-2.c: New test. * gcc.dg/Wlarger-than3.c: New test. * gcc.dg/Wvla-larger-than-3.c: New test. * gcc.dg/pr42611.c: Adjust. * gnat.dg/frame_overflow.adb: Same. gcc/ChangeLog: PR middle-end/82063 * builtins.c (expand_builtin_alloca): Adjust. * calls.c (alloc_max_size): Simplify. * cgraphunit.c (cgraph_node::expand): Adjust. * common.opt (larger_than_size, warn_frame_larger_than): Remove variables. (frame_larger_than_size): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. * doc/invoke.texi (GCC Command Options): Document option arguments. Explain byte-size arguments and suffixes. (-Wvla-larger-than, -Wno-alloc-size-larger-than): Update. (-Wno-alloca-larger-than, -Wno-vla-larger-than): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Same. * doc/options.texi (UInteger): Expand. (Host_Wide_Int, ByteSize): Document new properties. * final.c (final_start_function_1): Include sizes in an error message. * function.c (frame_offset_overflow): Same. * gimple-ssa-warn-alloca.c (pass_walloca::gate): Adjust. (alloca_call_type_by_arg): Change function argument to HOST_WIDE_INT. Diagnose unbounded alloca calls only for limits of less than PTRDIFF_MAX. (alloca_call_type): Adjust. Diagnose possibly out-of-bounds alloca calls and VLA size only for limits of less than PTRDIFF_MAX. Same for alloca(0). (pass_walloca::execute): Adjust. Diagnose alloca calls in loops only for limits of less than PTRDIFF_MAX. * langhooks-def.h (lhd_handle_option): Change function argument to HOST_WIDE_INT. * langhooks.c (lhd_handle_option): Same. * langhooks.h (handle_option): Same. * opt-functions.awk (switch_bit_fields): Handle Host_Wide_Int and ByteSize flags. (var_type, var_type_struct): Same. (var_set): Handle ByteSize flag. * optc-gen.awk: Add comments to output to ease debugging. Make use of HOST_WIDE_INT where appropriate. * opts-gen-save.awk: Use %lx to format unsigned long. * opth-gen.awk: Change function argument to HOST_WIDE_INT. * opts-common.c (integral_argument): Return HOST_WIDE_INT and add arguments. Parse bytes-size suffixes. (enum_arg_to_value): Change function argument to HOST_WIDE_INT. (enum_value_to_arg): Same. (decode_cmdline_option): Handle cl_host_wide_int. Adjust. (handle_option): Adjust. (generate_option): Change function argument to HOST_WIDE_INT. (cmdline_handle_error): Adjust. (read_cmdline_option): Change function argument to HOST_WIDE_INT. (set_option): Change function argument to HOST_WIDE_INT. (option_enabled): Handle cl_host_wide_int. (get_option_state): Handle CLVC_SIZE. (control_warning_option): Same. * opts.c (common_handle_option): Change function argument to HOST_WIDE_INT. Remove handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * opts.h (enum cl_var_type): Add an enumerator. * stor-layout.c (layout_decl): Print a more meaningful warning. * toplev.c (output_stack_usage): Adjust. From-SVN: r262910
2018-07-20Add "-fsave-optimization-record"David Malcolm1-1/+47
This patch implements a -fsave-optimization-record option, which leads to a JSON file being written out, recording the dump_* calls made (via the optinfo infrastructure). The patch includes a minimal version of the JSON patch I posted last year, with just enough support needed for optimization records (I removed all of the parser code, leaving just the code for building in-memory JSON trees and writing them to a pretty_printer). gcc/ChangeLog: * Makefile.in (OBJS): Add json.o and optinfo-emit-json.o. (CFLAGS-optinfo-emit-json.o): Define TARGET_NAME. * common.opt (fsave-optimization-record): New option. * coretypes.h (struct kv_pair): Move here from dumpfile.c. * doc/invoke.texi (-fsave-optimization-record): New option. * dumpfile.c: Include "optinfo-emit-json.h". (struct kv_pair): Move to coretypes.h. (optgroup_options): Make non-static. (dump_context::end_scope): Call optimization_records_maybe_pop_dump_scope. * dumpfile.h (optgroup_options): New decl. * json.cc: New file. * json.h: New file. * optinfo-emit-json.cc: New file. * optinfo-emit-json.h: New file. * optinfo.cc: Include "optinfo-emit-json.h". (optinfo::emit): Call optimization_records_maybe_record_optinfo. (optinfo_enabled_p): Check optimization_records_enabled_p. (optinfo_wants_inlining_info_p): Likewise. * optinfo.h: Update comment. * profile-count.c (profile_quality_as_string): New function. * profile-count.h (profile_quality_as_string): New decl. (profile_count::quality): New accessor. * selftest-run-tests.c (selftest::run_tests): Call json_cc_tests and optinfo_emit_json_cc_tests. * selftest.h (selftest::json_cc_tests): New decl. (selftest::optinfo_emit_json_cc_tests): New decl. * toplev.c: Include "optinfo-emit-json.h". (compile_file): Call optimization_records_finish. (do_compile): Call optimization_records_start. * tree-ssa-live.c: Include optinfo.h. (remove_unused_scope_block_p): Retain inlining information if optinfo_wants_inlining_info_p returns true. From-SVN: r262905
2018-07-19[PATCH, GCC, AARCH64] Add support for +profile extensionAndre Vieira1-0/+3
This patch adds support for the Statistical Profiling Extension (SPE) on AArch64. Even though the compiler will not generate code any differently given this extension, it will need to pass it on to the assembler in order to let it correctly assemble inline asm containing accesses to the extension's system registers. The same applies when using the preprocessor on an assembly file as this first must pass through cc1. I left the hwcaps string for SPE empty as the kernel does not define a feature string for this extension. The current effect of this is that driver will disable profile feature bit in GCC. This is OK though because we don't, nor do we ever, enable this feature bit, as codegen is not affect by the SPE support and more importantly the driver will still pass the extension down to the assembler regardless. gcc/ChangeLog 2018-07-19 Andre Vieira <andre.simoesdiasvieira@arm.com> * config/aarch64/aarch64-option-extensions.def: New entry for profile extension. * config/aarch64/aarch64.h (AARCH64_FL_PROFILE): New. * doc/invoke.texi (aarch64-feature-modifiers): New entry for profile extension. gcc/testsuite/ChangeLog 2018-07-19 Andre Vieira <andre.simoesdiasvieira@arm.com> * gcc.target/aarch64/profile.c: New test. From-SVN: r262882
2018-07-19i386: Change indirect_return to function type attributeH.J. Lu1-2/+3
In struct ucontext; typedef struct ucontext ucontext_t; extern int (*bar) (ucontext_t *__restrict __oucp, const ucontext_t *__restrict __ucp) __attribute__((__indirect_return__)); extern int res; void foo (ucontext_t *oucp, ucontext_t *ucp) { res = bar (oucp, ucp); } bar() may return via indirect branch. This patch changes indirect_return to type attribute to allow indirect_return attribute on variable or type of function pointer so that ENDBR can be inserted after call to bar(). gcc/ PR target/86560 * config/i386/i386.c (rest_of_insert_endbranch): Lookup indirect_return as function type attribute. (ix86_attribute_table): Change indirect_return to function type attribute. * doc/extend.texi: Update indirect_return attribute. gcc/testsuite/ PR target/86560 * gcc.target/i386/pr86560-1.c: New test. * gcc.target/i386/pr86560-2.c: Likewise. * gcc.target/i386/pr86560-3.c: Likewise. From-SVN: r262877
2018-07-18extend.texi (PowerPC AltiVec Built-in Functions): Rename this subsection to ↵Kelvin Nilsen1-54/+74
"PowerPC AltiVec/VSX Built-in Functions". gcc/ChangeLog: 2018-07-18 Kelvin Nilsen <kelvin@gcc.gnu.org> * doc/extend.texi (PowerPC AltiVec Built-in Functions): Rename this subsection to "PowerPC AltiVec/VSX Built-in Functions". (PowerPC AltiVec/VSX Built-in Functions): New name for subsection previously known as "PowerPC AltiVec Built-in Functions". Move some material to new subsubsections "PowerPC AltiVec Built-in Functions on ISA 2.06" and "PowerPC AltiVec Built-in Functions on ISA 2.07". (PowerPC Altivec Built-in Functions on ISA 2.05): New subsubsection. (PowerPC Altivec Built-in Functions on ISA 2.06): Likewise. (PowerPC Altivec Built-in Functions on ISA 2.07): Likewise. (PowerPC Altivec Built-in Functions on ISA 3.0): Likewise. From-SVN: r262863
2018-07-17Clean up of new format of -falign-FOO.Martin Liska2-32/+0
2018-07-17 Martin Liska <mliska@suse.cz> * align.h: New file. * config/alpha/alpha.c (alpha_align_insns_1): Use align_functions directly. * config/i386/i386.c (ix86_avoid_jump_mispredicts): Use new return type align_flags of label_to_alignment. * config/m32r/m32r.h (LOOP_ALIGN): Wrap returned values into align_flags class. * config/m68k/m68k.c: Do not use removed align_labels_value and align_loops_value. * config/nds32/nds32.h (JUMP_ALIGN): Wrap result into align_flags class. (LOOP_ALIGN): Likewise. (LABEL_ALIGN): Likewise. * config/powerpcspe/powerpcspe.c (TARGET_ASM_LOOP_ALIGN_MAX_SKIP): Remove not used macro. (rs6000_loop_align): Change return type to align_flags. (rs6000_loop_align_max_skip): Remove. * config/rs6000/rs6000-protos.h (rs6000_loop_align): Change return type to align_flags. * config/rs6000/rs6000.c (TARGET_ASM_LOOP_ALIGN_MAX_SKIP): Remove not used macro. (rs6000_loop_align): Change return type to align_flags. (rs6000_loop_align_max_skip): Remove. * config/rx/rx.h (JUMP_ALIGN): Wrap integer values * config/rx/rx-protos.h (rx_align_for_label): Make it static function. * config/rx/rx.c (rx_align_for_label): Change return type to align_flags. (rx_max_skip_for_label): Remove TARGET_ASM_*_ALIGN_MAX_SKIP macro definitions. into align_flags class. (LABEL_ALIGN): Likewise. (LOOP_ALIGN): Likewise. * config/s390/s390.c (s390_label_align): Use align_flags class member. (s390_asm_output_function_label): Likewise. * config/sh/sh.c (sh_override_options_after_change): Use align_flags class directly without macros. (find_barrier): Likewise. (barrier_align): Likewise. (sh_loop_align): Likewise. * config/spu/spu.c (spu_option_override): Use align_flags_tuple::get_value instead of removed macros. (spu_sched_init): Likewise. * config/spu/spu.h (GTY): Likewise. * config/visium/visium.c (visium_option_override): Set "8" as default secondary alignment. * config/visium/visium.h (SUBALIGN_LOG): Define to 3 in order to guarantee secondary alignment of 8. * coretypes.h: Include align.h header file. * doc/tm.texi: Remove TARGET_ASM_JUMP_ALIGN_MAX_SKIP, TARGET_ASM_LOOP_ALIGN_MAX_SKIP, TARGET_ASM_LABEL_ALIGN_MAX_SKIP and TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP macros. * doc/tm.texi.in: Likewise. * final.c (struct label_alignment): Remove not used structure. (LABEL_ALIGN): Change type to align_flags. (LOOP_ALIGN): Likewise. (JUMP_ALIGN): Likewise. (default_loop_align_max_skip): Remove. (default_label_align_max_skip): Likewise. (default_jump_align_max_skip): Likewise. (default_label_align_after_barrier_max_skip): (LABEL_TO_ALIGNMENT): Change to access label_align vector. (LABEL_TO_MAX_SKIP): Remove. (label_to_alignment): Return align_flags type instead of integer. (label_to_max_skip): Remove. (align_fuzz): Use align_flags type. (compute_alignments): Use align_flags type and use align_flags::max to combine multiple alignments. (grow_label_align): Grow vec instead of C array. (update_alignments): Assign just LABEL_TO_ALIGNMENT. (shorten_branches): Use align_flags type and use align_flags::max to combine multiple alignments. (final_scan_insn_1): Remove usage of secondary alignment that comes from label alignment, but instead use proper secondary alignment which is computed in grow_label_align. * flags.h (struct align_flags_tuple): Move to align.h. (struct align_flags): Likewise. (state_align_loops): Rename to align_loops. (state_align_jumps): Rename to align_jumps. (state_align_labels): Rename to align_labels. (state_align_functions): Rename to align_functions. (align_loops_log): Remove. (align_jumps_log): Remove. (align_labels_log): Remove. (align_functions_log): Remove. (align_loops_max_skip): Remove. (align_jumps_max_skip): Remove. (align_labels_max_skip): Remove. (align_functions_max_skip): Remove. (align_loops_value): Remove. (align_jumps_value): Remove. (align_labels_value): Remove. (align_functions_value): Remove. * output.h (label_to_alignment): Change return type to align_flags. (label_to_max_skip): Remove. * target.def: Remove loop_align_max_skip, label_align_max_skip, jump_align_max_skip macros. * targhooks.h (default_loop_align_max_skip): Remove. (default_label_align_max_skip): Likewise. (default_jump_align_max_skip): Likewise. (default_label_align_after_barrier_max_skip): Remove. * toplev.c (read_log_maxskip): Use ::normalize function. (parse_N_M): Remove not used argument and also call ::normalize. (parse_alignment_opts): Do not pass unused arguments. * varasm.c (assemble_start_function): Use directly align_functions instead of removed macros. * system.h: Do not poison removed macros. 2018-07-17 Martin Liska <mliska@suse.cz> * gcc.target/powerpc/loop_align.c: Update scanned pattern. From-SVN: r262804
2018-07-16extend.texi (PowerPC AltiVec Built-in Functions): Alphabetize prototypes of ↵Kelvin Nilsen1-756/+785
built-in functions... gcc/ChangeLog: 2018-07-16 Kelvin Nilsen <kelvin@gcc.gnu.org> * doc/extend.texi (PowerPC AltiVec Built-in Functions): Alphabetize prototypes of built-in functions, separating out built-in functions that are listed in this section but should be described elsewhere. From-SVN: r262737
2018-07-133nd Patch for PR78009Qing Zhao1-0/+5
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809 Inline strcmp with small constant strings The design doc for PR78809 is at: https://www.mail-archive.com/gcc@gcc.gnu.org/msg83822.html this patch is for the third part of change of PR78809. C. for strcmp (s1, s2), strncmp (s1, s2, n), and memcmp (s1, s2, n) if the result is NOT used to do simple equality test against zero, one of "s1" or "s2" is a small constant string, n is a constant, and the Min value of the length of the constant string and "n" is smaller than a predefined threshold T, inline the call by a byte-to-byte comparision sequence to avoid calling overhead. adding test case strcmpopt_5.c into gcc.dg for part C of PR78809. adding test case strcmpopt_6.c into gcc.dg to test the following case: When the specified length exceeds one of the arguments of the call to memcmp, the call to memcmp should NOT be inlined. From-SVN: r262636
2018-07-12rtl.texi (REG_NONNEG): Remove decrement and branch until zero reference, add ↵Paul Koning2-82/+66
doloop_end instead. * doc/rtl.texi (REG_NONNEG): Remove decrement and branch until zero reference, add doloop_end instead. * doc/md.texi (decrement_and_branch_until_zero): Remove. (Looping patterns): Remove decrement_and_branch_until_zero. Add detail for doloop_end. From-SVN: r262603
2018-07-12Add IFN_COND_FMA functionsRichard Sandiford1-0/+17
This patch adds conditional equivalents of the IFN_FMA built-in functions. Most of it is just a mechanical extension of the binary stuff. 2018-07-12 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * doc/md.texi (cond_fma, cond_fms, cond_fnma, cond_fnms): Document. * optabs.def (cond_fma_optab, cond_fms_optab, cond_fnma_optab) (cond_fnms_optab): New optabs. * internal-fn.def (COND_FMA, COND_FMS, COND_FNMA, COND_FNMS): New internal functions. (FMA): Use DEF_INTERNAL_FLT_FN rather than DEF_INTERNAL_FLT_FLOATN_FN. * internal-fn.h (get_conditional_internal_fn): Declare. (get_unconditional_internal_fn): Likewise. * internal-fn.c (cond_ternary_direct): New macro. (expand_cond_ternary_optab_fn): Likewise. (direct_cond_ternary_optab_supported_p): Likewise. (FOR_EACH_COND_FN_PAIR): Likewise. (get_conditional_internal_fn): New function. (get_unconditional_internal_fn): Likewise. * gimple-match.h (gimple_match_op::MAX_NUM_OPS): Bump to 5. (gimple_match_op::gimple_match_op): Add a new overload for 5 operands. (gimple_match_op::set_op): Likewise. (gimple_resimplify5): Declare. * genmatch.c (decision_tree::gen): Generate simplifications for 5 operands. * gimple-match-head.c (gimple_simplify): Define an overload for 5 operands. Handle calls with 5 arguments in the top-level overload. (convert_conditional_op): Handle conversions from unconditional internal functions to conditional ones. (gimple_resimplify5): New function. (build_call_internal): Pass a fifth operand. (maybe_push_res_to_seq): Likewise. (try_conditional_simplification): Try converting conditional internal functions to unconditional internal functions. Handle 3-operand unconditional forms. * match.pd (UNCOND_TERNARY, COND_TERNARY): Operator lists. Define ternary equivalents of the current rules for binary conditional internal functions. * config/aarch64/aarch64.c (aarch64_preferred_else_value): Handle ternary operations. * config/aarch64/iterators.md (UNSPEC_COND_FMLA, UNSPEC_COND_FMLS) (UNSPEC_COND_FNMLA, UNSPEC_COND_FNMLS): New unspecs. (optab): Handle them. (SVE_COND_FP_TERNARY): New int iterator. (sve_fmla_op, sve_fmad_op): New int attributes. * config/aarch64/aarch64-sve.md (cond_<optab><mode>) (*cond_<optab><mode>_2, *cond_<optab><mode_4) (*cond_<optab><mode>_any): New SVE_COND_FP_TERNARY patterns. gcc/testsuite/ * gcc.dg/vect/vect-cond-arith-3.c: New test. * gcc.target/aarch64/sve/vcond_13.c: Likewise. * gcc.target/aarch64/sve/vcond_13_run.c: Likewise. * gcc.target/aarch64/sve/vcond_14.c: Likewise. * gcc.target/aarch64/sve/vcond_14_run.c: Likewise. * gcc.target/aarch64/sve/vcond_15.c: Likewise. * gcc.target/aarch64/sve/vcond_15_run.c: Likewise. * gcc.target/aarch64/sve/vcond_16.c: Likewise. * gcc.target/aarch64/sve/vcond_16_run.c: Likewise. From-SVN: r262587
2018-07-12Extend tree code folds to IFN_COND_*Richard Sandiford2-0/+18
This patch adds match.pd support for applying normal folds to their IFN_COND_* forms. E.g. the rule: (plus @0 (negate @1)) -> (minus @0 @1) also allows the fold: (IFN_COND_ADD @0 @1 (negate @2) @3) -> (IFN_COND_SUB @0 @1 @2 @3) Actually doing this by direct matches in gimple-match.c would probably lead to combinatorial explosion, so instead, the patch makes gimple_match_op carry a condition under which the operation happens ("cond"), and the value to use when the condition is false ("else_value"). Thus in the example above we'd do the following (a) convert: cond:NULL_TREE (IFN_COND_ADD @0 @1 @4 @3) else_value:NULL_TREE to: cond:@0 (plus @1 @4) else_value:@3 (b) apply gimple_resimplify to (plus @1 @4) (c) reintroduce cond and else_value when constructing the result. Nested operations inherit the condition of the outer operation (so that we don't introduce extra faults) but have a null else_value. If we try to build such an operation, the target gets to choose what else_value it can handle efficiently: obvious choices include one of the operands or a zero constant. (The alternative would be to have some representation for an undefined value, but that seems a bit invasive, and isn't likely to be useful here.) I've made the condition a mandatory part of the gimple_match_op constructor so that it doesn't accidentally get dropped. 2018-07-12 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * target.def (preferred_else_value): New target hook. * doc/tm.texi.in (TARGET_PREFERRED_ELSE_VALUE): New hook. * doc/tm.texi: Regenerate. * targhooks.h (default_preferred_else_value): Declare. * targhooks.c (default_preferred_else_value): New function. * internal-fn.h (conditional_internal_fn_code): Declare. * internal-fn.c (FOR_EACH_CODE_MAPPING): New macro. (get_conditional_internal_fn): Use it. (conditional_internal_fn_code): New function. * gimple-match.h (gimple_match_cond): New struct. (gimple_match_op): Add a cond member function. (gimple_match_op::gimple_match_op): Update all forms to take a gimple_match_cond. * genmatch.c (expr::gen_transform): Use the same condition as res_op for the suboperation, but don't specify a particular else_value. * tree-ssa-sccvn.c (vn_nary_simplify, vn_reference_lookup_3) (visit_nary_op, visit_reference_op_load): Pass gimple_match_cond::UNCOND to the gimple_match_op constructor. * gimple-match-head.c: Include tree-eh.h (convert_conditional_op): New function. (maybe_resimplify_conditional_op): Likewise. (gimple_resimplify1): Call maybe_resimplify_conditional_op. (gimple_resimplify2): Likewise. (gimple_resimplify3): Likewise. (gimple_resimplify4): Likewise. (maybe_push_res_to_seq): Return null for conditional operations. (try_conditional_simplification): New function. (gimple_simplify): Call it. Pass conditions to the gimple_match_op constructor. * match.pd: Fold VEC_COND_EXPRs of an IFN_COND_* call to a new IFN_COND_* call. * config/aarch64/aarch64.c (aarch64_preferred_else_value): New function. (TARGET_PREFERRED_ELSE_VALUE): Redefine. gcc/testsuite/ * gcc.dg/vect/vect-cond-arith-2.c: New test. * gcc.target/aarch64/sve/loop_add_6.c: Likewise. From-SVN: r262586
2018-07-11md.texi (define_subst): Document how multiple occurrences of the same ↵Paul Koning1-1/+5
argument in the replacement... * doc/md.texi (define_subst): Document how multiple occurrences of the same argument in the replacement pattern are handled. From-SVN: r262562
2018-07-11Add documentation for "mode" attribute for types.Paul Koning1-13/+26
* doc/extend.texi (Common Variable Attributes): Move "mode" into alphabetical order. (Common Type Attributes): Add "mode" attribute. From-SVN: r262561
2018-07-06re PR target/86324 (testsuite test divkc3-1.c FAILs when compiling with ↵Peter Bergner2-0/+10
-mabi=ieeelongdouble) gcc/ PR target/86324 * target.def (translate_mode_attribute): New hook. * targhooks.h (default_translate_mode_attribute): Declare. * targhooks.c (default_translate_mode_attribute): New function. * doc/tm.texi.in (TARGET_TRANSLATE_MODE_ATTRIBUTE): New hook. * doc/tm.texi: Regenerate. * config/rs6000/rs6000.c (TARGET_TRANSLATE_MODE_ATTRIBUTE): Define. (rs6000_translate_mode_attribute): New function. gcc/c-family/ PR target/86324 * c-attribs.c (handle_mode_attribute): Call new translate_mode_attribute target hook. gcc/testsuite/ PR target/86324 gcc.target/powerpc/pr86324-1.c: New test. gcc.target/powerpc/pr86324-2.c: Likewise. From-SVN: r262484
2018-07-06Update internal documentation to describe that DONE and FAILPaul Koning1-0/+51
also apply to define_split and define_peephole2. * doc/md.texi (define_split): Document DONE and FAIL. (define_peephole2): Ditto. From-SVN: r262479