aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorCupertino Miranda <cupertino.miranda@oracle.com>2024-03-20 19:06:47 +0000
committerCupertino Miranda <cupertino.miranda@oracle.com>2024-04-19 11:09:16 +0100
commitd7190d0b9a8e395f46b475e4d525f2b6a0ce4df4 (patch)
tree2d63a754dd513f577b494ac89fe7322f851fb7c8 /gcc/c
parent4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac (diff)
downloadgcc-d7190d0b9a8e395f46b475e4d525f2b6a0ce4df4.zip
gcc-d7190d0b9a8e395f46b475e4d525f2b6a0ce4df4.tar.gz
gcc-d7190d0b9a8e395f46b475e4d525f2b6a0ce4df4.tar.bz2
bpf: support more instructions to match CO-RE relocations
BPF supports multiple instructions to be CO-RE relocatable regardless of the position of the immediate field in the encoding. In particular, not only the MOV instruction allows a CO-RE relocation of its immediate operand, but the LD and ST instructions can have a CO-RE relocation happening to their offset immediate operand, even though those operands are encoded in different encoding bits. This patch moves matching from a more traditional matching of the UNSPEC_CORE_RELOC pattern within a define_insn to a match within the constraints of both immediates and address operands from more generic mov define_insn rule. gcc/Changelog: * config/bpf/bpf-protos.h (bpf_add_core_reloc): Renamed function to bpf_output_move. * config/bpf/bpf.cc (bpf_legitimate_address_p): Allow UNSPEC_CORE_RELOC to match an address. (bpf_insn_cost): Make UNSPEC_CORE_RELOC immediate moves expensive to prioritize loads and stores. (TARGET_INSN_COST): Add hook. (bpf_output_move): Wrapper to call bpf_output_core_reloc. (bpf_print_operand): Add support to print immediate operands specified with the UNSPEC_CORE_RELOC. (bpf_print_operand_address): Likewise, but to support UNSPEC_CORE_RELOC in addresses. (bpf_init_builtins): Flag BPF_BUILTIN_CORE_RELOC as NOTHROW. * config/bpf/bpf.md: Wrap patterns for MOV, LD and ST instruction with bpf_output_move call. (mov_reloc_core<MM:mode>): Remove now spurious define_insn. * config/bpf/constraints.md: Added "c" and "C" constraints to match immediates represented with UNSPEC_CORE_RELOC. * config/bpf/core-builtins.cc (bpf_add_core_reloc): Remove (bpf_output_core_reloc): Add function to create the CO-RE relocations based on new matching rules. * config/bpf/core-builtins.h (bpf_output_core_reloc): Add prototype. * config/bpf/predicates.md (core_imm_operand) Add predicate. (mov_src_operand): Add match for core_imm_operand. gcc/testsuite/ChangeLog: * gcc.target/bpf/btfext-funcinfo.c: Updated to changes. * gcc.target/bpf/core-builtin-fieldinfo-const-elimination.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-existence-1.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-offset-1.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-sign-1.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-sign-2.c: Likewise. * gcc.target/bpf/core-builtin-fieldinfo-size-1.c: Likewise.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions