aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2024-03-07 09:29:32 -0800
committerDavid Faust <david.faust@oracle.com>2024-03-08 10:12:42 -0800
commit0e850eff58539fb79483664962fac6c46d65c79d (patch)
tree2653b6bc6210b0450eb6af40bb28d124807dcebc /gcc/doc
parentac829a89fb56cfd914d5e29ed4695e499b0dbc95 (diff)
downloadgcc-0e850eff58539fb79483664962fac6c46d65c79d.zip
gcc-0e850eff58539fb79483664962fac6c46d65c79d.tar.gz
gcc-0e850eff58539fb79483664962fac6c46d65c79d.tar.bz2
bpf: add size threshold for inlining mem builtins
BPF cannot fall back on library calls to implement memmove, memcpy and memset, so we attempt to expand these inline always if possible. However, this inline expansion was being attempted even for excessively large operations, which could result in gcc consuming huge amounts of memory and hanging. Add a size threshold in the BPF backend below which to always expand these operations inline, and introduce an option -minline-memops-threshold= to control the threshold. Defaults to 1024 bytes. gcc/ * config/bpf/bpf.cc (bpf_expand_cpymem, bpf_expand_setmem): Do not attempt inline expansion if size is above threshold. * config/bpf/bpf.opt (-minline-memops-threshold): New option. * doc/invoke.texi (eBPF Options) <-minline-memops-threshold>: Document. gcc/testsuite/ * gcc.target/bpf/inline-memops-threshold-1.c: New test. * gcc.target/bpf/inline-memops-threshold-2.c: New test.
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c0d604a..85c938d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -971,7 +971,7 @@ Objective-C and Objective-C++ Dialects}.
@gccoptlist{-mbig-endian -mlittle-endian
-mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
-mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
--masm=@var{dialect}}
+-masm=@var{dialect} -minline-memops-threshold=@var{bytes}}
@emph{FR30 Options}
@gccoptlist{-msmall-model -mno-lsim}
@@ -25701,6 +25701,15 @@ Outputs pseudo-c assembly dialect.
@end table
+@opindex -minline-memops-threshold
+@item -minline-memops-threshold=@var{bytes}
+Specifies a size threshold in bytes at or below which memmove, memcpy
+and memset shall always be expanded inline. Operations dealing with
+sizes larger than this threshold would have to be be implemented using
+a library call instead of being expanded inline, but since BPF doesn't
+allow libcalls, exceeding this threshold results in a compile-time
+error. The default is @samp{1024} bytes.
+
@end table
@node FR30 Options