From e55c5e24b97ad8ddc44588da18e894c139e02c0a Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Wed, 16 Mar 2022 08:25:54 -0400 Subject: c++: fold calls to std::move/forward [PR96780] A well-formed call to std::move/forward is equivalent to a cast, but the former being a function call means the compiler generates debug info, which persists even after the call gets inlined, for an operation that's never interesting to debug. This patch addresses this problem by folding calls to std::move/forward and other cast-like functions into simple casts as part of the frontend's general expression folding routine. This behavior is controlled by a new flag -ffold-simple-inlines, and otherwise by -fno-inline, so that users can enable this folding with -O0 (which implies -fno-inline). After this patch with -O2 and a non-checking compiler, debug info size for some testcases from range-v3 and cmcstl2 decreases by as much as ~10% and overall compile time and memory usage decreases by ~2%. PR c++/96780 gcc/ChangeLog: * doc/invoke.texi (C++ Dialect Options): Document -ffold-simple-inlines. gcc/c-family/ChangeLog: * c.opt: Add -ffold-simple-inlines. gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold) : Fold calls to std::move/forward and other cast-like functions into simple casts. gcc/testsuite/ChangeLog: * g++.dg/opt/pr96780.C: New test. --- gcc/doc/invoke.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2a14e1a..d65979b 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3124,6 +3124,16 @@ On targets that support symbol aliases, the default is @option{-fextern-tls-init}. On targets that do not support symbol aliases, the default is @option{-fno-extern-tls-init}. +@item -ffold-simple-inlines +@itemx -fno-fold-simple-inlines +@opindex ffold-simple-inlines +@opindex fno-fold-simple-inlines +Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward}, +@code{std::addressof} and @code{std::as_const}. In contrast to inlining, this +means no debug information will be generated for such calls. Since these +functions are rarely interesting to debug, this flag is enabled by default +unless @option{-fno-inline} is active. + @item -fno-gnu-keywords @opindex fno-gnu-keywords @opindex fgnu-keywords -- cgit v1.1 From 16fe6e8c9787a3be47bee3dbf094d22a5691c190 Mon Sep 17 00:00:00 2001 From: "Cui,Lili" Date: Thu, 17 Mar 2022 14:34:49 +0800 Subject: x86: Correct march=sapphirerapids to base on icelake server march=sapphirerapids should be based on icelake server not cooperlake. gcc/ChangeLog: PR target/104963 * config/i386/i386.h (PTA_SAPPHIRERAPIDS): change it to base on ICX. * doc/invoke.texi: Update documents for Intel sapphirerapids. gcc/testsuite/ChangeLog: PR target/104963 * gcc.target/i386/pr104963.c: New test case. --- gcc/doc/invoke.texi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d65979b..e3f2e82 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -31288,11 +31288,12 @@ AVX512VP2INTERSECT and KEYLOCKER instruction set support. Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, -AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, -AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16 MOVDIRI, MOVDIR64B, -AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, -UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI and AVX512FP16 instruction set -support. +AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, +AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2 +VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, +MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, +SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16 +and AVX512BF16 instruction set support. @item alderlake Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, -- cgit v1.1 From 3f18553eb7dabc6528d712e54b25ea6f96e51bde Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 21 Mar 2022 10:46:57 +0100 Subject: docs: Document min-pagesize parameter. gcc/ChangeLog: * doc/invoke.texi: Document min-pagesize parameter. --- gcc/doc/invoke.texi | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e3f2e82..4da4a11 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -15132,6 +15132,9 @@ when evaluating outgoing edge ranges. @item relation-block-limit Maximum number of relations the oracle will register in a basic block. +@item min-pagesize +Minimum page size for warning purposes. + @item openacc-kernels Specify mode of OpenACC `kernels' constructs handling. With @option{--param=openacc-kernels=decompose}, OpenACC `kernels' -- cgit v1.1 From 319ba7e241e7e21f9eb481f075310796f13d2035 Mon Sep 17 00:00:00 2001 From: Avinash Sonawane Date: Tue, 22 Mar 2022 07:32:44 +0530 Subject: Docs: Document that taint analyzer checker disables some warnings [PR103533] gcc/ChangeLog: PR analyzer/103533 * doc/invoke.texi: Document that enabling taint analyzer checker disables some warnings from `-fanalyzer`. Signed-off-by: Avinash Sonawane --- gcc/doc/invoke.texi | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4da4a11..8b16b35 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -421,14 +421,13 @@ Objective-C and Objective-C++ Dialects}. -fanalyzer-checker=@var{name} @gol -fno-analyzer-feasibility @gol -fanalyzer-fine-grained @gol --fanalyzer-state-merge @gol --fanalyzer-state-purge @gol +-fno-analyzer-state-merge @gol +-fno-analyzer-state-purge @gol -fanalyzer-transitivity @gol -fanalyzer-verbose-edges @gol -fanalyzer-verbose-state-changes @gol -fanalyzer-verbosity=@var{level} @gol -fdump-analyzer @gol --fdump-analyzer-stderr @gol -fdump-analyzer-callgraph @gol -fdump-analyzer-exploded-graph @gol -fdump-analyzer-exploded-nodes @gol @@ -438,6 +437,7 @@ Objective-C and Objective-C++ Dialects}. -fdump-analyzer-feasibility @gol -fdump-analyzer-json @gol -fdump-analyzer-state-purge @gol +-fdump-analyzer-stderr @gol -fdump-analyzer-supergraph @gol -Wno-analyzer-double-fclose @gol -Wno-analyzer-double-free @gol @@ -9659,22 +9659,24 @@ Enabling this option effectively enables the following warnings: -Wanalyzer-free-of-non-heap @gol -Wanalyzer-malloc-leak @gol -Wanalyzer-mismatching-deallocation @gol --Wanalyzer-possible-null-argument @gol --Wanalyzer-possible-null-dereference @gol -Wanalyzer-null-argument @gol -Wanalyzer-null-dereference @gol +-Wanalyzer-possible-null-argument @gol +-Wanalyzer-possible-null-dereference @gol -Wanalyzer-shift-count-negative @gol -Wanalyzer-shift-count-overflow @gol -Wanalyzer-stale-setjmp-buffer @gol +@ignore -Wanalyzer-tainted-allocation-size @gol -Wanalyzer-tainted-array-index @gol -Wanalyzer-tainted-divisor @gol -Wanalyzer-tainted-offset @gol -Wanalyzer-tainted-size @gol +@end ignore -Wanalyzer-unsafe-call-within-signal-handler @gol -Wanalyzer-use-after-free @gol --Wanalyzer-use-of-uninitialized-value @gol -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol +-Wanalyzer-use-of-uninitialized-value @gol -Wanalyzer-write-to-const @gol -Wanalyzer-write-to-string-literal @gol } @@ -10015,6 +10017,25 @@ such as the @code{taint} checker that implements @option{-Wanalyzer-tainted-array-index}, and this option is required to enable them. +@emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the +following warnings from @option{-fanalyzer}: + +@gccoptlist{ @gol +-Wanalyzer-double-fclose @gol +-Wanalyzer-double-free @gol +-Wanalyzer-exposure-through-output-file @gol +-Wanalyzer-file-leak @gol +-Wanalyzer-free-of-non-heap @gol +-Wanalyzer-malloc-leak @gol +-Wanalyzer-mismatching-deallocation @gol +-Wanalyzer-null-argument @gol +-Wanalyzer-null-dereference @gol +-Wanalyzer-possible-null-argument @gol +-Wanalyzer-possible-null-dereference @gol +-Wanalyzer-unsafe-call-within-signal-handler @gol +-Wanalyzer-use-after-free @gol +} + @item -fno-analyzer-feasibility @opindex fanalyzer-feasibility @opindex fno-analyzer-feasibility -- cgit v1.1 From 5f6197d7c197f9d2b7fb2e1a19dac39a023755e8 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 24 Mar 2022 20:58:10 -0400 Subject: analyzer: add region::tracked_p to optimize state objects [PR104954] PR analyzer/104954 tracks that -fanalyzer was taking a very long time on a particular source file in the Linux kernel: drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c One issue occurs with the repeated use of dynamic debug lines e.g. via the DC_LOG_BANDWIDTH_CALCS macro, such as in print_bw_calcs_dceip in drivers/gpu/drm/amd/display/dc/calcs/calcs_logger.h: DC_LOG_BANDWIDTH_CALCS("#####################################################################"); DC_LOG_BANDWIDTH_CALCS("struct bw_calcs_dceip"); DC_LOG_BANDWIDTH_CALCS("#####################################################################"); [...snip dozens of lines...] DC_LOG_BANDWIDTH_CALCS("[bw_fixed] dmif_request_buffer_size: %d", bw_fixed_to_int(dceip->dmif_request_buffer_size)); When this is configured to use __dynamic_pr_debug, each of these becomes code like: do { static struct _ddebug __attribute__((__aligned__(8))) __attribute__((__section__("__dyndbg"))) __UNIQUE_ID_ddebug277 = { [...snip...] }; if (arch_static_branch(&__UNIQUE_ID_ddebug277.key, false)) __dynamic_pr_debug(&__UNIQUE_ID_ddebug277, [...the message...]); } while (0); The analyzer was naively seeing each call to __dynamic_pr_debug, noting that the __UNIQUE_ID_nnnn object escapes. At each call, as successive __UNIQUE_ID_nnnn object escapes, there are N escaped objects, and thus N need clobbering, and so we have O(N^2) clobbering of escaped objects overall, leading to huge amounts of pointless work: print_bw_calcs_data has 225 uses of DC_LOG_BANDWIDTH_CALCS, many of which are in loops. This patch adds a way to identify declarations that aren't interesting to the analyzer, so that we don't attempt to create binding_clusters for them (i.e. we don't store any state for them in our state objects). This is implemented by adding a new region::tracked_p, implemented for declarations by walking the existing IPA data the first time the analyzer sees a declaration, setting it to false for global vars that have no loads/stores/aliases, and "sufficiently safe" address-of ipa-refs. The patch gives a large speedup of -fanalyzer on the above kernel source file: Before After Total cc1 wallclock time: 180s 36s analyzer wallclock time: 162s 17s % spent in analyzer: 90% 47% gcc/analyzer/ChangeLog: PR analyzer/104954 * analyzer.opt (-fdump-analyzer-untracked): New option. * engine.cc (impl_run_checkers): Handle it. * region-model-asm.cc (region_model::on_asm_stmt): Don't attempt to clobber regions with !tracked_p (). * region-model-manager.cc (dump_untracked_region): New. (region_model_manager::dump_untracked_regions): New. (frame_region::dump_untracked_regions): New. * region-model.h (region_model_manager::dump_untracked_regions): New decl. * region.cc (ipa_ref_requires_tracking): New. (symnode_requires_tracking_p): New. (decl_region::calc_tracked_p): New. * region.h (region::tracked_p): New vfunc. (frame_region::dump_untracked_regions): New decl. (class decl_region): Note that this is also used fo SSA names. (decl_region::decl_region): Initialize m_tracked. (decl_region::tracked_p): New. (decl_region::calc_tracked_p): New decl. (decl_region::m_tracked): New. * store.cc (store::get_or_create_cluster): Assert that we don't try to create clusters for base regions that aren't trackable. (store::mark_as_escaped): Don't mark base regions that we're not tracking. gcc/ChangeLog: PR analyzer/104954 * doc/invoke.texi (Static Analyzer Options): Add -fdump-analyzer-untracked. gcc/testsuite/ChangeLog: PR analyzer/104954 * gcc.dg/analyzer/asm-x86-dyndbg-1.c: New test. * gcc.dg/analyzer/asm-x86-dyndbg-2.c: New test. * gcc.dg/analyzer/many-unused-locals.c: New test. * gcc.dg/analyzer/untracked-1.c: New test. * gcc.dg/analyzer/unused-local-1.c: New test. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8b16b35..afb21d9 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -439,6 +439,7 @@ Objective-C and Objective-C++ Dialects}. -fdump-analyzer-state-purge @gol -fdump-analyzer-stderr @gol -fdump-analyzer-supergraph @gol +-fdump-analyzer-untracked @gol -Wno-analyzer-double-fclose @gol -Wno-analyzer-double-free @gol -Wno-analyzer-exposure-through-output-file @gol @@ -10212,6 +10213,10 @@ control flow graphs in the program, with interprocedural edges for calls and returns. The second dump contains annotations showing nodes in the ``exploded graph'' and diagnostics associated with them. +@item -fdump-analyzer-untracked +@opindex fdump-analyzer-untracked +Emit custom warnings with internal details intended for analyzer developers. + @end table @node Debugging Options -- cgit v1.1 From 748f36a48b506f52e10bcdeb750a7fe9c30c26f3 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 25 Mar 2022 10:47:49 +0100 Subject: doc/invoke.texi: Move @ignore block out of @gccoptlist [PR103533] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With TeX output ("make pdf"), @gccoptlist's content end up in a single line such that TeX does not find the matching '@end ignore' for the '@ignore' block – failing with a runaway error. Solution is to move the @ignore block after the closing '}'. (Follow up to r12-7808-g319ba7e241e7e21f9eb481f075310796f13d2035 ) gcc/ PR analyzer/103533 * doc/invoke.texi (Static Analyzer Options): Move @ignore block after @gccoptlist's '}' for 'make pdf'. --- gcc/doc/invoke.texi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index afb21d9..2830710 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -9667,13 +9667,6 @@ Enabling this option effectively enables the following warnings: -Wanalyzer-shift-count-negative @gol -Wanalyzer-shift-count-overflow @gol -Wanalyzer-stale-setjmp-buffer @gol -@ignore --Wanalyzer-tainted-allocation-size @gol --Wanalyzer-tainted-array-index @gol --Wanalyzer-tainted-divisor @gol --Wanalyzer-tainted-offset @gol --Wanalyzer-tainted-size @gol -@end ignore -Wanalyzer-unsafe-call-within-signal-handler @gol -Wanalyzer-use-after-free @gol -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol @@ -9681,6 +9674,13 @@ Enabling this option effectively enables the following warnings: -Wanalyzer-write-to-const @gol -Wanalyzer-write-to-string-literal @gol } +@ignore +-Wanalyzer-tainted-allocation-size @gol +-Wanalyzer-tainted-array-index @gol +-Wanalyzer-tainted-divisor @gol +-Wanalyzer-tainted-offset @gol +-Wanalyzer-tainted-size @gol +@end ignore This option is only available if GCC was configured with analyzer support enabled. -- cgit v1.1 From 83a21c993449a32b98916814ed8ca237b3276912 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 28 Mar 2022 15:32:30 -0400 Subject: c++: Fix __has_trivial_* docs [PR59426] These have been misdocumented since C++98 POD was split into C++11 trivial and standard-layout in r149721. PR c++/59426 gcc/ChangeLog: * doc/extend.texi: Refer to __is_trivial instead of __is_pod. --- gcc/doc/extend.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index a4a25e8..8381eb6 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -25144,7 +25144,7 @@ Requires: @code{type} shall be a complete type, (possibly cv-qualified) @item __has_trivial_assign (type) If @code{type} is @code{const}- qualified or is a reference type then -the trait is @code{false}. Otherwise if @code{__is_pod (type)} is +the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is @code{true} then the trait is @code{true}, else if @code{type} is a cv-qualified class or union type with a trivial copy assignment ([class.copy]) then the trait is @code{true}, else it is @code{false}. @@ -25152,7 +25152,7 @@ Requires: @code{type} shall be a complete type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_trivial_copy (type) -If @code{__is_pod (type)} is @code{true} or @code{type} is a reference +If @code{__is_trivial (type)} is @code{true} or @code{type} is a reference type then the trait is @code{true}, else if @code{type} is a cv class or union type with a trivial copy constructor ([class.copy]) then the trait is @code{true}, else it is @code{false}. Requires: @code{type} shall be @@ -25160,7 +25160,7 @@ a complete type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_trivial_constructor (type) -If @code{__is_pod (type)} is @code{true} then the trait is @code{true}, +If @code{__is_trivial (type)} is @code{true} then the trait is @code{true}, else if @code{type} is a cv-qualified class or union type (or array thereof) with a trivial default constructor ([class.ctor]) then the trait is @code{true}, else it is @code{false}. @@ -25168,7 +25168,7 @@ Requires: @code{type} shall be a complete type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_trivial_destructor (type) -If @code{__is_pod (type)} is @code{true} or @code{type} is a reference type +If @code{__is_trivial (type)} is @code{true} or @code{type} is a reference type then the trait is @code{true}, else if @code{type} is a cv class or union type (or array thereof) with a trivial destructor ([class.dtor]) then the trait is @code{true}, else it is @code{false}. -- cgit v1.1 From 8766689a78b086bc8b8ea155e9dfd12a729a6f7f Mon Sep 17 00:00:00 2001 From: chenglulu Date: Sat, 27 Nov 2021 15:09:39 +0800 Subject: LoongArch Port: Add doc. 2022-03-29 Chenghua Xu Lulu Cheng gcc/ChangeLog: * doc/install.texi: Add LoongArch options section. * doc/invoke.texi: Add LoongArch options section. * doc/md.texi: Add LoongArch options section. contrib/ChangeLog: * config-list.mk: Add LoongArch triplet. --- gcc/doc/install.texi | 47 ++++++++++-- gcc/doc/invoke.texi | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++ gcc/doc/md.texi | 26 +++++++ 3 files changed, 268 insertions(+), 5 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 7258f9d..ab67a63 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -747,9 +747,9 @@ Here are the possible CPU types: @quotation aarch64, aarch64_be, alpha, alpha64, amdgcn, arc, arceb, arm, armeb, avr, bfin, bpf, cr16, cris, csky, epiphany, fido, fr30, frv, ft32, h8300, hppa, hppa2.0, -hppa64, i486, i686, ia64, iq2000, lm32, m32c, m32r, m32rle, m68k, mcore, -microblaze, microblazeel, mips, mips64, mips64el, mips64octeon, mips64orion, -mips64vr, mipsel, mipsisa32, mipsisa32r2, mipsisa64, mipsisa64r2, +hppa64, i486, i686, ia64, iq2000, lm32, loongarch64, m32c, m32r, m32rle, m68k, +mcore, microblaze, microblazeel, mips, mips64, mips64el, mips64octeon, +mips64orion, mips64vr, mipsel, mipsisa32, mipsisa32r2, mipsisa64, mipsisa64r2, mipsisa64r2el, mipsisa64sb1, mipsisa64sr71k, mipstx39, mmix, mn10300, moxie, msp430, nds32be, nds32le, nios2, nvptx, or1k, pdp11, powerpc, powerpc64, powerpc64le, powerpcle, pru, riscv32, riscv32be, riscv64, riscv64be, rl78, rx, @@ -1166,8 +1166,9 @@ sysv, aix. @itemx --without-multilib-list Specify what multilibs to build. @var{list} is a comma separated list of values, possibly consisting of a single value. Currently only implemented -for aarch64*-*-*, arm*-*-*, riscv*-*-*, sh*-*-* and x86-64-*-linux*. The -accepted values and meaning for each target is given below. +for aarch64*-*-*, arm*-*-*, loongarch64-*-*, riscv*-*-*, sh*-*-* and +x86-64-*-linux*. The accepted values and meaning for each target is given +below. @table @code @item aarch64*-*-* @@ -1254,6 +1255,14 @@ profile. The union of these options is considered when specifying both @code{-mfloat-abi=hard} @end multitable +@item loongarch*-*-* +@var{list} is a comma-separated list of the following ABI identifiers: +@code{lp64d[/base]} @code{lp64f[/base]} @code{lp64d[/base]}, where the +@code{/base} suffix may be omitted, to enable their respective run-time +libraries. If @var{list} is empty or @code{default}, +or if @option{--with-multilib-list} is not specified, then the default ABI +as specified by @option{--with-abi} or implied by @option{--target} is selected. + @item riscv*-*-* @var{list} is a single ABI name. The target architecture must be either @code{rv32gc} or @code{rv64gc}. This will build a single multilib for the @@ -4442,6 +4451,34 @@ This configuration is intended for embedded systems running uClinux. @html
@end html +@anchor{loongarch} +@heading LoongArch +LoongArch processor. +The following LoongArch targets are available: +@table @code +@item loongarch64-linux-gnu* +LoongArch processor running GNU/Linux. This target triplet may be coupled +with a small set of possible suffixes to identify their default ABI type: +@table @code +@item f64 +Uses @code{lp64d/base} ABI by default. +@item f32 +Uses @code{lp64f/base} ABI by default. +@item sf +Uses @code{lp64s/base} ABI by default. +@end table + +@item loongarch64-linux-gnu +Same as @code{loongarch64-linux-gnuf64}, but may be used with +@option{--with-abi=*} to configure the default ABI type. +@end table + +More information about LoongArch can be found at +@uref{https://github.com/loongson/LoongArch-Documentation}. + +@html +
+@end html @anchor{m32c-x-elf} @heading m32c-*-elf Renesas M32C processor. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2830710..554e04e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -996,6 +996,16 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol -msign-extend-enabled -muser-enabled} +@emph{LoongArch Options} +@gccoptlist{-march=@var{cpu-type} -mtune=@var{cpu-type} -mabi=@var{base-abi-type} @gol +-mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float @gol +-mbranch-cost=@var{n} -mcheck-zero-division -mno-check-zero-division @gol +-mcond-move-int -mno-cond-move-int @gol +-mcond-move-float -mno-cond-move-float @gol +-memcpy -mno-memcpy -mstrict-align -mno-strict-align @gol +-mmax-inline-memcpy-size=@var{n} @gol +-mcmodel=@var{code-model}} + @emph{M32R/D Options} @gccoptlist{-m32r2 -m32rx -m32r @gol -mdebug @gol @@ -18905,6 +18915,7 @@ platform. * HPPA Options:: * IA-64 Options:: * LM32 Options:: +* LoongArch Options:: * M32C Options:: * M32R/D Options:: * M680x0 Options:: @@ -24420,6 +24431,195 @@ Enable user-defined instructions. @end table +@node LoongArch Options +@subsection LoongArch Options +@cindex LoongArch Options + +These command-line options are defined for LoongArch targets: + +@table @gcctabopt +@item -march=@var{cpu-type} +@opindex -march +Generate instructions for the machine type @var{cpu-type}. In contrast to +@option{-mtune=@var{cpu-type}}, which merely tunes the generated code +for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC +to generate code that may not run at all on processors other than the one +indicated. Specifying @option{-march=@var{cpu-type}} implies +@option{-mtune=@var{cpu-type}}, except where noted otherwise. + +The choices for @var{cpu-type} are: + +@table @samp +@item native +This selects the CPU to generate code for at compilation time by determining +the processor type of the compiling machine. Using @option{-march=native} +enables all instruction subsets supported by the local machine (hence +the result might not run on different machines). Using @option{-mtune=native} +produces code optimized for the local machine under the constraints +of the selected instruction set. +@item loongarch64 +A generic CPU with 64-bit extensions. +@item la464 +LoongArch LA464 CPU with LBT, LSX, LASX, LVZ. +@end table + +@item -mtune=@var{cpu-type} +@opindex mtune +Optimize the output for the given processor, specified by microarchitecture +name. + +@item -mabi=@var{base-abi-type} +@opindex mabi +Generate code for the specified calling convention. +@var{base-abi-type} can be one of: +@table @samp +@item lp64d +Uses 64-bit general purpose registers and 32/64-bit floating-point +registers for parameter passing. Data model is LP64, where @samp{int} +is 32 bits, while @samp{long int} and pointers are 64 bits. +@item lp64f +Uses 64-bit general purpose registers and 32-bit floating-point +registers for parameter passing. Data model is LP64, where @samp{int} +is 32 bits, while @samp{long int} and pointers are 64 bits. +@item lp64s +Uses 64-bit general purpose registers and no floating-point +registers for parameter passing. Data model is LP64, where @samp{int} +is 32 bits, while @samp{long int} and pointers are 64 bits. +@end table + +@item -mfpu=@var{fpu-type} +@opindex mfpu +Generate code for the specified FPU type, which can be one of: +@table @samp +@item 64 +Allow the use of hardware floating-point instructions for 32-bit +and 64-bit operations. +@item 32 +Allow the use of hardware floating-point instructions for 32-bit +operations. +@item none +@item 0 +Prevent the use of hardware floating-point instructions. +@end table + +@item -msoft-float +@opindex msoft-float +Force @option{-mfpu=none} and prevents the use of floating-point +registers for parameter passing. This option may change the target +ABI. + +@item -msingle-float +@opindex -msingle-float +Force @option{-mfpu=32} and allow the use of 32-bit floating-point +registers for parameter passing. This option may change the target +ABI. + +@item -mdouble-float +@opindex -mdouble-float +Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point +registers for parameter passing. This option may change the target +ABI. + +@item -mbranch-cost=@var{n} +@opindex -mbranch-cost +Set the cost of branches to roughly @var{n} instructions. + +@item -mcheck-zero-division +@itemx -mno-check-zero-divison +@opindex -mcheck-zero-division +Trap (do not trap) on integer division by zero. The default is +@option{-mcheck-zero-division}. + +@item -mcond-move-int +@itemx -mno-cond-move-int +@opindex -mcond-move-int +Conditional moves for integral data in general-purpose registers +are enabled (disabled). The default is @option{-mcond-move-int}. + +@item -mcond-move-float +@itemx -mno-cond-move-float +@opindex -mcond-move-float +Conditional moves for floating-point registers are enabled (disabled). +The default is @option{-mcond-move-float}. + +@item -mmemcpy +@itemx -mno-memcpy +@opindex -mmemcpy +Force (do not force) the use of @code{memcpy} for non-trivial block moves. +The default is @option{-mno-memcpy}, which allows GCC to inline most +constant-sized copies. Setting optimization level to @option{-Os} also +forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this +behavior if explicitly specified, regardless of the order these options on +the command line. + +@item -mstrict-align +@itemx -mno-strict-align +@opindex -mstrict-align +Avoid or allow generating memory accesses that may not be aligned on a natural +object boundary as described in the architecture specification. The default is +@option{-mno-strict-align}. + +@item -msmall-data-limit=@var{number} +@opindex -msmall-data-limit +Put global and static data smaller than @var{number} bytes into a special +section (on some targets). The default value is 0. + +@item -mmax-inline-memcpy-size=@var{n} +@opindex -mmax-inline-memcpy-size +Inline all block moves (such as calls to @code{memcpy} or structure copies) +less than or equal to @var{n} bytes. The default value of @var{n} is 1024. + +@item -mcmodel=@var{code-model} +Set the code model to one of: +@table @samp +@item tiny-static +@itemize @bullet +@item +local symbol and global strong symbol: The data section must be within +/-2MiB addressing space. +The text section must be within +/-128MiB addressing space. +@item +global weak symbol: The got table must be within +/-2GiB addressing space. +@end itemize + +@item tiny +@itemize @bullet +@item +local symbol: The data section must be within +/-2MiB addressing space. +The text section must be within +/-128MiB +addressing space. +@item +global symbol: The got table must be within +/-2GiB addressing space. +@end itemize + +@item normal +@itemize @bullet +@item +local symbol: The data section must be within +/-2GiB addressing space. +The text section must be within +/-128MiB addressing space. +@item +global symbol: The got table must be within +/-2GiB addressing space. +@end itemize + +@item large +@itemize @bullet +@item +local symbol: The data section must be within +/-2GiB addressing space. +The text section must be within +/-128GiB addressing space. +@item +global symbol: The got table must be within +/-2GiB addressing space. +@end itemize + +@item extreme(Not implemented yet) +@itemize @bullet +@item +local symbol: The data and text section must be within +/-8EiB addressing space. +@item +global symbol: The data got table must be within +/-8EiB addressing space. +@end itemize +@end table +The default code model is @code{normal}. +@end table + @node M32C Options @subsection M32C Options @cindex M32C options diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index f3619c5..3b54435 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -2747,6 +2747,32 @@ Memory addressed using the small base register ($sb). $r1h @end table +@item LoongArch---@file{config/loongarch/constraints.md} +@table @code +@item f +A floating-point register (if available). +@item k +A memory operand whose address is formed by a base register and +(optionally scaled) index register. +@item l +A signed 16-bit constant. +@item m +A memory operand whose address is formed by a base register and offset +that is suitable for use in instructions with the same addressing mode +as @code{st.w} and @code{ld.w}. +@item I +A signed 12-bit constant (for arithmetic instructions). +@item K +An unsigned 12-bit constant (for logic instructions). +@item ZB +An address that is held in a general-purpose register. +The offset is zero. +@item ZC +A memory operand whose address is formed by a base register and offset +that is suitable for use in instructions with the same addressing mode +as @code{ll.w} and @code{sc.w}. +@end table + @item MicroBlaze---@file{config/microblaze/constraints.md} @table @code @item d -- cgit v1.1 From 9778a7dc0b3000813a1d25669bf2735f38219650 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 29 Mar 2022 15:24:07 +0200 Subject: [nvptx, doc] Update misa and mptx, add march and march-map Update nvptx documentation: - Use meaningful terms: "PTX ISA target architecture" and "PTX ISA version". - Remove invalid claim that "ISA strings must be lower-case". - Add missing sm_xx entries. - Fix misa default. - Add march, copying misa doc. - Declare misa an march alias. - Add march-map. - Fix "for given the specified" typo. gcc/ChangeLog: 2022-03-29 Tom de Vries * doc/invoke.texi (misa, mptx): Update. (march, march-map): Add. --- gcc/doc/invoke.texi | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 554e04e..43b7513 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -27540,18 +27540,31 @@ These options are defined for Nvidia PTX: Ignored, but preserved for backward compatibility. Only 64-bit ABI is supported. -@item -misa=@var{ISA-string} +@item -march=@var{architecture-string} @opindex march -Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA -strings must be lower-case. Valid ISA strings include @samp{sm_30} and -@samp{sm_35}. The default ISA is sm_35. +Generate code for the specified PTX ISA target architecture +(e.g.@: @samp{sm_35}). Valid architecture strings are @samp{sm_30}, +@samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and +@samp{sm_80}. The default target architecture is sm_30. + +@item -misa=@var{architecture-string} +@opindex misa +Alias of @option{-march=}. + +@item -march-map=@var{architecture-string} +@opindex march +Select the closest available @option{-march=} value that is not more +capable. For instance, for @option{-march-map=sm_50} select +@option{-march=sm_35}, and for @option{-march-map=sm_53} select +@option{-march=sm_53}. @item -mptx=@var{version-string} @opindex mptx -Generate code for given the specified PTX version (e.g.@: @samp{7.0}). +Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}). Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and -@samp{7.0}. The default PTX version is 6.0, unless a higher minimal -version is required for specified PTX ISA via option @option{-misa=}. +@samp{7.0}. The default PTX ISA version is 6.0, unless a higher +version is required for specified PTX ISA target architecture via +option @option{-march=}. @item -mmainkernel @opindex mmainkernel -- cgit v1.1 From c8cd03f5b52ad297f73e7181e9f0c643a88a51e3 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 30 Mar 2022 09:50:18 +0200 Subject: [nvptx, doc] Document predefined macros at march and mptx Document predefined macros: - __PTX_SM__ , - __PTX_ISA_VERSION_MAJOR__ and - __PTX_ISA_VERSION_MINOR__ . gcc/ChangeLog: 2022-03-29 Tom de Vries * doc/invoke.texi (march): Document __PTX_SM__. (mptx): Document __PTX_ISA_VERSION_MAJOR__ and __PTX_ISA_VERSION_MINOR__. Co-Authored-By: Tobias Burnus --- gcc/doc/invoke.texi | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 43b7513..09715a5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -27547,6 +27547,10 @@ Generate code for the specified PTX ISA target architecture @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and @samp{sm_80}. The default target architecture is sm_30. +This option sets the value of the preprocessor macro +@code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value +@samp{350}. + @item -misa=@var{architecture-string} @opindex misa Alias of @option{-march=}. @@ -27566,6 +27570,11 @@ Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and version is required for specified PTX ISA target architecture via option @option{-march=}. +This option sets the values of the preprocessor macros +@code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__}; +for instance, for @samp{3.1} the macros have the values @samp{3} and +@samp{1}, respectively. + @item -mmainkernel @opindex mmainkernel Link in code for a __main kernel. This is for stand-alone instead of -- cgit v1.1 From 40d643d8de7bb0b7bd75e35f4274beb9793bb0df Mon Sep 17 00:00:00 2001 From: Andre Vieira Date: Thu, 31 Mar 2022 17:08:59 +0100 Subject: aarch64: Implement determine_suggested_unroll_factor This patch implements the costing function determine_suggested_unroll_factor for aarch64. It determines the unrolling factor by dividing the number of X operations we can do per cycle by the number of X operations, taking this information from the vec_ops analysis during vector costing and the available issue_info information. We multiply the dividend by a potential reduction_latency, to improve our pipeline utilization if we are stalled waiting on a particular reduction operation. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_vector_costs): Define determine_suggested_unroll_factor and m_has_avg. (determine_suggested_unroll_factor): New function. (aarch64_vector_costs::add_stmt_cost): Check for a qualifying pattern to set m_nosve_pattern. (aarch64_vector_costs::finish_costs): Use determine_suggested_unroll_factor. * config/aarch64/aarch64.opt (aarch64-vect-unroll-limit): New. * doc/invoke.texi: (aarch64-vect-unroll-limit): Document new option. --- gcc/doc/invoke.texi | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 09715a5..3936aef 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -15239,6 +15239,12 @@ If this parameter is set to @var{n}, GCC will not use this heuristic for loops that are known to execute in fewer than @var{n} Advanced SIMD iterations. +@item aarch64-vect-unroll-limit +The vectorizer will use available tuning information to determine whether it +would be beneficial to unroll the main vectorized loop and by how much. This +parameter set's the upper bound of how much the vectorizer will unroll the main +loop. The default value is four. + @end table @end table -- cgit v1.1 From 58d78650da3c6e4830b8350f4e6cbe87dc893c9f Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 30 Mar 2022 23:00:28 +0200 Subject: options: Clarifications around option definition records' help texts gcc/ * doc/options.texi (Option file format): Clarifications around option definition records' help texts. --- gcc/doc/options.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi index 50674938..17ba923 100644 --- a/gcc/doc/options.texi +++ b/gcc/doc/options.texi @@ -175,6 +175,17 @@ used instead of the option's name and the text to the right of the tab forms the help text. This allows you to elaborate on what type of argument the option takes. +There is no support for different help texts for different languages. +If an option is supported for multiple languages, use a generic +description that is correct for all of them. + +If an option has multiple option definition records (in different +front ends' @file{*.opt} files, and/or @file{gcc/common.opt}, for +example), convention is to not duplicate the help text for each of +them, but instead put a comment like @code{; documented in common.opt} +in place of the help text for all but one of the multiple option +definition records. + @item A target mask record. These records have one field of the form @samp{Mask(@var{x})}. The options-processing script will automatically -- cgit v1.1 From 31933f4f788b6cd64cbb7ee42076997f6d0fe212 Mon Sep 17 00:00:00 2001 From: Qing Zhao Date: Fri, 1 Apr 2022 16:09:43 +0000 Subject: Add an assertion: the zeroed_hardregs set is a subset of all call used regs. We should make sure that the hard register set that is actually cleared by the target hook zero_call_used_regs should be a subset of all call used registers. At the same time, update documentation for the target hook TARGET_ZERO_CALL_USED_REGS. This new assertion identified a bug in the i386 implemenation, which incorrectly set the zeroed_hardregs for stack registers. Fixed this bug in i386 implementation. gcc/ChangeLog: 2022-04-01 Qing Zhao * config/i386/i386.cc (zero_all_st_registers): Return the value of num_of_st. (ix86_zero_call_used_regs): Update zeroed_hardregs set according to the return value of zero_all_st_registers. * doc/tm.texi: Update the documentation of TARGET_ZERO_CALL_USED_REGS. * function.cc (gen_call_used_regs_seq): Add an assertion. * target.def: Update the documentation of TARGET_ZERO_CALL_USED_REGS. --- gcc/doc/tm.texi | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 2f92d37..c5006af 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12330,6 +12330,13 @@ This target hook emits instructions to zero the subset of @var{selected_regs} that could conceivably contain values that are useful to an attacker. Return the set of registers that were actually cleared. +For most targets, the returned set of registers is a subset of +@var{selected_regs}, however, for some of the targets (for example MIPS), +clearing some registers that are in the @var{selected_regs} requires +clearing other call used registers that are not in the @var{selected_regs}, +under such situation, the returned set of registers must be a subset of all +call used registers. + The default implementation uses normal move instructions to zero all the registers in @var{selected_regs}. Define this hook if the target has more efficient ways of zeroing certain registers, -- cgit v1.1 From 74e243ec99476408fe60ad48e861d9575c537979 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Mon, 4 Apr 2022 17:41:53 +0100 Subject: doc: Fix typos in match.pd documentation This patch fixes some spelling and grammar issues in the match.pd documentation. gcc/ChangeLog: * doc/match-and-simplify.texi: Fix typos. --- gcc/doc/match-and-simplify.texi | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/match-and-simplify.texi b/gcc/doc/match-and-simplify.texi index 055a530..b33d835 100644 --- a/gcc/doc/match-and-simplify.texi +++ b/gcc/doc/match-and-simplify.texi @@ -19,7 +19,7 @@ tries to address several issues. gimplifying via force_gimple_operand @end enumerate -To address these the project introduces a simple domain specific language +To address these the project introduces a simple domain-specific language to write expression simplifications from which code targeting GIMPLE and GENERIC is auto-generated. The GENERIC variant follows the fold_buildN API while for the GIMPLE variant and to address 2) new @@ -40,7 +40,7 @@ APIs are introduced. @deftypefnx {GIMPLE function} tree gimple_simplify (enum built_in_function, tree, tree, gimple_seq *, tree (*)(tree)) @deftypefnx {GIMPLE function} tree gimple_simplify (enum built_in_function, tree, tree, tree, gimple_seq *, tree (*)(tree)) @deftypefnx {GIMPLE function} tree gimple_simplify (enum built_in_function, tree, tree, tree, tree, gimple_seq *, tree (*)(tree)) -The main GIMPLE API entry to the expression simplifications mimicing +The main GIMPLE API entry to the expression simplifications mimicking that of the GENERIC fold_@{unary,binary,ternary@} functions. @end deftypefn @@ -57,7 +57,7 @@ a valueization hook: @end deftypefn -Ontop of these a @code{fold_buildN}-like API for GIMPLE is introduced: +On top of these a @code{fold_buildN}-like API for GIMPLE is introduced: @deftypefn {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree (*valueize) (tree) = NULL); @deftypefnx {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree (*valueize) (tree) = NULL); @@ -78,9 +78,9 @@ and simplification is performed using the optional valueization hook. @section The Language @cindex The Language -The language to write expression simplifications in resembles other -domain-specific languages GCC uses. Thus it is lispy. Lets start -with an example from the match.pd file: +The language in which to write expression simplifications resembles +other domain-specific languages GCC uses. Thus it is lispy. Let's +start with an example from the match.pd file: @smallexample (simplify @@ -100,7 +100,7 @@ function code names in all-caps, like @code{BUILT_IN_SQRT}. @code{@@n} denotes a so-called capture. It captures the operand and lets you refer to it in other places of the match-and-simplify. In the -above example it is refered to in the replacement expression. Captures +above example it is referred to in the replacement expression. Captures are @code{@@} followed by a number or an identifier. @smallexample @@ -110,10 +110,10 @@ are @code{@@} followed by a number or an identifier. @end smallexample In this example @code{@@0} is mentioned twice which constrains the matched -expression to have two equal operands. Usually matches are constraint -to equal types. If operands may be constants and conversions are involved +expression to have two equal operands. Usually matches are constrained +to equal types. If operands may be constants and conversions are involved, matching by value might be preferred in which case use @code{@@@@0} to -denote a by value match and the specific operand you want to refer to +denote a by-value match and the specific operand you want to refer to in the result part. This example also introduces operands written in C code. These can be used in the expression replacements and are supposed to evaluate to a tree node which has to @@ -129,7 +129,7 @@ be a valid GIMPLE operand (so you cannot generate expressions in C code). Here @code{@@0} captures the first operand of the trunc_mod expression which is also predicated with @code{integer_zerop}. Expression operands may be either expressions, predicates or captures. Captures -can be unconstrained or capture expresions or predicates. +can be unconstrained or capture expressions or predicates. This example introduces an optional operand of simplify, the if-expression. This condition is evaluated after the @@ -219,9 +219,9 @@ Captures can also be used for capturing results of sub-expressions. @end smallexample In the above example, @code{@@2} captures the result of the expression -@code{(addr @@0)}. For outermost expression only its type can be captured, -and the keyword @code{type} is reserved for this purpose. The above -example also gives a way to conditionalize patterns to only apply +@code{(addr @@0)}. For the outermost expression only its type can be +captured, and the keyword @code{type} is reserved for this purpose. The +above example also gives a way to conditionalize patterns to only apply to @code{GIMPLE} or @code{GENERIC} by means of using the pre-defined preprocessor macros @code{GIMPLE} and @code{GENERIC} and using preprocessor directives. @@ -314,9 +314,9 @@ and use them in @code{for} operator lists where they get expanded. So this example iterates over @code{plus}, @code{minus}, @code{mult} and @code{trunc_div}. -Using operator lists can also remove the need to explicitely write +Using operator lists can also remove the need to explicitly write a @code{for}. All operator list uses that appear in a @code{simplify} -or @code{match} pattern in operator positions will implicitely +or @code{match} pattern in operator positions will implicitly be added to a new @code{for}. For example @smallexample @@ -359,7 +359,7 @@ type of a generated expression with the @code{:type} syntax where @code{type} needs to be an identifier that refers to the desired type. Usually the types of the generated result expressions are determined from the context, but sometimes like in the above case -it is required that you specify them explicitely. +it is required that you specify them explicitly. Another modifier for generated expressions is @code{!} which tells the machinery to only consider the simplification in case @@ -402,7 +402,7 @@ The support for @code{?} marking extends to all unary operations including predicates you declare yourself with @code{match}. Predicates available from the GCC middle-end need to be made -available explicitely via @code{define_predicates}: +available explicitly via @code{define_predicates}: @smallexample (define_predicates -- cgit v1.1 From 0b5723d74f3a731380f78dc1a02a2376951388cf Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 5 Apr 2022 16:43:16 -0400 Subject: Document that the 'access' and 'nonnull' attributes are independent gcc/ChangeLog: * doc/extend.texi (Common Function Attributes): Document that 'access' does not imply 'nonnull'. Signed-off-by: David Malcolm --- gcc/doc/extend.texi | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 8381eb6..e10b10b 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2652,6 +2652,14 @@ The mode is intended to be used as a means to help validate the expected object size, for example in functions that call @code{__builtin_object_size}. @xref{Object Size Checking}. +Note that the @code{access} attribute merely specifies how an object +referenced by the pointer argument can be accessed; it does not imply that +an access @strong{will} happen. Also, the @code{access} attribute does not +imply the attribute @code{nonnull}; it may be appropriate to add both attributes +at the declaration of a function that unconditionally manipulates a buffer via +a pointer argument. See the @code{nonnull} attribute for more information and +caveats. + @item alias ("@var{target}") @cindex @code{alias} function attribute The @code{alias} attribute causes the declaration to be emitted as an alias -- cgit v1.1 From f0d29224558e1d625a3d0d13019e2059c56f5b82 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 6 Apr 2022 09:32:56 +0200 Subject: docs: Document new param x86-stlf-window-ninsns. gcc/ChangeLog: * doc/invoke.texi: Document it. --- gcc/doc/invoke.texi | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3936aef..1a51759 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -15247,6 +15247,14 @@ loop. The default value is four. @end table +The following choices of @var{name} are available on i386 and x86_64 targets: + +@table @gcctabopt +@item x86-stlf-window-ninsns +Instructions number above which STFL stall penalty can be compensated. + +@end table + @end table @node Instrumentation Options -- cgit v1.1 From 82a4c5c704433249aa2adc89ef58b6b70e50c930 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 12 Apr 2022 07:41:33 +0200 Subject: IBM zSystems: Add support for z16 as CPU name. So far z16 was identified as arch14. After the machine has been announced we can now add the real name. gcc/ChangeLog: * common/config/s390/s390-common.cc: Rename PF_ARCH14 to PF_Z16. * config.gcc: Add z16 as march/mtune switch. * config/s390/driver-native.cc (s390_host_detect_local_cpu): Recognize z16 with -march=native. * config/s390/s390-opts.h (enum processor_type): Rename PROCESSOR_ARCH14 to PROCESSOR_3931_Z16. * config/s390/s390.cc (PROCESSOR_ARCH14): Rename to ... (PROCESSOR_3931_Z16): ... throughout the file. (s390_processor processor_table): Add z16 as cpu string. * config/s390/s390.h (enum processor_flags): Rename PF_ARCH14 to PF_Z16. (TARGET_CPU_ARCH14): Rename to ... (TARGET_CPU_Z16): ... this. (TARGET_CPU_ARCH14_P): Rename to ... (TARGET_CPU_Z16_P): ... this. (TARGET_ARCH14): Rename to ... (TARGET_Z16): ... this. (TARGET_ARCH14_P): Rename to ... (TARGET_Z16_P): ... this. * config/s390/s390.md (cpu_facility): Rename arch14 to z16 and check TARGET_Z16 instead of TARGET_ARCH14. * config/s390/s390.opt: Add z16 to processor_type. * doc/invoke.texi: Document z16 and arch14. --- gcc/doc/invoke.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 1a51759..dd2d387 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -29776,7 +29776,8 @@ system representing a certain processor type. Possible values for @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6}, @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8}, @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, -@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}. +@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, +@samp{z16}/@samp{arch14}, and @samp{native}. The default is @option{-march=z900}. -- cgit v1.1 From b642a44feec09817c49b6bcfeee6fd5922986ed6 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Sat, 16 Apr 2022 07:29:34 -0600 Subject: doc: Adjust mingw-w64 download link gcc: * doc/install.texi (Specific): Adjust mingw-w64 download link. --- gcc/doc/install.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index ab67a63..642aae0 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -5141,7 +5141,7 @@ the Win32 subsystem that provides a subset of POSIX. @subheading Intel 64-bit versions GCC contains support for x86-64 using the mingw-w64 -runtime library, available from @uref{https://mingw-w64.org/doku.php}. +runtime library, available from @uref{https://www.mingw-w64.org/downloads/}. This library should be used with the target triple x86_64-pc-mingw32. @subheading Windows CE -- cgit v1.1 From a897a88c592cd7abcf3869fcd7b667a016eccc89 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Tue, 19 Apr 2022 00:30:24 +0200 Subject: doc/invoke.texi: CRIS: Remove references to cris-axis-linux-gnu ...and related options. These stale bits were overlooked when support for "Linux/GNU" and CRIS v32 was removed, before the gcc-11 release. Resulting pdf, html and info inspected for sanity. gcc: * doc/invoke.texi : Remove references to options for removed subtarget cris-axis-linux-gnu and tweak wording accordingly. --- gcc/doc/invoke.texi | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index dd2d387..07b4401 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -854,12 +854,12 @@ Objective-C and Objective-C++ Dialects}. -msim -msdata=@var{sdata-type}} @emph{CRIS Options} -@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol --mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol +@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} +-mtune=@var{cpu} -mmax-stack-frame=@var{n} @gol -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol -mstack-align -mdata-align -mconst-align @gol --m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol --melf -maout -melinux -mlinux -sim -sim2 @gol +-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue @gol +-melf -maout -sim -sim2 @gol -mmul-bug-workaround -mno-mul-bug-workaround} @emph{CR16 Options} @@ -22365,8 +22365,7 @@ These options are defined specifically for the CRIS ports. Generate code for the specified architecture. The choices for @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. -Default is @samp{v0} except for cris-axis-linux-gnu, where the default is -@samp{v10}. +Default is @samp{v0}. @item -mtune=@var{architecture-type} @opindex mtune @@ -22450,27 +22449,13 @@ option only together with visual inspection of the compiled code: no warnings or errors are generated when call-saved registers must be saved, or storage for local variables needs to be allocated. -@item -mno-gotplt -@itemx -mgotplt -@opindex mno-gotplt -@opindex mgotplt -With @option{-fpic} and @option{-fPIC}, don't generate (do generate) -instruction sequences that load addresses for functions from the PLT part -of the GOT rather than (traditional on other architectures) calls to the -PLT@. The default is @option{-mgotplt}. - @item -melf @opindex melf -Legacy no-op option only recognized with the cris-axis-elf and -cris-axis-linux-gnu targets. - -@item -mlinux -@opindex mlinux -Legacy no-op option only recognized with the cris-axis-linux-gnu target. +Legacy no-op option. @item -sim @opindex sim -This option, recognized for the cris-axis-elf, arranges +This option arranges to link with input-output functions from a simulator library. Code, initialized data and zero-initialized data are allocated consecutively. -- cgit v1.1 From d2a0a5d4ad23f1974c72ef8abaa55c1707c0b27f Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Tue, 19 Apr 2022 00:30:43 +0200 Subject: doc/install.texi: CRIS: Remove gone websites. Adjust CRIS targets That is, support for cris-linux-gnu was removed in gcc-11, but install.texi wasn't adjusted accordingly. Also, unfortunately the developer-related sites are gone with no replacements. And, CRIS is used in other chip series as well, but allude rather than list. The generated manpages, info, pdf and html were sanity-checked. gcc: * doc/install.texi : Remove references to removed websites and adjust for cris-*-elf being the only remaining toolchain. --- gcc/doc/install.texi | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 642aae0..2bb2d23 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -3901,8 +3901,8 @@ configure GCC@ for building a CR16 uclinux cross-compiler. @end html @anchor{cris} @heading CRIS -CRIS is the CPU architecture in Axis Communications ETRAX system-on-a-chip -series. These are used in embedded applications. +CRIS is a CPU architecture in Axis Communications systems-on-a-chip, for +example the ETRAX series. These are used in embedded applications. @ifnothtml @xref{CRIS Options,, CRIS Options, gcc, Using the GNU Compiler @@ -3913,21 +3913,8 @@ See ``CRIS Options'' in the main manual @end ifhtml for a list of CRIS-specific options. -There are a few different CRIS targets: -@table @code -@item cris-axis-elf -Mainly for monolithic embedded systems. Includes a multilib for the -@samp{v10} core used in @samp{ETRAX 100 LX}. -@item cris-axis-linux-gnu -A GNU/Linux port for the CRIS architecture, currently targeting -@samp{ETRAX 100 LX} by default. -@end table - -Pre-packaged tools can be obtained from -@uref{ftp://ftp.axis.com/@/pub/@/axis/@/tools/@/cris/@/compiler-kit/}. More -information about this platform is available at -@uref{http://developer.axis.com/}. - +Use @samp{configure --target=cris-elf} to configure GCC@ for building +a cross-compiler for CRIS. @html
@end html -- cgit v1.1 From 55c17bc75c4c65d75597b545680f9fbff163ccd1 Mon Sep 17 00:00:00 2001 From: "Paul A. Clarke" Date: Fri, 22 Apr 2022 12:28:30 -0500 Subject: docs: Correct "This functions" to "These functions" 2022-04-22 Paul A. Clarke gcc * doc/extend.texi: Correct "This" to "These". --- gcc/doc/extend.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index e10b10b..931e5ae 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -13525,7 +13525,7 @@ exceptions handling functions @code{fegetround}, @code{feclearexcept} and @code{feraiseexcept}. They may not be available for all targets, and because they need close interaction with libc internal values, they may not be available for all target libcs, but in all cases they will gracefully fallback to libc -calls. This built-in functions appear both with and without the +calls. These built-in functions appear both with and without the @code{__builtin_} prefix. @deftypefn {Built-in Function} void *__builtin_alloca (size_t size) -- cgit v1.1 From 235f88dbc3494c49e0f361a5a3f78491f72ff47c Mon Sep 17 00:00:00 2001 From: "Paul A. Clarke" Date: Mon, 11 Apr 2022 11:18:28 -0500 Subject: docs: Fix 'modff' reference in extend.texi In commit a2a919aa501e3 (2003), built-ins for modf and modff were added. In extend.texi, section "Other Builtins", "modf" was added to the paragraph "There are also built-in versions of the ISO C99 functions [...]" and "modf" was also added to the paragraph "The ISO C90 functions [...]". "modff" was not added to either paragraph. Based on the context clues about where "modfl" and other similar function pairs like "powf/powl" appear, I believe the reference to "modf" in the first paragraph (C99) should instead be "modff". 2022-04-25 Paul A. Clarke gcc * doc/extend.texi (Other Builtins): Correct reference to 'modff'. --- gcc/doc/extend.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 931e5ae..84e6f66 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -13460,7 +13460,7 @@ There are also built-in versions of the ISO C99 functions @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf}, @code{floorl}, @code{fmodf}, @code{fmodl}, @code{frexpf}, @code{frexpl}, @code{ldexpf}, @code{ldexpl}, @code{log10f}, @code{log10l}, @code{logf}, @code{logl}, -@code{modfl}, @code{modf}, @code{powf}, @code{powl}, @code{sinf}, +@code{modfl}, @code{modff}, @code{powf}, @code{powl}, @code{sinf}, @code{sinhf}, @code{sinhl}, @code{sinl}, @code{sqrtf}, @code{sqrtl}, @code{tanf}, @code{tanhf}, @code{tanhl} and @code{tanl} that are recognized in any mode since ISO C90 reserves these names for -- cgit v1.1 From 4e4f550a5bc588a76452941cb3fb887a20f8a6cc Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Thu, 28 Apr 2022 10:27:32 +0200 Subject: doc: Document Solaris D bootstrap requirements [PR 103528] This patch documents the Solaris-specific D bootstrap requirements. Tested by building and inspecting gccinstall.{pdf,info}. 2022-03-16 Rainer Orth gcc: PR d/103528 * doc/install.texi (Tools/packages necessary for building GCC) (GDC): Document libphobos requirement. (Host/target specific installation notes for GCC, *-*-solaris2*): Document libphobos and GDC specifics. --- gcc/doc/install.texi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 2bb2d23..3192824 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -287,7 +287,8 @@ section. @item @anchor{GDC-prerequisite}GDC In order to build GDC, the D compiler, you need a working GDC -compiler (GCC version 9.1 or later), as the D front end is written in D. +compiler (GCC version 9.1 or later) and D runtime library, +@samp{libphobos}, as the D front end is written in D. Versions of GDC prior to 12 can be built with an ISO C++11 compiler, which can then be installed and used to bootstrap newer versions of the D front end. @@ -303,6 +304,10 @@ front end does not make use of any GDC-specific extensions, or novel features of the D language, if too old a GDC version is installed and @option{--enable-languages=d} is used, the build will fail. +On some targets, @samp{libphobos} isn't enabled by default, but compiles +and works if @option{--enable-libphobos} is used. Specifics are +documented for affected targets. + @item A ``working'' POSIX compatible shell, or GNU bash Necessary when running @command{configure} because some @@ -4875,6 +4880,12 @@ GNU binutils. @samp{libstdc++} symbol versioning will be disabled if no appropriate version is found. Solaris @command{c++filt} from the Solaris Studio compilers does @emph{not} work. +In order to build the GNU D compiler, GDC, a working @samp{libphobos} is +needed. That library wasn't built by default in GCC 9--11 on SPARC, or +on x86 when the Solaris assembler is used, but can be enabled by +configuring with @option{--enable-libphobos}. Also, GDC 9.4.0 is +required on x86, while GDC 9.3.0 is known to work on SPARC. + The versions of the GNU Multiple Precision Library (GMP), the MPFR library and the MPC library bundled with Solaris 11.3 and later are usually recent enough to match GCC's requirements. There are two @@ -4888,6 +4899,7 @@ need to configure with @option{--with-gmp-include=/usr/include/gmp}. @item The version of the MPFR libary included in Solaris 11.3 is too old; you need to provide a more recent one. + @end itemize @html -- cgit v1.1 From 8094526109034c6c6af44de47612e97319b2c7c5 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 28 Apr 2022 10:30:58 +0100 Subject: doc: Remove misleading text about multilibs for IEEE long double The choice of ieee or ibm long double format is orthogonal to multilibs, as the two sets of symbols co-exist and don't need a separate multilib. gcc/ChangeLog: * doc/install.texi (Configuration): Remove misleading text around LE PowerPC Linux multilibs. --- gcc/doc/install.texi | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 3192824..10bfcef 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2139,17 +2139,6 @@ Until all of the libraries are converted to use IEEE 128-bit floating point, it is not recommended to use @option{--with-long-double-format=ieee}. -On little endian PowerPC Linux systems, if you explicitly set the -@code{long double} type, it will build multilibs to allow you to -select either @code{long double} format, unless you disable multilibs -with the @code{--disable-multilib} option. At present, -@code{long double} multilibs are not built on big endian PowerPC Linux -systems. If you are building multilibs, you will need to configure -the compiler using the @option{--with-system-zlib} option. - -If you do not set the @code{long double} type explicitly, no multilibs -will be generated. - @item --enable-fdpic On SH Linux systems, generate ELF FDPIC code. -- cgit v1.1 From d8586b00dd00a1783862da5f0c8811a740400074 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 28 Apr 2022 13:46:15 -0400 Subject: analyzer: add .fpath.txt dumps to -fdump-analyzer-feasibility I found this extension to -fdump-analyzer-feasibility very helpful when debugging PR analyzer/105285. gcc/analyzer/ChangeLog: * diagnostic-manager.cc (epath_finder::process_worklist_item): Call dump_feasible_path when a path that reaches the the target enode is found. (epath_finder::dump_feasible_path): New. * engine.cc (feasibility_state::dump_to_pp): New. * exploded-graph.h (feasibility_state::dump_to_pp): New decl. * feasible-graph.cc (feasible_graph::dump_feasible_path): New. * feasible-graph.h (feasible_graph::dump_feasible_path): New decls. * program-point.cc (function_point::print): Fix missing trailing newlines. * program-point.h (program_point::print_source_line): Remove unimplemented decl. gcc/ChangeLog: * doc/invoke.texi (-fdump-analyzer-feasibility): Mention the fpath.txt output. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 07b4401..b2d2cea 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10198,8 +10198,8 @@ diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}. @opindex dump-analyzer-feasibility Dump internal details about the analyzer's search for feasible paths. The details are written in a form suitable for viewing with GraphViz -to filenames of the form @file{@var{file}.*.fg.dot} and -@file{@var{file}.*.tg.dot}. +to filenames of the form @file{@var{file}.*.fg.dot}, +@file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}. @item -fdump-analyzer-json @opindex fdump-analyzer-json -- cgit v1.1 From 39d80300b3c769c3a7805a46ee5facc6adf1a4d0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 30 Mar 2022 21:45:23 +0200 Subject: gcov: Add __gcov_filename_to_gcfn() gcc/ * doc/invoke.texi (fprofile-info-section): Mention __gcov_filename_to_gcfn(). Use "freestanding" to match with C11 standard language. Fix minor example code issues. * gcov-io.h (GCOV_FILENAME_MAGIC): Define and document. gcc/testsuite/ * gcc.dg/gcov-info-to-gcda.c: Test __gcov_filename_to_gcfn(). libgcc/ * gcov.h (__gcov_info_to_gcda): Mention __gcov_filename_to_gcfn(). (__gcov_filename_to_gcfn): Declare and document. * libgcov-driver.c (dump_string): New. (__gcov_filename_to_gcfn): Likewise. (__gcov_info_to_gcda): Adjust comment to match C11 standard language. --- gcc/doc/invoke.texi | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b2d2cea..7cff38b 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -15462,7 +15462,7 @@ profile information generated by @option{-fprofile-arcs} is placed in the specified section for each translation unit. This option disables the profile information registration through a constructor and it disables the profile information processing through a destructor. This option is not intended to be -used in hosted environments such as GNU/Linux. It targets free-standing +used in hosted environments such as GNU/Linux. It targets freestanding environments (for example embedded systems) with limited resources which do not support constructors/destructors or the C library file I/O. @@ -15487,14 +15487,8 @@ for example like this: #include #include -extern const struct gcov_info *__gcov_info_start[]; -extern const struct gcov_info *__gcov_info_end[]; - -static void -filename (const char *f, void *arg) -@{ - puts (f); -@} +extern const struct gcov_info *const __gcov_info_start[]; +extern const struct gcov_info *const __gcov_info_end[]; static void dump (const void *d, unsigned n, void *arg) @@ -15505,6 +15499,12 @@ dump (const void *d, unsigned n, void *arg) printf ("%02x", c[i]); @} +static void +filename (const char *f, void *arg) +@{ + __gcov_filename_to_gcfn (f, dump, arg ); +@} + static void * allocate (unsigned length, void *arg) @{ @@ -15514,8 +15514,8 @@ allocate (unsigned length, void *arg) static void dump_gcov_info (void) @{ - const struct gcov_info **info = __gcov_info_start; - const struct gcov_info **end = __gcov_info_end; + const struct gcov_info *const *info = __gcov_info_start; + const struct gcov_info *const *end = __gcov_info_end; /* Obfuscate variable to prevent compiler optimizations. */ __asm__ ("" : "+r" (info)); @@ -15530,9 +15530,9 @@ dump_gcov_info (void) @} int -main() +main (void) @{ - dump_gcov_info(); + dump_gcov_info (); return 0; @} @end smallexample -- cgit v1.1 From 210e32b60b9018e5db2d9741dc7aaa5d9b436999 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 30 Mar 2022 16:53:29 +0200 Subject: gcov-tool: Add merge-stream subcommand gcc/ * doc/gcov-tool.texi: Document merge-stream subcommand. * doc/invoke.texi (fprofile-info-section): Mention merge-stream subcommand of gcov-tool. * gcov-tool.cc (gcov_profile_merge_stream): Declare. (print_merge_stream_usage_message): New. (merge_stream_usage): Likewise. (do_merge_stream): Likewise. (print_usage): Call print_merge_stream_usage_message(). (main): Call do_merge_stream() to execute merge-stream subcommand. libgcc/ * libgcov-util.c (consume_stream): New. (get_target_profiles_for_merge): Likewise. (gcov_profile_merge_stream): Likewise. --- gcc/doc/gcov-tool.texi | 36 ++++++++++++++++++++++++++++++++++++ gcc/doc/invoke.texi | 5 +++++ 2 files changed, 41 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/gcov-tool.texi b/gcc/doc/gcov-tool.texi index d79dbc9..7715083 100644 --- a/gcc/doc/gcov-tool.texi +++ b/gcc/doc/gcov-tool.texi @@ -53,6 +53,10 @@ Current gcov-tool supports the following functionalities: merge two sets of profiles with weights. @item +read a stream of profiles with associated filenames and merge it with a set of +profiles with weights. + +@item read one set of profile and rewrite profile contents. One can scale or normalize the count values. @end itemize @@ -65,6 +69,12 @@ them. One can specify the weight to factor in the relative importance of each input. @item +Collect profiles from target systems without a filesystem (freestanding +environments). Merge the collected profiles with associated profiles +present on the host system. One can specify the weight to factor in the +relative importance of each input. + +@item Rewrite the profile after removing a subset of the gcda files, while maintaining the consistency of the summary and the histogram. @@ -117,6 +127,10 @@ gcov-tool merge [merge-options] @var{directory1} @var{directory2} [@option{-v}|@option{--verbose}] [@option{-w}|@option{--weight} @var{w1,w2}] +gcov-tool merge-stream [merge-stream-options] [@var{file}] + [@option{-v}|@option{--verbose}] + [@option{-w}|@option{--weight} @var{w1,w2}] + gcov-tool rewrite [rewrite-options] @var{directory} [@option{-n}|@option{--normalize} @var{long_long_value}] [@option{-o}|@option{--output} @var{directory}] @@ -169,6 +183,28 @@ Set the merge weights of the @var{directory1} and @var{directory2}, respectively. The default weights are 1 for both. @end table +@item merge-stream +Collect profiles with associated filenames from a @emph{gcfn} and @emph{gcda} +data stream. Read the stream from the file specified by @var{file} or from +@file{stdin}. Merge the profiles with associated profiles in the host +filesystem. Apply the optional weights while merging profiles. + +For the generation of a @emph{gcfn} and @emph{gcda} data stream on the target +system, please have a look at the @code{__gcov_filename_to_gcfn()} and +@code{__gcov_info_to_gcda()} functions declared in @code{#include }. +@table @gcctabopt + +@item -v +@itemx --verbose +Set the verbose mode. + +@item -w @var{w1},@var{w2} +@itemx --weight @var{w1},@var{w2} +Set the merge weights of the profiles from the @emph{gcfn} and @emph{gcda} data +stream and the associated profiles in the host filesystem, respectively. The +default weights are 1 for both. +@end table + @item rewrite Read the specified profile directory and rewrite to a new directory. @table @gcctabopt diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 7cff38b..3f4d6f2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -15537,6 +15537,11 @@ main (void) @} @end smallexample +The @command{merge-stream} subcommand of @command{gcov-tool} may be used to +deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and +@code{__gcov_info_to_gcda} functions and merge the profile information into +@file{.gcda} files on the host filesystem. + @item -fprofile-note=@var{path} @opindex fprofile-note -- cgit v1.1 From 9ae8b993cd362e8aea4f65580aaf1453120207f2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 8 Apr 2022 17:16:09 +0200 Subject: gcov: Add section for freestanding environments gcc/ * doc/gcov.texi (Profiling and Test Coverage in Freestanding Environments): New section. --- gcc/doc/gcov.texi | 389 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 389 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index fc39da0..a1f7d26 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -41,6 +41,8 @@ test code coverage in your programs. * Gcov and Optimization:: Using gcov with GCC optimization. * Gcov Data Files:: The files used by gcov. * Cross-profiling:: Data file relocation. +* Freestanding Environments:: How to use profiling and test + coverage in freestanding environments. @end menu @node Gcov Intro @@ -971,3 +973,390 @@ setting will name the data file @file{/target/run/build/foo.gcda}. You must move the data files to the expected directory tree in order to use them for profile directed optimizations (@option{-fprofile-use}), or to use the @command{gcov} tool. + +@node Freestanding Environments +@section Profiling and Test Coverage in Freestanding Environments + +In case your application runs in a hosted environment such as GNU/Linux, then +this section is likely not relevant to you. This section is intended for +application developers targeting freestanding environments (for example +embedded systems) with limited resources. In particular, systems or test cases +which do not support constructors/destructors or the C library file I/O. In +this section, the @dfn{target system} runs your application instrumented for +profiling or test coverage. You develop and analyze your application on the +@dfn{host system}. We now provide an overview how profiling and test coverage +can be obtained in this scenario followed by a tutorial which can be exercised +on the host system. Finally, some system initialization caveats are listed. + +@subsection Overview + +For an application instrumented for profiling or test coverage, the compiler +generates some global data structures which are updated by instrumentation code +while the application runs. These data structures are called the @dfn{gcov +information}. Normally, when the application exits, the gcov information is +stored to @file{.gcda} files. There is one file per translation unit +instrumented for profiling or test coverage. The function +@code{__gcov_exit()}, which stores the gcov information to a file, is called by +a global destructor function for each translation unit instrumented for +profiling or test coverage. It runs at process exit. In a global constructor +function, the @code{__gcov_init()} function is called to register the gcov +information of a translation unit in a global list. In some situations, this +procedure does not work. Firstly, if you want to profile the global +constructor or exit processing of an operating system, the compiler generated +functions may conflict with the test objectives. Secondly, you may want to +test early parts of the system initialization or abnormal program behaviour +which do not allow a global constructor or exit processing. Thirdly, you need +a filesystem to store the files. + +The @option{-fprofile-info-section} GCC option enables you to use profiling and +test coverage in freestanding environments. This option disables the use of +global constructors and destructors for the gcov information. Instead, a +pointer to the gcov information is stored in a special linker input section for +each translation unit which is compiled with this option. By default, the +section name is @code{.gcov_info}. The gcov information is statically +initialized. The pointers to the gcov information from all translation units +of an executable can be collected by the linker in a contiguous memory block. +For the GNU linker, the below linker script output section definition can be +used to achieve this: + +@smallexample + .gcov_info : + @{ + PROVIDE (__gcov_info_start = .); + KEEP (*(.gcov_info)) + PROVIDE (__gcov_info_end = .); + @} +@end smallexample + +The linker will provide two global symbols, @code{__gcov_info_start} and +@code{__gcov_info_end}, which define the start and end of the array of pointers +to gcov information blocks, respectively. The @code{KEEP ()} directive is +required to prevent a garbage collection of the pointers. They are not +directly referenced by anything in the executable. The section may be placed +in a read-only memory area. + +In order to transfer the profiling and test coverage data from the target to +the host system, the application has to provide a function to produce a +reliable in order byte stream from the target to the host. The byte stream may +be compressed and encoded using error detection and correction codes to meet +application-specific requirements. The GCC provided @file{libgcov} target +library provides two functions, @code{__gcov_info_to_gcda()} and +@code{__gcov_filename_to_gcfn()}, to generate a byte stream from a gcov +information bock. The functions are declared in @code{#include }. The +byte stream can be deserialized by the @command{merge-stream} subcommand of the +@command{gcov-tool} to create or update @file{.gcda} files in the host +filesystem for the instrumented application. + +@subsection Tutorial + +This tutorial should be exercised on the host system. We will build a program +instrumented for test coverage. The program runs an application and dumps the +gcov information to @file{stderr} encoded as a printable character stream. The +application simply decodes such character streams from @file{stdin} and writes +the decoded character stream to @file{stdout} (warning: this is binary data). +The decoded character stream is consumed by the @command{merge-stream} +subcommand of the @command{gcov-tool} to create or update the @file{.gcda} +files. + +To get started, create an empty directory. Change into the new directory. +Then you will create the following three files in this directory + +@enumerate +@item +@file{app.h} - a header file included by @file{app.c} and @file{main.c}, + +@item +@file{app.c} - a source file which contains an example application, and + +@item +@file{main.c} - a source file which contains the program main function and code +to dump the gcov information. +@end enumerate + +Firstly, create the header file @file{app.h} with the following content: + +@smallexample +static const unsigned char a = 'a'; + +static inline unsigned char * +encode (unsigned char c, unsigned char buf[2]) +@{ + buf[0] = c % 16 + a; + buf[1] = (c / 16) % 16 + a; + return buf; +@} + +extern void application (void); +@end smallexample + +Secondly, create the source file @file{app.c} with the following content: + +@smallexample +#include "app.h" + +#include + +/* The application reads a character stream encoded by encode() from stdin, + decodes it, and writes the decoded characters to stdout. Characters other + than the 16 characters 'a' to 'p' are ignored. */ + +static int can_decode (unsigned char c) +@{ + return (unsigned char)(c - a) < 16; +@} + +void +application (void) +@{ + int first = 1; + int i; + unsigned char c; + + while ((i = fgetc (stdin)) != EOF) + @{ + unsigned char x = (unsigned char)i; + + if (can_decode (x)) + @{ + if (first) + c = x - a; + else + fputc (c + 16 * (x - a), stdout); + first = !first; + @} + else + first = 1; + @} +@} +@end smallexample + +Thirdly, create the source file @file{main.c} with the following content: + +@smallexample +#include "app.h" + +#include +#include +#include + +/* The start and end symbols are provided by the linker script. We use the + array notation to avoid issues with a potential small-data area. */ + +extern const struct gcov_info *const __gcov_info_start[]; +extern const struct gcov_info *const __gcov_info_end[]; + +/* This function shall produce a reliable in order byte stream to transfer the + gcov information from the target to the host system. */ + +static void +dump (const void *d, unsigned n, void *arg) +@{ + (void)arg; + const unsigned char *c = d; + unsigned char buf[2]; + + for (unsigned i = 0; i < n; ++i) + fwrite (encode (c[i], buf), sizeof (buf), 1, stderr); +@} + +/* The filename is serialized to a gcfn data stream by the + __gcov_filename_to_gcfn() function. The gcfn data is used by the + "merge-stream" subcommand of the "gcov-tool" to figure out the filename + associated with the gcov information. */ + +static void +filename (const char *f, void *arg) +@{ + __gcov_filename_to_gcfn (f, dump, arg); +@} + +/* The __gcov_info_to_gcda() function may have to allocate memory under + certain conditions. Simply try it out if it is needed for your application + or not. */ + +static void * +allocate (unsigned length, void *arg) +@{ + (void)arg; + return malloc (length); +@} + +/* Dump the gcov information of all translation units. */ + +static void +dump_gcov_info (void) +@{ + const struct gcov_info *const *info = __gcov_info_start; + const struct gcov_info *const *end = __gcov_info_end; + + /* Obfuscate variable to prevent compiler optimizations. */ + __asm__ ("" : "+r" (info)); + + while (info != end) + @{ + void *arg = NULL; + __gcov_info_to_gcda (*info, filename, dump, allocate, arg); + fputc ('\n', stderr); + ++info; + @} +@} + +/* The main() function just runs the application and then dumps the gcov + information to stderr. */ + +int +main (void) +@{ + application (); + dump_gcov_info (); + return 0; +@} +@end smallexample + +If we compile @file{app.c} with test coverage and no extra profiling options, +then a global constructor (@code{_sub_I_00100_0} here, it may have a different +name in your environment) and destructor (@code{_sub_D_00100_1}) is used to +register and dump the gcov information, respectively. We also see undefined +references to @code{__gcov_init} and @code{__gcov_exit}: + +@smallexample +$ gcc --coverage -c app.c +$ nm app.o +0000000000000000 r a +0000000000000030 T application +0000000000000000 t can_decode + U fgetc + U fputc +0000000000000000 b __gcov0.application +0000000000000038 b __gcov0.can_decode +0000000000000000 d __gcov_.application +00000000000000c0 d __gcov_.can_decode + U __gcov_exit + U __gcov_init + U __gcov_merge_add + U stdin + U stdout +0000000000000161 t _sub_D_00100_1 +0000000000000151 t _sub_I_00100_0 +@end smallexample + +Compile @file{app.c} and @file{main.c} with test coverage and +@option{-fprofile-info-section}. Now, a read-only pointer size object is +present in the @code{.gcov_info} section and there are no undefined references +to @code{__gcov_init} and @code{__gcov_exit}: + +@smallexample +$ gcc --coverage -fprofile-info-section -c main.c +$ gcc --coverage -fprofile-info-section -c app.c +$ objdump -h app.o + +app.o: file format elf64-x86-64 + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 00000151 0000000000000000 0000000000000000 00000040 2**0 + CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE + 1 .data 00000100 0000000000000000 0000000000000000 000001a0 2**5 + CONTENTS, ALLOC, LOAD, RELOC, DATA + 2 .bss 00000040 0000000000000000 0000000000000000 000002a0 2**5 + ALLOC + 3 .rodata 0000003c 0000000000000000 0000000000000000 000002a0 2**3 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 4 .gcov_info 00000008 0000000000000000 0000000000000000 000002e0 2**3 + CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA + 5 .comment 0000004e 0000000000000000 0000000000000000 000002e8 2**0 + CONTENTS, READONLY + 6 .note.GNU-stack 00000000 0000000000000000 0000000000000000 00000336 2**0 + CONTENTS, READONLY + 7 .eh_frame 00000058 0000000000000000 0000000000000000 00000338 2**3 + CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA +@end smallexample + +We have to customize the program link procedure so that all the +@code{.gcov_info} linker input sections are placed in a contiguous memory block +with a begin and end symbol. Firstly, get the default linker script using the +following commands (we assume a GNU linker): + +@smallexample +$ ld --verbose | sed '1,/^===/d' | sed '/^===/d' > linkcmds +@end smallexample + +Secondly, open the file @file{linkcmds} with a text editor and place the linker +output section definition from the overview after the @code{.rodata} section +definition. Link the program executable using the customized linker script: + +@smallexample +$ gcc --coverage main.o app.o -T linkcmds -Wl,-Map,app.map +@end smallexample + +In the linker map file @file{app.map}, we see that the linker placed the +read-only pointer size objects of our objects files @file{main.o} and +@file{app.o} into a contiguous memory block and provided the symbols +@code{__gcov_info_start} and @code{__gcov_info_end}: + +@smallexample +$ grep -C 1 "\.gcov_info" app.map + +.gcov_info 0x0000000000403ac0 0x10 + 0x0000000000403ac0 PROVIDE (__gcov_info_start = .) + *(.gcov_info) + .gcov_info 0x0000000000403ac0 0x8 main.o + .gcov_info 0x0000000000403ac8 0x8 app.o + 0x0000000000403ad0 PROVIDE (__gcov_info_end = .) +@end smallexample + +Make sure no @file{.gcda} files are present. Run the program with nothing to +decode and dump @file{stderr} to the file @file{gcda-0.txt} (first run). Run +the program to decode @file{gcda-0.txt} and send it to the @command{gcov-tool} +using the @command{merge-stream} subcommand to create the @file{.gcda} files +(second run). Run @command{gcov} to produce a report for @file{app.c}. We see +that the first run with nothing to decode results in a partially covered +application: + +@smallexample +$ rm -f app.gcda main.gcda +$ echo "" | ./a.out 2>gcda-0.txt +$ ./a.out gcda-1.txt | gcov-tool merge-stream +$ gcov -bc app.c +File 'app.c' +Lines executed:69.23% of 13 +Branches executed:66.67% of 6 +Taken at least once:50.00% of 6 +Calls executed:66.67% of 3 +Creating 'app.c.gcov' + +Lines executed:69.23% of 13 +@end smallexample + +Run the program to decode @file{gcda-1.txt} and send it to the +@command{gcov-tool} using the @command{merge-stream} subcommand to update the +@file{.gcda} files. Run @command{gcov} to produce a report for @file{app.c}. +Since the second run decoded the gcov information of the first run, we have now +a fully covered application: + +@smallexample +$ ./a.out gcda-2.txt | gcov-tool merge-stream +$ gcov -bc app.c +File 'app.c' +Lines executed:100.00% of 13 +Branches executed:100.00% of 6 +Taken at least once:100.00% of 6 +Calls executed:100.00% of 3 +Creating 'app.c.gcov' + +Lines executed:100.00% of 13 +@end smallexample + +@subsection System Initialization Caveats + +The gcov information of a translation unit consists of several global data +structures. For example, the instrumented code may update program flow graph +edge counters in a zero-initialized data structure. It is safe to run +instrumented code before the zero-initialized data is cleared to zero. The +coverage information obtained before the zero-initialized data is cleared to +zero is unusable. Dumping the gcov information using +@code{__gcov_info_to_gcda()} before the zero-initialized data is cleared to +zero or the initialized data is loaded, is undefined behaviour. Clearing the +zero-initialized data to zero through a function instrumented for profiling or +test coverage is undefined behaviour, since it may produce inconsistent program +flow graph edge counters for example. -- cgit v1.1 From 69dd5ca3484ee514c1323dfbcf4ef4358cea57bb Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 18 Jun 2021 05:45:02 -0400 Subject: c++: add color to function decl printing In reading C++ diagnostics, it's often hard to find the name of the function in the middle of the template header, return type, parameters, and template arguments. So let's colorize it, and maybe the template argument bindings while we're at it. I've somewhat arbitrarily chosen bold green for the function name, and non-bold magenta for the template arguments. A side-effect of this is that when this happens in a quote (i.e. %qD), the rest of the quote after the function name is no longer bold. I think that's acceptable; returning to the bold would require maintaining a colorize stack instead of the on/off controls we have now. gcc/cp/ChangeLog: * error.cc (decl_to_string): Add show_color parameter. (subst_to_string): Likewise. (cp_printer): Pass it. (type_to_string): Set pp_show_color. (dump_function_name): Use "fnname" color. (dump_template_bindings): Use "targs" color. (struct colorize_guard): New. (reinit_cxx_pp): Clear pp_show_color. gcc/ChangeLog: * diagnostic-color.cc: Add fnname and targs color entries. * doc/invoke.texi: Document them. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/function-color1.C: New test. --- gcc/doc/invoke.texi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3f4d6f2..7a35d96 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4845,7 +4845,7 @@ The default @env{GCC_COLORS} is error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\ quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\ diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ -type-diff=01;32 +type-diff=01;32:fnname=01;32:targs=35 @end smallexample @noindent where @samp{01;31} is bold red, @samp{01;35} is bold magenta, @@ -4890,6 +4890,14 @@ SGR substring for location information, @samp{file:line} or @vindex quote GCC_COLORS @r{capability} SGR substring for information printed within quotes. +@item fnname= +@vindex fnname GCC_COLORS @r{capability} +SGR substring for names of C++ functions. + +@item targs= +@vindex targs GCC_COLORS @r{capability} +SGR substring for C++ function template parameter bindings. + @item fixit-insert= @vindex fixit-insert GCC_COLORS @r{capability} SGR substring for fix-it hints suggesting text to -- cgit v1.1 From 79b9d83947e137fbbd85ac6593df4e27fe37cef3 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Tue, 10 May 2022 16:00:05 +0000 Subject: doc: Fix mode iterator example The example missed the mode condition in the replacement text. 2022-05-10 Segher Boessenkool * doc/md.texi (Defining Mode Iterators): Correct example replacement text. --- gcc/doc/md.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 3b54435..463471f 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -11510,7 +11510,7 @@ This is exactly equivalent to: [(set (match_operand:DI 0 "register_operand" "=d") (minus:DI (match_operand:DI 1 "register_operand" "d") (match_operand:DI 2 "register_operand" "d")))] - "" + "TARGET_64BIT" "dsubu\t%0,%1,%2" [(set_attr "type" "arith") (set_attr "mode" "DI")]) -- cgit v1.1 From 8fa689767a8a55c889683d178ae3a003ec689927 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 11 May 2022 13:21:26 +0200 Subject: docs: document --with-zstd PR other/105527 gcc/ChangeLog: * doc/install.texi: Document the configure option --with-zstd. --- gcc/doc/install.texi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 10bfcef..7639230 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2371,6 +2371,11 @@ For a native build and cross compiles that have target headers, the option's default is derived from glibc's behavior. When glibc clamps float_t to double, GCC follows and enables the option. For other cross compiles, the default is disabled. + +@item --with-zstd +Specify prefix directory for installed zstd library. +Equivalent to @option{--with-zstd-include=PATH/include} plus +@option{--with-zstd-lib=PATH/lib}. @end table @subheading Cross-Compiler-Specific Options -- cgit v1.1 From 876ac21b7e796f9efb859dfb46ae2a4126b0b782 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 6 Apr 2022 12:26:13 +0200 Subject: libgomp: Remove unused '--with-hsa-runtime', '--with-hsa-runtime-include', '--with-hsa-runtime-lib' With recent commit 2e309a4eff80e55b53d32d26926a2a94eabfea21 "libgomp testsuite: Don't amend 'LD_LIBRARY_PATH' for system-provided HSA Runtime library", and commit d6adba307508c75f1ccb2121eb1a43c9ab1d4056 "libgomp GCN plugin: Clean up unused references to system-provided HSA Runtime library", the last uses of '--with-hsa-runtime' etc. are gone. gcc/ * doc/install.texi: Don't document '--with-hsa-runtime', '--with-hsa-runtime-include', '--with-hsa-runtime-lib'. libgomp/ * plugin/configfrag.ac: Remove '--with-hsa-runtime', '--with-hsa-runtime-include', '--with-hsa-runtime-lib' processing. * Makefile.in: Regenerate. * configure: Likewise. * testsuite/Makefile.in: Likewise. --- gcc/doc/install.texi | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 7639230..042241e 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2329,18 +2329,6 @@ those are in separate optional packages and where the presence or absence of those optional packages should determine the actual supported offloading target set rather than the GCC configure-time selection. -@item --with-hsa-runtime=@var{pathname} -@itemx --with-hsa-runtime-include=@var{pathname} -@itemx --with-hsa-runtime-lib=@var{pathname} - -If you configure GCC with offloading which uses an HSA run-time such as -AMDGCN but do not have the HSA run-time library installed in a standard -location then you can explicitly specify the directory where they are -installed. The @option{--with-hsa-runtime=@/@var{hsainstalldir}} option -is a shorthand for -@option{--with-hsa-runtime-lib=@/@var{hsainstalldir}/lib} and -@option{--with-hsa-runtime-include=@/@var{hsainstalldir}/include}. - @item --enable-cet @itemx --disable-cet Enable building target run-time libraries with control-flow -- cgit v1.1 From 16f7fcadac19dabd04a5abbe6601df52d22e9685 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Fri, 1 Apr 2022 14:42:58 +0200 Subject: RISC-V: Implement C[LT]Z_DEFINED_VALUE_AT_ZERO The Zbb support has introduced ctz and clz to the backend, but some transformations in GCC need to know what the value of c[lt]z at zero is. This affects how the optab is generated and may suppress use of CLZ/CTZ in tree passes. Among other things, this is needed for the transformation of table-based ctz-implementations, such as in deepsjeng, to work (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90838). Prior to this change, the test case from PR90838 would compile to on RISC-V targets with Zbb: myctz: lui a4,%hi(.LC0) ld a4,%lo(.LC0)(a4) neg a5,a0 and a5,a5,a0 mul a5,a5,a4 lui a4,%hi(.LANCHOR0) addi a4,a4,%lo(.LANCHOR0) srli a5,a5,58 sh2add a5,a5,a4 lw a0,0(a5) ret After this change, we get: myctz: ctz a0,a0 andi a0,a0,63 ret Testing this with deepsjeng_r (from SPEC 2017) against QEMU, this shows a clear reduction in dynamic instruction count: - before 1961888067076 - after 1907928279874 (2.75% reduction) This also merges the various target-specific test-cases (for x86-64, aarch64 and riscv) within gcc.dg/pr90838.c. This extends the macros (i.e., effective-target keywords) used in testing (lib/target-supports.exp) to reliably distinguish between RV32 and RV64 via __riscv_xlen (i.e., the integer register bitwidth) : testing for ILP32 could be misleading (as ILP32 is a valid memory model for 64bit systems). gcc/ChangeLog: * config/riscv/riscv.h (CLZ_DEFINED_VALUE_AT_ZERO): Implement. (CTZ_DEFINED_VALUE_AT_ZERO): Same. * doc/sourcebuild.texi: add documentation for RISC-V specific test target keywords gcc/testsuite/ChangeLog: * gcc.dg/pr90838.c: Add additional flags (dg-additional-options) when compiling for riscv64 and subsume gcc.target/aarch64/pr90838.c and gcc.target/i386/pr95863-2.c. * gcc.target/aarch64/pr90838.c: Removed. * gcc.target/i386/pr95863-2.c: Removed. * lib/target-supports.exp: Recognize RV32 or RV64 via XLEN Signed-off-by: Philipp Tomsich Signed-off-by: Manolis Tsamis Co-authored-by: Manolis Tsamis --- gcc/doc/sourcebuild.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 613ac29..71c0484 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2420,6 +2420,18 @@ PowerPC target pre-defines macro _ARCH_PWR9 which means the @code{-mcpu} setting is Power9 or later. @end table +@subsection RISC-V specific attributes + +@table @code + +@item rv32 +Test system has an integer register width of 32 bits. + +@item rv64 +Test system has an integer register width of 64 bits. + +@end table + @subsubsection Other hardware attributes @c Please keep this table sorted alphabetically. -- cgit v1.1 From 2402dc6b982c4dacac2360830f0edc123c588110 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 16 May 2022 15:32:11 -0400 Subject: analyzer: implement four new warnings for misuses [PR105103] This patch adds support to the analyzer for checking usage of , with four new warnings. It adds: (a) a state-machine for tracking "started" and "ended" states on va_list instances, implementing two new warnings: -Wanalyzer-va-list-leak for complaining about missing va_end after a va_start or va_copy -Wanalyzer-va-list-use-after-va-end: for complaining about va_arg or va_copy used on a va_list that's had va_end called on it (b) interprocedural tracking of variadic parameters, tracking symbolic values, implementing two new warnings: -Wanalyzer-va-arg-type-mismatch for type-checking va_arg usage against the types of the parameters that were actually passed to the variadic call -Wanalyzer-va-list-exhausted for complaining if va_arg is used too many times on a va_list Here's an LTO example of a type mismatch in a variadic call that straddles two source files: stdarg-lto-1-a.c: In function 'called_by_test_type_mismatch_1': stdarg-lto-1-a.c:19:7: warning: 'va_arg' expected 'const char *' but received 'int' for variadic argument 1 of 'ap' [-Wanalyzer-va-arg-type-mismatch] 19 | str = va_arg (ap, const char *); | ^ 'test_type_mismatch_1': events 1-2 | |stdarg-lto-1-b.c:3:6: | 3 | void test_type_mismatch_1 (void) | | ^ | | | | | (1) entry to 'test_type_mismatch_1' | 4 | { | 5 | called_by_test_type_mismatch_1 (42, 1066); | | ~ | | | | | (2) calling 'called_by_test_type_mismatch_1' from 'test_type_mismatch_1' with 1 variadic argument | +--> 'called_by_test_type_mismatch_1': events 3-4 | |stdarg-lto-1-a.c:12:1: | 12 | called_by_test_type_mismatch_1 (int placeholder, ...) | | ^ | | | | | (3) entry to 'called_by_test_type_mismatch_1' |...... | 19 | str = va_arg (ap, const char *); | | ~ | | | | | (4) 'va_arg' expected 'const char *' but received 'int' for variadic argument 1 of 'ap' | gcc/ChangeLog: PR analyzer/105103 * Makefile.in (ANALYZER_OBJS): Add analyzer/varargs.o. * doc/invoke.texi: Add -Wanalyzer-va-arg-type-mismatch, -Wanalyzer-va-list-exhausted, -Wanalyzer-va-list-leak, and -Wanalyzer-va-list-use-after-va-end. gcc/analyzer/ChangeLog: PR analyzer/105103 * analyzer.cc (make_label_text_n): New. * analyzer.h (class var_arg_region): New forward decl. (make_label_text_n): New decl. * analyzer.opt (Wanalyzer-va-arg-type-mismatch): New option. (Wanalyzer-va-list-exhausted): New option. (Wanalyzer-va-list-leak): New option. (Wanalyzer-va-list-use-after-va-end): New option. * checker-path.cc (call_event::get_desc): Split out decl access into.. (call_event::get_caller_fndecl): ...this new function and... (call_event::get_callee_fndecl): ...this new function. * checker-path.h (call_event::get_desc): Drop "FINAL". (call_event::get_caller_fndecl): New decl. (call_event::get_callee_fndecl): New decl. (class call_event): Make fields protected. * diagnostic-manager.cc (null_assignment_sm_context::warn): New overload. (null_assignment_sm_context::get_new_program_state): New. (diagnostic_manager::add_events_for_superedge): Move case SUPEREDGE_CALL to a new pending_diagnostic::add_call_event vfunc. * engine.cc (impl_sm_context::warn): Implement new override. (impl_sm_context::get_new_program_state): New. * pending-diagnostic.cc: Include "analyzer/diagnostic-manager.h", "cpplib.h", "digraph.h", "ordered-hash-map.h", "cfg.h", "basic-block.h", "gimple.h", "gimple-iterator.h", "cgraph.h" "analyzer/supergraph.h", "analyzer/program-state.h", "alloc-pool.h", "fibonacci_heap.h", "shortest-paths.h", "sbitmap.h", "analyzer/exploded-graph.h", "diagnostic-path.h", and "analyzer/checker-path.h". (ht_ident_eq): New. (fixup_location_in_macro_p): New. (pending_diagnostic::fixup_location): New. (pending_diagnostic::add_call_event): New. * pending-diagnostic.h (pending_diagnostic::fixup_location): Drop no-op inline implementation in favor of the more complex implementation above. (pending_diagnostic::add_call_event): New vfunc. * region-model-impl-calls.cc: Include "analyzer/sm.h", "diagnostic-path.h", and "analyzer/pending-diagnostic.h". * region-model-manager.cc (region_model_manager::get_var_arg_region): New. (region_model_manager::log_stats): Log m_var_arg_regions. * region-model.cc (region_model::on_call_pre): Handle IFN_VA_ARG, BUILT_IN_VA_START, and BUILT_IN_VA_COPY. (region_model::on_call_post): Handle BUILT_IN_VA_END. (region_model::get_representative_path_var_1): Handle RK_VAR_ARG. (region_model::push_frame): Push variadic arguments. * region-model.h (region_model_manager::get_var_arg_region): New decl. (region_model_manager::m_var_arg_regions): New field. (region_model::impl_call_va_start): New decl. (region_model::impl_call_va_copy): New decl. (region_model::impl_call_va_arg): New decl. (region_model::impl_call_va_end): New decl. * region.cc (alloca_region::dump_to_pp): Dump the id. (var_arg_region::dump_to_pp): New. (var_arg_region::get_frame_region): New. * region.h (enum region_kind): Add RK_VAR_ARG. (region::dyn_cast_var_arg_region): New. (class var_arg_region): New. (is_a_helper ::test): New. (struct default_hash_traits): New. * sm.cc (make_checkers): Call make_va_list_state_machine. * sm.h (sm_context::warn): New vfunc. (sm_context::get_old_svalue): Drop unused decl. (sm_context::get_new_program_state): New vfunc. (make_va_list_state_machine): New decl. * varargs.cc: New file. gcc/testsuite/ChangeLog: PR analyzer/105103 * gcc.dg/analyzer/stdarg-1.c: New test. * gcc.dg/analyzer/stdarg-2.c: New test. * gcc.dg/analyzer/stdarg-fmtstring-1.c: New test. * gcc.dg/analyzer/stdarg-lto-1-a.c: New test. * gcc.dg/analyzer/stdarg-lto-1-b.c: New test. * gcc.dg/analyzer/stdarg-lto-1.h: New test. * gcc.dg/analyzer/stdarg-sentinel-1.c: New test. * gcc.dg/analyzer/stdarg-types-1.c: New test. * gcc.dg/analyzer/stdarg-types-2.c: New test. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 7a35d96..e8e6d4e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -464,6 +464,10 @@ Objective-C and Objective-C++ Dialects}. -Wno-analyzer-use-after-free @gol -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol -Wno-analyzer-use-of-uninitialized-value @gol +-Wno-analyzer-va-arg-type-mismatch @gol +-Wno-analyzer-va-list-exhausted @gol +-Wno-analyzer-va-list-leak @gol +-Wno-analyzer-va-list-use-after-va-end @gol -Wno-analyzer-write-to-const @gol -Wno-analyzer-write-to-string-literal @gol } @@ -9689,6 +9693,10 @@ Enabling this option effectively enables the following warnings: -Wanalyzer-use-after-free @gol -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol -Wanalyzer-use-of-uninitialized-value @gol +-Wanalyzer-va-arg-type-mismatch @gol +-Wanalyzer-va-list-exhausted @gol +-Wanalyzer-va-list-leak @gol +-Wanalyzer-va-list-use-after-va-end @gol -Wanalyzer-write-to-const @gol -Wanalyzer-write-to-string-literal @gol } @@ -9971,6 +9979,53 @@ to disable it. This diagnostic warns for paths through the code in which a pointer is dereferenced that points to a variable in a stale stack frame. +@item -Wno-analyzer-va-arg-type-mismatch +@opindex Wanalyzer-va-arg-type-mismatch +@opindex Wno-analyzer-va-arg-type-mismatch +This warning requires @option{-fanalyzer}, which enables it; use +@option{-Wno-analyzer-va-arg-type-mismatch} +to disable it. + +This diagnostic warns for interprocedural paths through the code for which +the analyzer detects an attempt to use @code{va_arg} to extract a value +passed to a variadic call, but uses a type that does not match that of +the expression passed to the call. + +@item -Wno-analyzer-va-list-exhausted +@opindex Wanalyzer-va-list-exhausted +@opindex Wno-analyzer-va-list-exhausted +This warning requires @option{-fanalyzer}, which enables it; use +@option{-Wno-analyzer-va-list-exhausted} +to disable it. + +This diagnostic warns for interprocedural paths through the code for which +the analyzer detects an attempt to use @code{va_arg} to access the next +value passed to a variadic call, but all of the values in the +@code{va_list} have already been consumed. + +@item -Wno-analyzer-va-list-leak +@opindex Wanalyzer-va-list-leak +@opindex Wno-analyzer-va-list-leak +This warning requires @option{-fanalyzer}, which enables it; use +@option{-Wno-analyzer-va-list-leak} +to disable it. + +This diagnostic warns for interprocedural paths through the code for which +the analyzer detects that @code{va_start} or @code{va_copy} has been called +on a @code{va_list} without a corresponding call to @code{va_end}. + +@item -Wno-analyzer-va-list-use-after-va-end +@opindex Wanalyzer-va-list-use-after-va-end +@opindex Wno-analyzer-va-list-use-after-va-end +This warning requires @option{-fanalyzer}, which enables it; use +@option{-Wno-analyzer-va-list-use-after-va-end} +to disable it. + +This diagnostic warns for interprocedural paths through the code for which +the analyzer detects an attempt to use a @code{va_list} after +@code{va_end} has been called on it. +@code{va_list}. + @item -Wno-analyzer-write-to-const @opindex Wanalyzer-write-to-const @opindex Wno-analyzer-write-to-const -- cgit v1.1 From 7da9a089608b0ca09683332ce014fb6184842724 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 1 Apr 2022 16:55:58 -0400 Subject: c: Implement new -Wenum-int-mismatch warning [PR105131] In C, an enumerated type is compatible with char, a signed integer type, or an unsigned integer type (6.7.2.2/5). Therefore this code compiles: enum E { l = -1, z = 0, g = 1 }; int foo(void); enum E foo(void) { return z; } if the underlying type of 'enum E' is 'int' (if not, we emit an error). This is different for typedefs, where C11 permits typedefs to be redeclared to the same type, but not to compatible types. In C++, the code above is invalid. It seems desirable to emit a warning in the C case, because it is probably a mistake and definitely a portability error, given that the choice of the underlying type is implementation-defined. To that end, this patch implements a new -Wenum-int-mismatch warning. Conveniently, we already have comptypes_check_enum_int to detect such mismatches. This warning is enabled by either -Wall or -Wc++-compat. PR c/105131 gcc/c-family/ChangeLog: * c.opt (Wenum-int-mismatch): New. gcc/c/ChangeLog: * c-decl.cc (diagnose_mismatched_decls): Warn about enum/integer type mismatches. * c-tree.h (comptypes_check_enum_int): Declare. * c-typeck.cc (comptypes): No longer static. gcc/ChangeLog: * doc/invoke.texi: Document -Wenum-int-mismatch. gcc/testsuite/ChangeLog: * gcc.dg/Wenum-int-mismatch-1.c: New test. * gcc.dg/Wenum-int-mismatch-2.c: New test. * gcc.dg/Wenum-int-mismatch-3.c: New test. * gcc.dg/Wenum-int-mismatch-4.c: New test. * gcc.dg/Wenum-int-mismatch-5.c: New test. --- gcc/doc/invoke.texi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e8e6d4e..98a543a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -349,6 +349,7 @@ Objective-C and Objective-C++ Dialects}. -Wno-div-by-zero -Wdouble-promotion @gol -Wduplicated-branches -Wduplicated-cond @gol -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol +-Wenum-int-mismatch @gol -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol -Wno-format-contains-nul -Wno-format-extra-args @gol @@ -5759,6 +5760,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}. -Wdangling-pointer=2 @gol -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol +-Wenum-int-mismatch @r{(C and Objective-C only)} @gol -Wformat @gol -Wformat-overflow @gol -Wformat-truncation @gol @@ -8735,6 +8737,25 @@ Warn when a value of enumerated type is implicitly converted to a different enumerated type. This warning is enabled by @option{-Wextra} in C@. +@item -Wenum-int-mismatch @r{(C and Objective-C only)} +@opindex Wenum-int-mismatch +@opindex Wno-enum-int-mismatch +Warn about mismatches between an enumerated type and an integer type in +declarations. For example: + +@smallexample +enum E @{ l = -1, z = 0, g = 1 @}; +int foo(void); +enum E foo(void); +@end smallexample + +In C, an enumerated type is compatible with @code{char}, a signed +integer type, or an unsigned integer type. However, since the choice +of the underlying type of an enumerated type is implementation-defined, +such mismatches may cause portability issues. In C++, such mismatches +are an error. In C, this warning is enabled by @option{-Wall} and +@option{-Wc++-compat}. + @item -Wjump-misses-init @r{(C, Objective-C only)} @opindex Wjump-misses-init @opindex Wno-jump-misses-init -- cgit v1.1 From 19258b113872bd6774f215c63d82dc48ee1198b6 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 19 May 2022 08:50:54 -0400 Subject: analyzer: update docs about -fanalyzer-checker=taint gcc/ChangeLog: * doc/invoke.texi (-fanalyzer-checker=): Add -Wanalyzer-va-list-leak and -Wanalyzer-va-list-use-after-va-end to the list of analyzer warnings disabled by -fanalyzer-checker=taint. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 98a543a..d8095e3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10129,6 +10129,8 @@ following warnings from @option{-fanalyzer}: -Wanalyzer-possible-null-dereference @gol -Wanalyzer-unsafe-call-within-signal-handler @gol -Wanalyzer-use-after-free @gol +-Wanalyzer-va-list-leak @gol +-Wanalyzer-va-list-use-after-va-end @gol } @item -fno-analyzer-feasibility -- cgit v1.1 From 096eaeac38fa4acc50a4784f3242db5ae8a08262 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 22 Apr 2022 17:14:56 +0100 Subject: testsuite: enable more BID DFP tests for AArch64 Some tests for the BID format are currently restricted to i?86 and x86_64, but they also pass on AArch64, so this patch enables them. Since all these tests are related to the BID format, it seems useful to introduce a new effective-target (dfp_bid) instead of adding aarch64 to the current target list. 2022-04-28 Christophe Lyon gcc/ * doc/sourcebuild.texi (Decimal floating point attributes): Document dfp_bid effective-target. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_dfp_bid): New. * gcc.dg/dfp/bid-non-canonical-d128-1.c: Use dfp_bid effective-target. * gcc.dg/dfp/bid-non-canonical-d128-2.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-3.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-4.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d32-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d32-2.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d64-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d64-2.c: Likewise. --- gcc/doc/sourcebuild.texi | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 71c0484..d465b04 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1937,6 +1937,9 @@ test system can execute decimal floating point tests. @item hard_dfp Target generates decimal floating point instructions with current options. + +@item dfp_bid +Target uses the BID format for decimal floating point. @end table @subsubsection ARM-specific attributes -- cgit v1.1 From a239aff82c3771242d957c0f744cf62b42ed2f2a Mon Sep 17 00:00:00 2001 From: Mayshao Date: Mon, 23 May 2022 17:05:31 +0200 Subject: [x86_64]: Zhaoxin lujiazui enablement This patch fix Zhaoxin CPU vendor ID detection problem and add zhaoxin "lujiazui" processor support. Currently gcc can't recognize Zhaoxin CPU (vendor ID "CentaurHauls" and "Shanghai") if user use -march=native option, which is confusing for users. This patch enables -march=native in zhaoxin family 7th processor and -march/-mtune=lujiazui, costs and tunning are set according to the characteristics of the processor. We add a new md file to describe lujiazui pipeline. Testing: Bootstrap is ok, and no regressions for i386/x86-64 testsuite. Background: Related Zhaoxin linux kernel patch can be found at: https://lore.kernel.org/lkml/01042674b2f741b2aed1f797359bdffb@zhaoxin.com/ Related Zhaoxin glibc patch can be found at: https://sourceware.org/git/?p=glibc.git;a=commit;h=32ac0b988466785d6e3cc1dffc364bb26fc63193 gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_zhaoxin_cpu): Detect the specific type of Zhaoxin CPU, and return Zhaoxin CPU name. (cpu_indicator_init): Handle Zhaoxin processors. * common/config/i386/i386-common.cc: Add lujiazui. * common/config/i386/i386-cpuinfo.h (enum processor_vendor): Add VENDOR_ZHAOXIN. (enum processor_types): Add ZHAOXIN_FAM7H. (enum processor_subtypes): Add ZHAOXIN_FAM7H_LUJIAZUI. * config.gcc: Add lujiazui. * config/i386/cpuid.h (signature_SHANGHAI_ebx): Add Signatures for zhaoxin (signature_SHANGHAI_ecx): Ditto. (signature_SHANGHAI_edx): Ditto. * config/i386/driver-i386.cc (host_detect_local_cpu): Let -march=native recognize lujiazui processors. * config/i386/i386-c.cc (ix86_target_macros_internal): Add lujiazui. * config/i386/i386-options.cc (m_LUJIAZUI): New_definition. * config/i386/i386.h (enum processor_type): Ditto. * config/i386/i386.md: Add lujiazui. * config/i386/x86-tune-costs.h (struct processor_costs): Add lujiazui costs. * config/i386/x86-tune-sched.cc (ix86_issue_rate): Add lujiazui. (ix86_adjust_cost): Ditto. * config/i386/x86-tune.def (X86_TUNE_SCHEDULE): Add lujiazui Tunnings. (X86_TUNE_PARTIAL_REG_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY): Ditto. (X86_TUNE_MOVX): Ditto. (X86_TUNE_MEMORY_MISMATCH_STALL): Ditto. (X86_TUNE_FUSE_CMP_AND_BRANCH_32): Ditto. (X86_TUNE_FUSE_CMP_AND_BRANCH_64): Ditto. (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS): Ditto. (X86_TUNE_FUSE_ALU_AND_BRANCH): Ditto. (X86_TUNE_ACCUMULATE_OUTGOING_ARGS): Ditto. (X86_TUNE_USE_LEAVE): Ditto. (X86_TUNE_PUSH_MEMORY): Ditto. (X86_TUNE_LCP_STALL): Ditto. (X86_TUNE_USE_INCDEC): Ditto. (X86_TUNE_INTEGER_DFMODE_MOVES): Ditto. (X86_TUNE_OPT_AGU): Ditto. (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB): Ditto. (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES): Ditto. (X86_TUNE_USE_SAHF): Ditto. (X86_TUNE_USE_BT): Ditto. (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI): Ditto. (X86_TUNE_ONE_IF_CONV_INSN): Ditto. (X86_TUNE_AVOID_MFENCE): Ditto. (X86_TUNE_EXPAND_ABS): Ditto. (X86_TUNE_USE_SIMODE_FIOP): Ditto. (X86_TUNE_USE_FFREEP): Ditto. (X86_TUNE_EXT_80387_CONSTANTS): Ditto. (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL): Ditto. (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL): Ditto. (X86_TUNE_SSE_TYPELESS_STORES): Ditto. (X86_TUNE_SSE_LOAD0_BY_PXOR): Ditto. * doc/extend.texi: Add details about lujiazui. * doc/invoke.texi: Add details about lujiazui. * config/i386/lujiazui.md: Introduce lujiazui cpu and include new md file. gcc/testsuite/ChangeLog: * gcc.target/i386/funcspec-56.inc: Test -arch=lujiauzi and -tune=lujiazui. * g++.target/i386/mv32.C: Ditto. Signed-off-by: mayshao --- gcc/doc/extend.texi | 3 +++ gcc/doc/invoke.texi | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 84e6f66..a2e2a30 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -21840,6 +21840,9 @@ Intel Knights Landing CPU. @item knm Intel Knights Mill CPU. +@item lujiazui +ZHAOXIN lujiazui CPU. + @item amdfam10h AMD Family 10h CPU. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d8095e3..8becba3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -31816,6 +31816,11 @@ VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling is implemented for this chip.) +@item lujiazui +ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, +SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16, +ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support. + @item geode AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. @end table -- cgit v1.1 From 3677eb80b683cead7db972bc206fd2e75d997bd2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 11 May 2022 17:10:07 +0200 Subject: Extend --with-zstd documentation The patch that was so far added for documenting --with-zstd is pretty minimal: - it refers to undocumented options --with-zstd-include and --with-zstd-lib; - it suggests that --with-zstd can be used without an argument; - it does not clarify how this option applies to cross-compilation. How about adding the same details as for the --with-isl, --with-isl-include, --with-isl-lib options, mutatis mutandis? This patch does that. PR other/105527 gcc/ChangeLog: * doc/install.texi (Configuration): Add more details about --with-zstd. Document --with-zstd-include and --with-zstd-lib Signed-off-by: Bruno Haible --- gcc/doc/install.texi | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 042241e..ed0d1d8 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2360,10 +2360,20 @@ default is derived from glibc's behavior. When glibc clamps float_t to double, GCC follows and enables the option. For other cross compiles, the default is disabled. -@item --with-zstd -Specify prefix directory for installed zstd library. -Equivalent to @option{--with-zstd-include=PATH/include} plus -@option{--with-zstd-lib=PATH/lib}. +@item --with-zstd=@var{pathname} +@itemx --with-zstd-include=@var{pathname} +@itemx --with-zstd-lib=@var{pathname} +If you do not have the @code{zstd} library installed in a standard +location and you want to build GCC, you can explicitly specify the +directory where it is installed (@samp{--with-zstd=@/@var{zstdinstalldir}}). +The @option{--with-zstd=@/@var{zstdinstalldir}} option is shorthand for +@option{--with-zstd-lib=@/@var{zstdinstalldir}/lib} and +@option{--with-zstd-include=@/@var{zstdinstalldir}/include}. If this +shorthand assumption is not correct, you can use the explicit +include and lib options directly. + +These flags are applicable to the host platform only. When building +a cross compiler, they will not be used to configure target libraries. @end table @subheading Cross-Compiler-Specific Options -- cgit v1.1 From 2f4f7de787e5844515d27b2269fc472f95a9916a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 11 Mar 2022 12:51:34 -0800 Subject: x86: Document -mcet-switch When -fcf-protection=branch is used, the compiler will generate jump tables for switch statements where the indirect jump is prefixed with the NOTRACK prefix, so it can jump to non-ENDBR targets. Since the indirect jump targets are generated by the compiler and stored in read-only memory, this does not result in a direct loss of hardening. But if the jump table index is attacker-controlled, the indirect jump may not be constrained by CET. Document -mcet-switch to generate jump tables for switch statements with ENDBR and skip the NOTRACK prefix for indirect jump. This option should be used when the NOTRACK prefix is disabled. PR target/104816 * config/i386/i386.opt: Remove Undocumented. * doc/invoke.texi: Document -mcet-switch. --- gcc/doc/invoke.texi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8becba3..a2f85f0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1425,7 +1425,8 @@ See RS/6000 and PowerPC Options. -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol --mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol +-mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call @gol +-mavx512vbmi2 -mavx512bf16 -menqcmd @gol -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol @@ -32724,6 +32725,17 @@ function attribute. This is useful when used with the option @option{-fcf-protection=branch} to control ENDBR insertion at the function entry. +@item -mcet-switch +@opindex mcet-switch +By default, CET instrumentation is turned off on switch statements that +use a jump table and indirect branch track is disabled. Since jump +tables are stored in read-only memory, this does not result in a direct +loss of hardening. But if the jump table index is attacker-controlled, +the indirect jump may not be constrained by CET. This option turns on +CET instrumentation to enable indirect branch track for switch statements +with jump tables which leads to the jump targets reachable via any indirect +jumps. + @item -mcall-ms2sysv-xlogues @opindex mcall-ms2sysv-xlogues @opindex mno-call-ms2sysv-xlogues -- cgit v1.1 From ae8decf1d2b8329af59592b4fa78ee8dfab3ba5e Mon Sep 17 00:00:00 2001 From: Prathamesh Kulkarni Date: Wed, 25 May 2022 00:26:28 +0530 Subject: Add new parameter to vec_perm_const hook for specifying operand mode. The rationale of the patch is to support vec_perm_expr of the form: lhs = vec_perm_expr where lhs and rhs are vector types with different lengths but have same element type. For example, lhs is SVE vector and rhs is corresponding AdvSIMD vector. It would also allow to express extract even/odd and interleave operations with a VEC_PERM_EXPR. The interleave currently has the issue that we have to artificially widen the inputs with "dont-care" elements. gcc/ChangeLog: * target.def (vec_perm_const): Define new parameter op_mode and update doc. * doc/tm.texi: Regenerate. * config/aarch64/aarch64.cc (aarch64_vectorize_vec_perm_const): Adjust vec_perm_const hook to add new parameter op_mode and return false if result and operand modes do not match. * config/arm/arm.cc (arm_vectorize_vec_perm_const): Likewise. * config/gcn/gcn.cc (gcn_vectorize_vec_perm_const): Likewise. * config/ia64/ia64.cc (ia64_vectorize_vec_perm_const): Likewise. * config/mips/mips.cc (mips_vectorize_vec_perm_const): Likewise. * config/rs6000/rs6000.cc (rs6000_vectorize_vec_perm_const): Likewise * config/s390/s390.cc (s390_vectorize_vec_perm_const): Likewise. * config/sparc/sparc.cc (sparc_vectorize_vec_perm_const): Likewise. * config/i386/i386-expand.cc (ix86_vectorize_vec_perm_const): Likewise. * config/i386/i386-expand.h (ix86_vectorize_vec_perm_const): Adjust prototype. * config/i386/sse.md (ashrv4di3): Adjust call to vec_perm_const hook. (ashrv2di3): Likewise. * optabs.cc (expand_vec_perm_const): Likewise. * optabs-query.h (can_vec_perm_const_p): Adjust prototype. * optabs-query.cc (can_vec_perm_const_p): Define new parameter op_mode and pass it to vec_perm_const hook. (can_mult_highpart_p): Adjust call to can_vec_perm_const_p. * match.pd (vec_perm X Y CST): Likewise. * tree-ssa-forwprop.cc (simplify_vector_constructor): Likewise. * tree-vect-data-refs.cc (vect_grouped_store_supported): Likewise. (vect_grouped_load_supported): Likewise. (vect_shift_permute_load_chain): Likewise. * tree-vect-generic.cc (lower_vec_perm): Likewise. * tree-vect-loop-manip.cc (interleave_supported_p): Likewise. * tree-vect-loop.cc (have_whole_vector_shift): Likewise. * tree-vect-patterns.cc (vect_recog_rotate_pattern): Likewise. * tree-vect-slp.cc (can_duplicate_and_interleave_p): Likewise. (vect_transform_slp_perm_load): Likewise. (vectorizable_slp_permutation): Likewise. * tree-vect-stmts.cc (perm_mask_for_reverse): Likewise. (vectorizable_bswap): Likewise. (scan_store_can_perm_p): Likewise. (vect_gen_perm_mask_checked): Likewise. --- gcc/doc/tm.texi | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index c5006af..b0ea398 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6088,14 +6088,18 @@ for the given scalar type @var{type}. @var{is_packed} is false if the scalar access using @var{type} is known to be naturally aligned. @end deftypefn -@deftypefn {Target Hook} bool TARGET_VECTORIZE_VEC_PERM_CONST (machine_mode @var{mode}, rtx @var{output}, rtx @var{in0}, rtx @var{in1}, const vec_perm_indices @var{&sel}) +@deftypefn {Target Hook} bool TARGET_VECTORIZE_VEC_PERM_CONST (machine_mode @var{mode}, machine_mode @var{op_mode}, rtx @var{output}, rtx @var{in0}, rtx @var{in1}, const vec_perm_indices @var{&sel}) This hook is used to test whether the target can permute up to two -vectors of mode @var{mode} using the permutation vector @code{sel}, and -also to emit such a permutation. In the former case @var{in0}, @var{in1} -and @var{out} are all null. In the latter case @var{in0} and @var{in1} are -the source vectors and @var{out} is the destination vector; all three are -operands of mode @var{mode}. @var{in1} is the same as @var{in0} if -@var{sel} describes a permutation on one vector instead of two. +vectors of mode @var{op_mode} using the permutation vector @code{sel}, +producing a vector of mode @var{mode}. The hook is also used to emit such +a permutation. + +When the hook is being used to test whether the target supports a permutation, +@var{in0}, @var{in1}, and @var{out} are all null. When the hook is being used +to emit a permutation, @var{in0} and @var{in1} are the source vectors of mode +@var{op_mode} and @var{out} is the destination vector of mode @var{mode}. +@var{in1} is the same as @var{in0} if @var{sel} describes a permutation on one +vector instead of two. Return true if the operation is possible, emitting instructions for it if rtxes are provided. -- cgit v1.1 From a1c9f779f75283427316b5c670c1e01ff8ce9ced Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 22 Nov 2021 13:54:20 +0100 Subject: Add GIMPLE switch support to loop unswitching This patch adds support to unswitch loops with switch statements based on invariant index. It furthermore reworks the cost model to allow an overall budget of statements to be created per original loop by all unswitching opportunities in the loop. Compared to the original all unswitching opportunities in a loop are pre-evaluated before the first transform which will allow future changes to select the most profitable candidates first. To efficiently support switch statements the pass now uses ranger to simplify switch statements and conditions in loop copies based on ranges extracted from the recorded set of predicates unswitched. gcc/ChangeLog: * dbgcnt.def (DEBUG_COUNTER): Add loop_unswitch counter. * params.opt (max-unswitch-level): Remove. * doc/invoke.texi (max-unswitch-level): Likewise. * tree-cfg.cc (gimple_lv_add_condition_to_bb): Support not gimplified expressions. * tree-ssa-loop-unswitch.cc (struct unswitch_predicate): New. (tree_may_unswitch_on): Rename to ... (find_unswitching_predicates_for_bb): ... this and handle switch statements. (get_predicates_for_bb): Likewise. (set_predicates_for_bb): Likewise. (init_loop_unswitch_info): Likewise. (tree_ssa_unswitch_loops): Prepare stuff before calling tree_unswitch_single_loop. (tree_unswitch_single_loop): Rework the function using pre-computed predicates and with a per original loop cost model. (merge_last): New. (add_predicate_to_path): Likewise. (find_range_for_lhs): Likewise. (simplify_using_entry_checks): Rename to ... (evaluate_control_stmt_using_entry_checks): ... this, handle switch statements and improve simplifications using ranger. (simplify_loop_version): Rework using evaluate_control_stmt_using_entry_checks. (evaluate_bbs): New. (evaluate_loop_insns_for_predicate): Likewise. (tree_unswitch_loop): Adjust to allow switch statements and pass in the edge to unswitch. (clean_up_after_unswitching): New. (pass_tree_unswitch::execute): Pass down fun. gcc/testsuite/ChangeLog: * gcc.dg/loop-unswitch-7.c: New test. * gcc.dg/loop-unswitch-8.c: New test. * gcc.dg/loop-unswitch-9.c: New test. * gcc.dg/loop-unswitch-10.c: New test. * gcc.dg/loop-unswitch-11.c: New test. * gcc.dg/loop-unswitch-12.c: New test. * gcc.dg/loop-unswitch-13.c: New test. * gcc.dg/loop-unswitch-14.c: New test. * gcc.dg/loop-unswitch-15.c: New test. * gcc.dg/loop-unswitch-16.c: New test. * gcc.dg/loop-unswitch-17.c: New test. * gcc.dg/torture/20220518-1.c: New test. * gcc.dg/torture/20220518-2.c: New test. * gcc.dg/torture/20220525-1.c: New test. * gcc.dg/alias-10.c: Adjust. * gcc.dg/tree-ssa/loop-6.c: Likewise. * gcc.dg/loop-unswitch-1.c: Likewise. Co-authored-by: Richard Biener --- gcc/doc/invoke.texi | 3 --- 1 file changed, 3 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a2f85f0..12f834f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -14204,9 +14204,6 @@ The maximum depth of a loop nest suitable for complete peeling. @item max-unswitch-insns The maximum number of insns of an unswitched loop. -@item max-unswitch-level -The maximum number of branches unswitched in a single loop. - @item lim-expensive The minimum cost of an expensive expression in the loop invariant motion. -- cgit v1.1 From 2a790686fd11bc90032ff67c996c5a2752305625 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 25 May 2022 14:36:31 +0200 Subject: GCN: Add gfx908/gfx90a to -march/-mtune in invoke.texi gcc/ * doc/invoke.texi (AMD GCN Options): Add gfx908/gfx90a. --- gcc/doc/invoke.texi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 12f834f..71098d8 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -19737,7 +19737,6 @@ Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu} are @table @samp -@opindex fiji @item fiji Compile for GCN3 Fiji devices (gfx803). @@ -19747,6 +19746,12 @@ Compile for GCN5 Vega 10 devices (gfx900). @item gfx906 Compile for GCN5 Vega 20 devices (gfx906). +@item gfx908 +Compile for CDNA1 Instinct MI100 series devices (gfx908). + +@item gfx90a +Compile for CDNA2 Instinct MI200 series devices (gfx90a). + @end table @item -msram-ecc=on -- cgit v1.1 From 919822adc923b00e995e8a148bdb8115a794b47b Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 28 May 2022 13:16:01 -0600 Subject: [PATCH 1/2] avr: Added AVR-DA and DB MCU series gcc/ * config/avr/avr-mcus.def: Add device definitions. * doc/avr-mmcu.texi: Corresponding changes. * config/avr/gen-avr-mmcu-texi.cc: Added support for avr device prefix. * config/avr/gen-avr-mmcu-specs.cc: Prevent -mmcu=avr* flags from leaking into cc1. Signed-off-by: Joel Holdsworth --- gcc/doc/avr-mmcu.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/avr-mmcu.texi b/gcc/doc/avr-mmcu.texi index 8c09f08..c3e9817 100644 --- a/gcc/doc/avr-mmcu.texi +++ b/gcc/doc/avr-mmcu.texi @@ -50,15 +50,15 @@ @item avrxmega2 ``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atxmega8e5}, @code{atxmega16a4}, @code{atxmega16a4u}, @code{atxmega16c4}, @code{atxmega16d4}, @code{atxmega16e5}, @code{atxmega32a4}, @code{atxmega32a4u}, @code{atxmega32c3}, @code{atxmega32c4}, @code{atxmega32d3}, @code{atxmega32d4}, @code{atxmega32e5}. +@*@var{mcu}@tie{}= @code{atxmega8e5}, @code{atxmega16a4}, @code{atxmega16a4u}, @code{atxmega16c4}, @code{atxmega16d4}, @code{atxmega16e5}, @code{atxmega32a4}, @code{atxmega32a4u}, @code{atxmega32c3}, @code{atxmega32c4}, @code{atxmega32d3}, @code{atxmega32d4}, @code{atxmega32e5}, @code{avr64da28}, @code{avr64da32}, @code{avr64da48}, @code{avr64da64}, @code{avr64db28}, @code{avr64db32}, @code{avr64db48}, @code{avr64db64}. @item avrxmega3 ``XMEGA'' devices with up to 64@tie{}KiB of combined program memory and RAM, and with program memory visible in the RAM address space. -@*@var{mcu}@tie{}= @code{attiny202}, @code{attiny204}, @code{attiny212}, @code{attiny214}, @code{attiny402}, @code{attiny404}, @code{attiny406}, @code{attiny412}, @code{attiny414}, @code{attiny416}, @code{attiny417}, @code{attiny804}, @code{attiny806}, @code{attiny807}, @code{attiny814}, @code{attiny816}, @code{attiny817}, @code{attiny1604}, @code{attiny1606}, @code{attiny1607}, @code{attiny1614}, @code{attiny1616}, @code{attiny1617}, @code{attiny3214}, @code{attiny3216}, @code{attiny3217}, @code{atmega808}, @code{atmega809}, @code{atmega1608}, @code{atmega1609}, @code{atmega3208}, @code{atmega3209}, @code{atmega4808}, @code{atmega4809}. +@*@var{mcu}@tie{}= @code{attiny202}, @code{attiny204}, @code{attiny212}, @code{attiny214}, @code{attiny402}, @code{attiny404}, @code{attiny406}, @code{attiny412}, @code{attiny414}, @code{attiny416}, @code{attiny417}, @code{attiny804}, @code{attiny806}, @code{attiny807}, @code{attiny814}, @code{attiny816}, @code{attiny817}, @code{attiny1604}, @code{attiny1606}, @code{attiny1607}, @code{attiny1614}, @code{attiny1616}, @code{attiny1617}, @code{attiny3214}, @code{attiny3216}, @code{attiny3217}, @code{atmega808}, @code{atmega809}, @code{atmega1608}, @code{atmega1609}, @code{atmega3208}, @code{atmega3209}, @code{atmega4808}, @code{atmega4809}, @code{avr32da28}, @code{avr32da32}, @code{avr32da48}, @code{avr32db28}, @code{avr32db32}, @code{avr32db48}. @item avrxmega4 ``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atxmega64a3}, @code{atxmega64a3u}, @code{atxmega64a4u}, @code{atxmega64b1}, @code{atxmega64b3}, @code{atxmega64c3}, @code{atxmega64d3}, @code{atxmega64d4}. +@*@var{mcu}@tie{}= @code{atxmega64a3}, @code{atxmega64a3u}, @code{atxmega64a4u}, @code{atxmega64b1}, @code{atxmega64b3}, @code{atxmega64c3}, @code{atxmega64d3}, @code{atxmega64d4}, @code{avr128da28}, @code{avr128da32}, @code{avr128da48}, @code{avr128da64}, @code{avr128db28}, @code{avr128db32}, @code{avr128db48}, @code{avr128db64}. @item avrxmega5 ``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM. -- cgit v1.1 From da5f0cc2f51a791a397fd1b3cef662763897a826 Mon Sep 17 00:00:00 2001 From: Eric Gallager Date: Sun, 29 May 2022 00:57:05 -0400 Subject: sourcebuild.texi: Document toplevel directories Fixes PR82383 gcc/ChangeLog: PR other/82383 * doc/sourcebuild.texi: Add entries for the c++tools, gotools, libbacktrace, libcc1, libcody, liboffloadmic, and libsanitizer directories. Remove entry for boehm-gc. Fix alphabetization for libquadmath. --- gcc/doc/sourcebuild.texi | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index d465b04..286b1eb 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -27,9 +27,9 @@ distributions such as that of GNU Binutils. It also contains several subdirectories that contain parts of GCC and its runtime libraries: @table @file -@item boehm-gc -The Boehm conservative garbage collector, optionally used as part of -the ObjC runtime library when configured with @option{--enable-objc-gc}. +@item c++tools +Contains the sources for the g++-mapper-server, a tool used with +C++ modules. @item config Autoconf macros and Makefile fragments used throughout the tree. @@ -55,6 +55,9 @@ language front ends, and testsuites. @xref{gcc Directory, , The @item gnattools Support tools for GNAT. +@item gotools +Support tools for Go. + @item include Headers for the @code{libiberty} library. @@ -69,6 +72,16 @@ The Ada runtime library. The runtime support library for atomic operations (e.g.@: for @code{__sync} and @code{__atomic}). +@item libbacktrace +A library that allows gcc to produce backtraces when it crashes. + +@item libcc1 +A library that allows gdb to make use of the compiler. + +@item libcody +A compiler dynamism library to allow communication between compilers and +build systems, for purposes such as C++ modules. + @item libcpp The C preprocessor library. @@ -103,19 +116,30 @@ The runtime support library for transactional memory. @item libobjc The Objective-C and Objective-C++ runtime library. -@item libquadmath -The runtime support library for quad-precision math operations. +@item liboffloadmic +A library to allow OpenMP to Intel MIC targets. @item libphobos The D standard and runtime library. The bulk of this library is mirrored from the @uref{https://github.com/@/dlang, master D repositories}. +@item libquadmath +The runtime support library for quad-precision math operations. + +@item libsanitizer +Libraries for various sanitizers. The bulk of this directory is mirrored +from the @uref{https://github.com/google/sanitizers, Google sanitizers +repositories}. + @item libssp The Stack protector runtime library. @item libstdc++-v3 The C++ runtime library. +@item libvtv +The vtable verification library. + @item lto-plugin Plugin used by the linker if link-time optimizations are enabled. -- cgit v1.1 From 5ab73173cca4610e59df8a3fe9cb5b30ded75aec Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 2 Jun 2022 15:38:38 -0400 Subject: Add -fdiagnostics-format={json-stderr|json-file} This commit adds -fdiagnostics-format=json-file, writing to DUMP_BASE_NAME.gcc.json, and adds -fdiagnostics-format=json-stderr, a synonym for the existing -fdiagnostics-format=json. gcc/ChangeLog: * common.opt (fdiagnostics-format=): Add json-stderr and json-file to description. (DIAGNOSTICS_OUTPUT_FORMAT_JSON): Rename to... (DIAGNOSTICS_OUTPUT_FORMAT_JSON_STDERR): ...this. (diagnostics_output_format): Add json-stderr and json-file. * diagnostic-format-json.cc (json_flush_to_file): New. (json_final_cb): Convert to... (json_flush_to_file): ...this, ... (json_stderr_final_cb): ...this, and... (json_file_final_cb): ...this. (diagnostic_output_format_init): Move to diagnostic.cc. (json_output_base_file_name): New. (diagnostic_output_format_init_json): New. (diagnostic_output_format_init_json_stderr): New. (diagnostic_output_format_init_json_file): New. * diagnostic.cc (diagnostic_output_format_init): Move here from diagnostic-format-json.cc; update for changes to enum. * diagnostic.h (enum diagnostics_output_format): Rename DIAGNOSTICS_OUTPUT_FORMAT_JSON to DIAGNOSTICS_OUTPUT_FORMAT_JSON_STDERR, and add DIAGNOSTICS_OUTPUT_FORMAT_JSON_FILE. (diagnostic_output_format_init): Add base_file_name param. (diagnostic_output_format_init_json_stderr): New decl. (diagnostic_output_format_init_json_file): New dec. * doc/invoke.texi (-fdiagnostics-format=): Add "json-stderr" and "json-file". Rewrite so that the existing "json" is a synonym of "json-stderr". * gcc.cc (driver_handle_option): Pass dump_base_name to diagnostic_output_format_init. * opts.cc (common_handle_option): Likewise. gcc/testsuite/ChangeLog: * c-c++-common/diagnostic-format-json-file-1.c: New test. * c-c++-common/diagnostic-format-json-stderr-1.c: New test. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 71098d8..d85b66f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -301,7 +301,7 @@ Objective-C and Objective-C++ Dialects}. -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol --fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol +-fdiagnostics-format=@r{[}text@r{|}json@r{|}json-stderr@r{|}json-file@r{]} @gol -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol -fno-diagnostics-show-cwe @gol @@ -5305,14 +5305,19 @@ Unicode characters. For the example above, the following will be printed: @item -fdiagnostics-format=@var{FORMAT} @opindex fdiagnostics-format Select a different format for printing diagnostics. -@var{FORMAT} is @samp{text} or @samp{json}. +@var{FORMAT} is @samp{text}, @samp{json}, @samp{json-stderr}, +or @samp{json-file}. + The default is @samp{text}. -The @samp{json} format consists of a top-level JSON array containing JSON -objects representing the diagnostics. +The @samp{json} format is a synonym for @samp{json-stderr}. +The @samp{json-stderr} and @samp{json-file} formats are identical, apart from +where the JSON is emitted to - with the former, the JSON is emitted to stderr, +whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}. -The JSON is emitted as one line, without formatting; the examples below -have been formatted for clarity. +The emitted JSON consists of a top-level JSON array containing JSON objects +representing the diagnostics. The JSON is emitted as one line, without +formatting; the examples below have been formatted for clarity. Diagnostics can have child diagnostics. For example, this error and note: -- cgit v1.1 From 6cf276ddf22066af780335cd0072d2c27aabe468 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 2 Jun 2022 15:40:22 -0400 Subject: diagnostics: add SARIF output format This patch adds support to gcc's diagnostic subsystem for emitting diagnostics in SARIF, aka the Static Analysis Results Interchange Format: https://sarifweb.azurewebsites.net/ by extending -fdiagnostics-format= to add two new options: -fdiagnostics-format=sarif-stderr and: -fdiagnostics-format=sarif-file The patch targets SARIF v2.1.0 This is a JSON-based format suited for capturing the results of static analysis tools (like GCC's -fanalyzer), but it can also be used for plain GCC warnings and errors. SARIF supports per-event metadata in diagnostic paths such as ["acquire", "resource"] and ["release", "lock"] (specifically, the threadFlowLocation "kinds" property: SARIF v2.1.0 section 3.38.8), so the patch extends GCC"s diagnostic_event subclass with a "struct meaning" with similar purpose. The patch implements this for -fanalyzer so that the various state-machine-based warnings set these in the SARIF output. The heart of the implementation is in the new file diagnostic-format-sarif.cc. Much of the rest of the patch is interface classes, isolating the diagnostic subsystem (which has no knowledge of e.g. tree or langhook) from the "client" code in the compiler proper cc1 etc). The patch adds a langhook for specifying the SARIF v2.1.0 "artifact.sourceLanguage" property, based on the list in SARIF v2.1.0 Appendix J. The patch adds automated DejaGnu tests to our testsuite via new scan-sarif-file and scan-sarif-file-not directives (although these merely use regexps, rather than attempting to use a proper JSON parser). I've tested the patch by hand using the validator at: https://sarifweb.azurewebsites.net/Validation and the react-based viewer at: https://microsoft.github.io/sarif-web-component/ which successfully shows most of the information (although not paths, and not CWE IDs), and I've fixed all validation errors I've seen (though bugs no doubt remain). I've also tested the generated SARIF using the VS Code extension linked to from the SARIF website; I'm a novice with VS Code, but it seems to be able to handle my generated SARIF files (e.g. showing the data in the SARIF tab, and showing squiggly underlines under issues, and when I click on them, it visualizes the events in the path inline within the source window). Has anyone written an Emacs mode for SARIF files? (pretty please) gcc/ChangeLog: * Makefile.in (OBJS): Add tree-diagnostic-client-data-hooks.o and tree-logical-location.o. (OBJS-libcommon): Add diagnostic-format-sarif.o; reorder. (CFLAGS-tree-diagnostic-client-data-hooks.o): Add TARGET_NAME. * common.opt (fdiagnostics-format=): Add sarif-stderr and sarif-file. (sarif-stderr, sarif-file): New enum values. * diagnostic-client-data-hooks.h: New file. * diagnostic-format-sarif.cc: New file. * diagnostic-path.h (enum diagnostic_event::verb): New enum. (enum diagnostic_event::noun): New enum. (enum diagnostic_event::property): New enum. (struct diagnostic_event::meaning): New struct. (diagnostic_event::get_logical_location): New vfunc. (diagnostic_event::get_meaning): New vfunc. (simple_diagnostic_event::get_logical_location): New vfunc impl. (simple_diagnostic_event::get_meaning): New vfunc impl. * diagnostic.cc: Include "diagnostic-client-data-hooks.h". (diagnostic_initialize): Initialize m_client_data_hooks. (diagnostic_finish): Clean up m_client_data_hooks. (diagnostic_event::meaning::dump_to_pp): New. (diagnostic_event::meaning::maybe_get_verb_str): New. (diagnostic_event::meaning::maybe_get_noun_str): New. (diagnostic_event::meaning::maybe_get_property_str): New. (get_cwe_url): Make non-static. (diagnostic_output_format_init): Handle DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR and DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE. * diagnostic.h (enum diagnostics_output_format): Add DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR and DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE. (class diagnostic_client_data_hooks): New forward decl. (class logical_location): New forward decl. (diagnostic_context::m_client_data_hooks): New field. (diagnostic_output_format_init_sarif_stderr): New decl. (diagnostic_output_format_init_sarif_file): New decl. (get_cwe_url): New decl. * doc/invoke.texi (-fdiagnostics-format=): Add sarif-stderr and sarif-file. * doc/sourcebuild.texi (Scan a particular file): Add scan-sarif-file and scan-sarif-file-not. * langhooks-def.h (lhd_get_sarif_source_language): New decl. (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): New macro. (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE. * langhooks.cc (lhd_get_sarif_source_language): New. * langhooks.h (lang_hooks::get_sarif_source_language): New field. * logical-location.h: New file. * plugin.cc (struct for_each_plugin_closure): New. (for_each_plugin_cb): New. (for_each_plugin): New. * plugin.h (for_each_plugin): New decl. * tree-diagnostic-client-data-hooks.cc: New file. * tree-diagnostic.cc: Include "diagnostic-client-data-hooks.h". (tree_diagnostics_defaults): Populate m_client_data_hooks. * tree-logical-location.cc: New file. * tree-logical-location.h: New file. gcc/ada/ChangeLog: * gcc-interface/misc.cc (gnat_get_sarif_source_language): New. (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. gcc/analyzer/ChangeLog: * checker-path.cc (checker_event::get_meaning): New. (function_entry_event::get_meaning): New. (state_change_event::get_desc): Add dump of meaning of the event to the -fanalyzer-verbose-state-changes output. (state_change_event::get_meaning): New. (cfg_edge_event::get_meaning): New. (call_event::get_meaning): New. (return_event::get_meaning): New. (start_consolidated_cfg_edges_event::get_meaning): New. (warning_event::get_meaning): New. * checker-path.h: Include "tree-logical-location.h". (checker_event::checker_event): Construct m_logical_loc. (checker_event::get_logical_location): New. (checker_event::get_meaning): New decl. (checker_event::m_logical_loc): New. (function_entry_event::get_meaning): New decl. (state_change_event::get_meaning): New decl. (cfg_edge_event::get_meaning): New decl. (call_event::get_meaning): New decl. (return_event::get_meaning): New decl. (start_consolidated_cfg_edges_event::get_meaning): New. (warning_event::get_meaning): New decl. * pending-diagnostic.h: Include "diagnostic-path.h". (pending_diagnostic::get_meaning_for_state_change): New vfunc. * sm-file.cc (file_diagnostic::get_meaning_for_state_change): New vfunc impl. * sm-malloc.cc (malloc_diagnostic::get_meaning_for_state_change): Likewise. * sm-sensitive.cc (exposure_through_output_file::get_meaning_for_state_change): Likewise. * sm-taint.cc (taint_diagnostic::get_meaning_for_state_change): Likewise. * varargs.cc (va_list_sm_diagnostic::get_meaning_for_state_change): Likewise. gcc/c/ChangeLog: * c-lang.cc (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. (c_get_sarif_source_language): New. * c-tree.h (c_get_sarif_source_language): New decl. gcc/cp/ChangeLog: * cp-lang.cc (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. (cp_get_sarif_source_language): New. gcc/d/ChangeLog: * d-lang.cc (d_get_sarif_source_language): New. (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. gcc/fortran/ChangeLog: * f95-lang.cc (gfc_get_sarif_source_language): New. (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. gcc/go/ChangeLog: * go-lang.cc (go_get_sarif_source_language): New. (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. gcc/objc/ChangeLog: * objc-act.h (objc_get_sarif_source_language): New decl. * objc-lang.cc (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine. (objc_get_sarif_source_language): New. gcc/testsuite/ChangeLog: * c-c++-common/diagnostic-format-sarif-file-1.c: New test. * c-c++-common/diagnostic-format-sarif-file-2.c: New test. * c-c++-common/diagnostic-format-sarif-file-3.c: New test. * c-c++-common/diagnostic-format-sarif-file-4.c: New test. * gcc.dg/analyzer/file-meaning-1.c: New test. * gcc.dg/analyzer/malloc-meaning-1.c: New test. * gcc.dg/analyzer/malloc-sarif-1.c: New test. * gcc.dg/plugin/analyzer_gil_plugin.c (gil_diagnostic::get_meaning_for_state_change): New vfunc impl. * gcc.dg/plugin/diagnostic-test-paths-5.c: New test. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add diagnostic-test-paths-5.c to tests for diagnostic_plugin_test_paths.c. * lib/gcc-dg.exp: Load scansarif.exp. * lib/scansarif.exp: New test. libatomic/ChangeLog: * testsuite/lib/libatomic.exp: Add load_gcc_lib of scansarif.exp. libgomp/ChangeLog: * testsuite/lib/libgomp.exp: Add load_gcc_lib of scansarif.exp. libitm/ChangeLog: * testsuite/lib/libitm.exp: Add load_gcc_lib of scansarif.exp. libphobos/ChangeLog: * testsuite/lib/libphobos-dg.exp: Add load_gcc_lib of scansarif.exp. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 10 +++++++--- gcc/doc/sourcebuild.texi | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d85b66f..8cd5bdd 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -301,7 +301,7 @@ Objective-C and Objective-C++ Dialects}. -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol --fdiagnostics-format=@r{[}text@r{|}json@r{|}json-stderr@r{|}json-file@r{]} @gol +-fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]} @gol -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol -fno-diagnostics-show-cwe @gol @@ -5305,11 +5305,15 @@ Unicode characters. For the example above, the following will be printed: @item -fdiagnostics-format=@var{FORMAT} @opindex fdiagnostics-format Select a different format for printing diagnostics. -@var{FORMAT} is @samp{text}, @samp{json}, @samp{json-stderr}, -or @samp{json-file}. +@var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file}, +@samp{json}, @samp{json-stderr}, or @samp{json-file}. The default is @samp{text}. +The @samp{sarif-stderr} and @samp{sarif-file} formats both emit +diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file +named @file{@var{source}.sarif}, respectively. + The @samp{json} format is a synonym for @samp{json-stderr}. The @samp{json-stderr} and @samp{json-file} formats are identical, apart from where the JSON is emitted to - with the former, the JSON is emitted to stderr, diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 286b1eb..606ab85 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -3152,6 +3152,12 @@ Passes if @var{regexp} matches in Fortran module @var{module}. @item dg-check-dot @var{filename} Passes if @var{filename} is a valid @file{.dot} file (by running @code{dot -Tpng} on it, and verifying the exit code is 0). +@item scan-sarif-file @var{regexp} [@{ target/xfail @var{selector} @}] +Passes if @var{regexp} matches text in the file generated by +@option{-fdiagnostics-format=sarif-file}. +@item scan-sarif-file-not @var{regexp} [@{ target/xfail @var{selector} @}] +Passes if @var{regexp} does not match text in the file generated by +@option{-fdiagnostics-format=sarif-file}. @end table @subsubsection Scan the assembly output -- cgit v1.1 From ef5cc6bbb60b0ccbc10fb76b697ae02f28af18c0 Mon Sep 17 00:00:00 2001 From: Chung-Ju Wu Date: Wed, 8 Jun 2022 07:14:11 +0000 Subject: arm: Add star-mc1 cpu The star-mc1 is an embedded processor with armv8m architecture. Majorly it is designed to meet the requirements of AIoT application performance, power consumption and security. This patch is to add support of star-mc1 cpu. Signed-off-by: Chung-Ju Wu gcc/ChangeLog: * config/arm/arm-cpus.in (star-mc1): New cpu. * config/arm/arm-tables.opt: Regenerate. * config/arm/arm-tune.md: Regenerate. * doc/invoke.texi: Update docs. --- gcc/doc/invoke.texi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8cd5bdd..ac0c06c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -21190,7 +21190,8 @@ Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t}, @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4}, @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626}, -@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}. +@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1}, +@samp{xgene1}. Additionally, this option can specify that GCC should tune the performance of the code for a big.LITTLE system. Permissible names are: @@ -21596,8 +21597,9 @@ Development Tools Engineering Specification", which can be found on Mitigate against a potential security issue with the @code{VLLDM} instruction in some M-profile devices when using CMSE (CVE-2021-365465). This option is enabled by default when the option @option{-mcpu=} is used with -@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option -@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation. +@code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55} or @code{star-mc1}. +The option @option{-mno-fix-cmse-cve-2021-35465} can be used to disable +the mitigation. @item -mstack-protector-guard=@var{guard} @itemx -mstack-protector-guard-offset=@var{offset} -- cgit v1.1 From 2dc19a1b590b9afb58fd5f779e87ae8fc1998ae7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 9 Jun 2022 10:19:53 +0200 Subject: doc: Fix up -Waddress documentation WHen looking up the -Waddress documentation due to some PR that mentioned it, I've noticed some typos and thus I'm fixing them. 2022-06-09 Jakub Jelinek * doc/invoke.texi (-Waddress): Fix a typo in small example. Fix typos inptr_t -> intptr_t and uinptr_t -> uintptr_t. --- gcc/doc/invoke.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index ac0c06c..174bc09 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -8901,7 +8901,7 @@ such as in void f (void); void g (void) @{ - if (!func) // warning: expression evaluates to false + if (!f) // warning: expression evaluates to false abort (); @} @end smallexample @@ -8927,7 +8927,7 @@ weak symbols), so their use in a conditional might indicate missing parentheses in a function call or a missing dereference in an array expression. The subset of the warning for object pointers can be suppressed by casting the pointer operand to an integer type such -as @code{inptr_t} or @code{uinptr_t}. +as @code{intptr_t} or @code{uintptr_t}. Comparisons against string literals result in unspecified behavior and are not portable, and suggest the intent was to call @code{strcmp}. The warning is suppressed if the suspicious expression is the result -- cgit v1.1 From 3b598848f6fdbf7e76eaf2beec1ce94fc3a14b9b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 13 Jun 2022 13:32:53 +0200 Subject: Introduce -finstrument-functions-once The goal is to make it possible to use it in (large) production binaries to do function-level coverage, so the overhead must be minimum and, in particular, there is no protection against data races so the "once" moniker is imprecise. gcc/ * common.opt (finstrument-functions): Set explicit value. (-finstrument-functions-once): New option. * doc/invoke.texi (Program Instrumentation Options): Document it. * gimplify.cc (build_instrumentation_call): New static function. (gimplify_function_tree): Call it to emit the instrumentation calls if -finstrument-functions[-once] is specified. gcc/testsuite/ * gcc.dg/instrument-4.c: New test. --- gcc/doc/invoke.texi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 174bc09..b6c0305 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -618,7 +618,7 @@ Objective-C and Objective-C++ Dialects}. -fno-stack-limit -fsplit-stack @gol -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol -fvtv-counts -fvtv-debug @gol --finstrument-functions @gol +-finstrument-functions -finstrument-functions-once @gol -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} @gol -fprofile-prefix-map=@var{old}=@var{new} @@ -16395,6 +16395,22 @@ cannot safely be called (perhaps signal handlers, if the profiling routines generate output or allocate memory). @xref{Common Function Attributes}. +@item -finstrument-functions-once +@opindex -finstrument-functions-once +This is similar to @option{-finstrument-functions}, but the profiling +functions are called only once per instrumented function, i.e. the first +profiling function is called after the first entry into the instrumented +function and the second profiling function is called before the exit +corresponding to this first entry. + +The definition of @code{once} for the purpose of this option is a little +vague because the implementation is not protected against data races. +As a result, the implementation only guarantees that the profiling +functions are called at @emph{least} once per process and at @emph{most} +once per thread, but the calls are always paired, that is to say, if a +thread calls the first function, then it will call the second function, +unless it never reaches the exit of the instrumented function. + @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @opindex finstrument-functions-exclude-file-list -- cgit v1.1 From 63c073199491b7ec2261d39af51c02147c2f0daf Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 15 Jun 2022 17:44:14 -0400 Subject: analyzer: fix up paths for inlining (PR analyzer/105962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -fanalyzer runs late compared to other code analysis tools, in that in runs on the partially-optimized gimple-ssa representation. I chose this point to run in the hope of easy integration with LTO. As PR analyzer/105962 notes, this means that function inlining can occur before the -fanalyzer "sees" the user's code. For example given: void foo (void *p) { __builtin_free (p); } void bar (void *q) { foo (q); foo (q); } Below -O2, -fanalyzer shows the calls and returns: inline-1.c: In function ‘foo’: inline-1.c:3:3: warning: double-‘free’ of ‘p’ [CWE-415] [-Wanalyzer-double-free] 3 | __builtin_free (p); | ^~~~~~~~~~~~~~~~~~ ‘bar’: events 1-2 | | 6 | void bar (void *q) | | ^~~ | | | | | (1) entry to ‘bar’ | 7 | { | 8 | foo (q); | | ~~~~~~~ | | | | | (2) calling ‘foo’ from ‘bar’ | +--> ‘foo’: events 3-4 | | 1 | void foo (void *p) | | ^~~ | | | | | (3) entry to ‘foo’ | 2 | { | 3 | __builtin_free (p); | | ~~~~~~~~~~~~~~~~~~ | | | | | (4) first ‘free’ here | <------+ | ‘bar’: events 5-6 | | 8 | foo (q); | | ^~~~~~~ | | | | | (5) returning to ‘bar’ from ‘foo’ | 9 | foo (q); | | ~~~~~~~ | | | | | (6) passing freed pointer ‘q’ in call to ‘foo’ from ‘bar’ | +--> ‘foo’: events 7-8 | | 1 | void foo (void *p) | | ^~~ | | | | | (7) entry to ‘foo’ | 2 | { | 3 | __builtin_free (p); | | ~~~~~~~~~~~~~~~~~~ | | | | | (8) second ‘free’ here; first ‘free’ was at (4) | but at -O2, -fanalyzer "sees" this gimple: void bar (void * q) { [local count: 1073741824]: __builtin_free (q_2(D)); __builtin_free (q_2(D)); return; } where "foo" has been inlined away, leading to this unhelpful output: In function ‘foo’, inlined from ‘bar’ at inline-1.c:9:3: inline-1.c:3:3: warning: double-‘free’ of ‘q’ [CWE-415] [-Wanalyzer-double-free] 3 | __builtin_free (p); | ^~~~~~~~~~~~~~~~~~ ‘bar’: events 1-2 | | 3 | __builtin_free (p); | | ^~~~~~~~~~~~~~~~~~ | | | | | (1) first ‘free’ here | | (2) second ‘free’ here; first ‘free’ was at (1) where the stack frame information in the execution path suggests that these events are happening in "bar", in the top stack frame. This is what the analyzer sees, but I find it hard to decipher such output. Hence, as a workaround for the fact that -fanalyzer runs so late, this patch attempts to reconstruct the "true" stack frame information, and to inject events showing inline calls, based on the inlining chain information recorded in the location_t values for the events. Doing so leads to this output at -O2 on the above example (with -fdiagnostics-show-path-depths): In function ‘foo’, inlined from ‘bar’ at inline-1.c:9:3: inline-1.c:3:3: warning: double-‘free’ of ‘q’ [CWE-415] [-Wanalyzer-double-free] 3 | __builtin_free (p); | ^~~~~~~~~~~~~~~~~~ ‘bar’: events 1-2 (depth 1) | | 6 | void bar (void *q) | | ^~~ | | | | | (1) entry to ‘bar’ | 7 | { | 8 | foo (q); | | ~ | | | | | (2) inlined call to ‘foo’ from ‘bar’ | +--> ‘foo’: event 3 (depth 2) | | 3 | __builtin_free (p); | | ^~~~~~~~~~~~~~~~~~ | | | | | (3) first ‘free’ here | <------+ | ‘bar’: event 4 (depth 1) | | 9 | foo (q); | | ^ | | | | | (4) inlined call to ‘foo’ from ‘bar’ | +--> ‘foo’: event 5 (depth 2) | | 3 | __builtin_free (p); | | ^~~~~~~~~~~~~~~~~~ | | | | | (5) second ‘free’ here; first ‘free’ was at (3) | reconstructing the calls and returns. The patch also adds a new option, -fno-analyzer-undo-inlining, which can be used to disable this reconstruction, restoring the output listed above (this time with -fdiagnostics-show-path-depths): In function ‘foo’, inlined from ‘bar’ at inline-1.c:9:3: inline-1.c:3:3: warning: double-‘free’ of ‘q’ [CWE-415] [-Wanalyzer-double-free] 3 | __builtin_free (p); | ^~~~~~~~~~~~~~~~~~ ‘bar’: events 1-2 (depth 1) | | 3 | __builtin_free (p); | | ^~~~~~~~~~~~~~~~~~ | | | | | (1) first ‘free’ here | | (2) second ‘free’ here; first ‘free’ was at (1) | gcc/analyzer/ChangeLog: PR analyzer/105962 * analyzer.opt (fanalyzer-undo-inlining): New option. * checker-path.cc: Include "diagnostic-core.h" and "inlining-iterator.h". (event_kind_to_string): Handle EK_INLINED_CALL. (class inlining_info): New class. (checker_event::checker_event): Move here from checker-path.h. Store original fndecl and depth, and calculate effective fndecl and depth based on inlining information. (checker_event::dump): Emit original depth as well as effective depth when they differ; likewise for fndecl. (region_creation_event::get_desc): Use m_effective_fndecl. (inlined_call_event::get_desc): New. (inlined_call_event::get_meaning): New. (checker_path::inject_any_inlined_call_events): New. * checker-path.h (enum event_kind): Add EK_INLINED_CALL. (checker_event::checker_event): Make protected, and move definition to checker-path.cc. (checker_event::get_fndecl): Use effective fndecl. (checker_event::get_stack_depth): Use effective stack depth. (checker_event::get_logical_location): Use effective stack depth. (checker_event::get_original_stack_depth): New. (checker_event::m_fndecl): Rename to... (checker_event::m_original_fndecl): ...this. (checker_event::m_depth): Rename to... (checker_event::m_original_depth): ...this. (checker_event::m_effective_fndecl): New field. (checker_event::m_effective_depth): New field. (class inlined_call_event): New checker_event subclass. (checker_path::inject_any_inlined_call_events): New decl. * diagnostic-manager.cc: Include "inlining-iterator.h". (diagnostic_manager::emit_saved_diagnostic): Call checker_path::inject_any_inlined_call_events. (diagnostic_manager::prune_for_sm_diagnostic): Handle EK_INLINED_CALL. * engine.cc (tainted_args_function_custom_event::get_desc): Use effective fndecl. * inlining-iterator.h: New file. gcc/testsuite/ChangeLog: PR analyzer/105962 * gcc.dg/analyzer/inlining-1-multiline.c: New test. * gcc.dg/analyzer/inlining-1-no-undo.c: New test. * gcc.dg/analyzer/inlining-1.c: New test. * gcc.dg/analyzer/inlining-2-multiline.c: New test. * gcc.dg/analyzer/inlining-2.c: New test. * gcc.dg/analyzer/inlining-3-multiline.c: New test. * gcc.dg/analyzer/inlining-3.c: New test. * gcc.dg/analyzer/inlining-4-multiline.c: New test. * gcc.dg/analyzer/inlining-4.c: New test. * gcc.dg/analyzer/inlining-5-multiline.c: New test. * gcc.dg/analyzer/inlining-5.c: New test. * gcc.dg/analyzer/inlining-6-multiline.c: New test. * gcc.dg/analyzer/inlining-6.c: New test. * gcc.dg/analyzer/inlining-7-multiline.c: New test. * gcc.dg/analyzer/inlining-7.c: New test. gcc/ChangeLog: PR analyzer/105962 * doc/invoke.texi: Add -fno-analyzer-undo-inlining. * tree-diagnostic-path.cc (default_tree_diagnostic_path_printer): Extend -fdiagnostics-path-format=separate-events so that with -fdiagnostics-show-path-depths it prints fndecls as well as stack depths. Signed-off-by: David Malcolm --- gcc/doc/invoke.texi | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b6c0305..0eab7e4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -425,6 +425,7 @@ Objective-C and Objective-C++ Dialects}. -fno-analyzer-state-merge @gol -fno-analyzer-state-purge @gol -fanalyzer-transitivity @gol +-fno-analyzer-undo-inlining @gol -fanalyzer-verbose-edges @gol -fanalyzer-verbose-state-changes @gol -fanalyzer-verbosity=@var{level} @gol @@ -5233,7 +5234,10 @@ This option provides additional information when printing control-flow paths associated with a diagnostic. If this is option is provided then the stack depth will be printed for -each run of events within @option{-fdiagnostics-path-format=separate-events}. +each run of events within @option{-fdiagnostics-path-format=inline-events}. +If provided with @option{-fdiagnostics-path-format=separate-events}, then +the stack depth and function declaration will be appended when printing +each event. This is intended for use by GCC developers and plugin developers when debugging diagnostics that report interprocedural control flow. @@ -10202,6 +10206,25 @@ be suppressed, for debugging state-handling issues. @opindex fno-analyzer-transitivity This option enables transitivity of constraints within the analyzer. +@item -fno-analyzer-undo-inlining +@opindex fanalyzer-undo-inlining +@opindex fno-analyzer-undo-inlining +This option is intended for analyzer developers. + +@option{-fanalyzer} runs relatively late compared to other code analysis +tools, and some optimizations have already been applied to the code. In +particular function inlining may have occurred, leading to the +interprocedural execution paths emitted by the analyzer containing +function frames that don't correspond to those in the original source +code. + +By default the analyzer attempts to reconstruct the original function +frames, and to emit events showing the inlined calls. + +With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct +the original frame information can be be disabled, which may be of help +when debugging issues in the analyzer. + @item -fanalyzer-verbose-edges This option is intended for analyzer developers. It enables more verbose, lower-level detail in the descriptions of control flow -- cgit v1.1 From 96518f714e3fab53a966a05b8d48011e27c1a718 Mon Sep 17 00:00:00 2001 From: Takayuki 'January June' Suwa Date: Tue, 14 Jun 2022 12:34:48 +0900 Subject: xtensa: Document new -mextra-l32r-costs= Xtensa-specific option gcc/ChangeLog: * doc/invoke.texi: Document -mextra-l32r-costs= option. --- gcc/doc/invoke.texi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0eab7e4..60b7b5a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1474,7 +1474,8 @@ See RS/6000 and PowerPC Options. -mauto-litpools -mno-auto-litpools @gol -mtarget-align -mno-target-align @gol -mlongcalls -mno-longcalls @gol --mabi=@var{abi-type}} +-mabi=@var{abi-type} @gol +-mextra-l32r-costs=@var{cycles}} @emph{zSeries Options} See S/390 and zSeries Options. @@ -33549,6 +33550,14 @@ by 8 registers on entry so that its arguments are found in registers pointer. Register window is rotated 8 registers back upon return. When this version of the ABI is enabled the C preprocessor symbol @code{__XTENSA_WINDOWED_ABI__} is defined. + +@item -mextra-l32r-costs=@var{n} +@opindex mextra-l32r-costs +Specify an extra cost of instruction RAM/ROM access for @code{L32R} +instructions, in clock cycles. This affects, when optimizing for speed, +whether loading a constant from literal pool using @code{L32R} or +synthesizing the constant from a small one with a couple of arithmetic +instructions. The default value is 0. @end table @node zSeries Options -- cgit v1.1