]> gcc.gnu.org Git - gcc.git/commit
bpf: add inline memset expansion
authorDavid Faust <david.faust@oracle.com>
Mon, 4 Mar 2024 17:35:01 +0000 (09:35 -0800)
committerDavid Faust <david.faust@oracle.com>
Tue, 5 Mar 2024 18:32:09 +0000 (10:32 -0800)
commit548dbf6f87878800f214982e6c6d104b8a2a6ea1
tree719e72a711a19380c25cab107ed0620031336ab4
parent5cb3615ed932faa521e2587c047b0771816c14aa
bpf: add inline memset expansion

Similar to memmove and memcpy, the BPF backend cannot fall back on a
library call to implement __builtin_memset, and should always expand
calls to it inline if possible.

This patch implements simple inline expansion of memset in the BPF
backend in a verifier-friendly way. Similar to memcpy and memmove, the
size must be an integer constant, as is also required by clang.

gcc/
* config/bpf/bpf-protos.h (bpf_expand_setmem): New prototype.
* config/bpf/bpf.cc (bpf_expand_setmem): New.
* config/bpf/bpf.md (setmemdi): New define_expand.

gcc/testsuite/
* gcc.target/bpf/memset-1.c: New test.

(cherry picked from commit eae6b63b5b5426f943f58b5ae0bf0a6068ca8ad6)
gcc/config/bpf/bpf-protos.h
gcc/config/bpf/bpf.cc
gcc/config/bpf/bpf.md
gcc/testsuite/gcc.target/bpf/memset-1.c [new file with mode: 0644]
This page took 0.061184 seconds and 6 git commands to generate.