[Clang][BPF] Support record argument with direct values
authorYonghong Song <yhs@fb.com>
Thu, 18 Aug 2022 15:01:45 +0000 (08:01 -0700)
committerYonghong Song <yhs@fb.com>
Fri, 19 Aug 2022 02:11:50 +0000 (19:11 -0700)
commit481d67d310a7a4213da72f838d6bafaa52ed01d3
tree7feb2e5aa874df92f59adb8809a2438a48fb4d6c
parentfc2b4dfef2f1c4d04d0d5d25e14ffaa0622d5189
[Clang][BPF] Support record argument with direct values

Currently, record arguments are always passed by reference by allocating
space for record values in the caller. This is less efficient for
small records which may take one or two registers. For example,
for x86_64 and aarch64, for a record size up to 16 bytes, the record
values can be passed by values directly on the registers.

This patch added BPF support of record argument with direct values
for up to 16 byte record size. If record size is 0, that record
will not take any register, which is the same behavior for x86_64
and aarch64. If the record size is greater than 16 bytes, the
record argument will be passed by reference.

Differential Revision: https://reviews.llvm.org/D132144
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/bpf-struct-argument.c [new file with mode: 0644]
clang/test/CodeGen/bpf-union-argument.c [new file with mode: 0644]
llvm/test/CodeGen/BPF/struct-arg-inline.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/struct-arg.ll [new file with mode: 0644]