aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2023-08-10 21:17:53 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2023-08-11 20:34:57 +0200
commitf93a612fc4567652b75ffc916d31a446378e6613 (patch)
treee7d1e2e5bb61b7c12f1ac72b6ed45d8078d412a7 /libgcc
parent6103df1e4fae5192c507484b1d32f00c42c70b54 (diff)
downloadgcc-f93a612fc4567652b75ffc916d31a446378e6613.zip
gcc-f93a612fc4567652b75ffc916d31a446378e6613.tar.gz
gcc-f93a612fc4567652b75ffc916d31a446378e6613.tar.bz2
bpf: liberate R9 for general register allocation
We were reserving one of the hard registers in BPF in order to implement dynamic stack allocation: alloca and VLAs. However, there is kernel code that has inline assembly that requires all the non-fixed registers to be available for register allocation. This patch: 1. Liberates r9 that is now available for register allocation. 2. Adds a check to GCC so it errors out if the user tries to do dynamic stack allocation. A couple of tests are added for this. 3. Changes xbpf so it no longer saves and restores callee-saved registers. A couple of tests for this have been removed. 4. Adds bpf-*-* to the list of targets that do not support alloca in target-support.exp. Tested in host x86_64-linux-gnu and target bpf-unknown-none. gcc/ChangeLog * config/bpf/bpf.md (allocate_stack): Define. * config/bpf/bpf.h (FIRST_PSEUDO_REGISTER): Make room for fake stack pointer register. (FIXED_REGISTERS): Adjust accordingly. (CALL_USED_REGISTERS): Likewise. (REG_CLASS_CONTENTS): Likewise. (REGISTER_NAMES): Likewise. * config/bpf/bpf.cc (bpf_compute_frame_layout): Do not reserve space for callee-saved registers. (bpf_expand_prologue): Do not save callee-saved registers in xbpf. (bpf_expand_epilogue): Do not restore callee-saved registers in xbpf. gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_alloca): BPF target does not support alloca. * gcc.target/bpf/diag-alloca-1.c: New test. * gcc.target/bpf/diag-alloca-2.c: Likewise. * gcc.target/bpf/xbpf-callee-saved-regs-1.c: Remove test. * gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise. * gcc.target/bpf/regs-availability-1.c: Likewise.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions