diff options
author | Fei Gao <gaofei@eswincomputing.com> | 2023-04-29 09:35:00 -0600 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro> | 2023-04-29 09:35:00 -0600 |
commit | a5b2a3bff8152aa34408d8ce40add82f4d22ff87 (patch) | |
tree | 15f95a44e2f2478afb3c7ac410c940db22daa053 /libcpp/init.cc | |
parent | 502051957444a2fc392dd973e978664e2cd0be2b (diff) | |
download | gcc-a5b2a3bff8152aa34408d8ce40add82f4d22ff87.zip gcc-a5b2a3bff8152aa34408d8ce40add82f4d22ff87.tar.gz gcc-a5b2a3bff8152aa34408d8ce40add82f4d22ff87.tar.bz2 |
RISC-V: decouple stack allocation for rv32e w/o save-restore
Currently in rv32e, stack allocation for GPR callee-saved registers is
always 12 bytes w/o save-restore. Actually, for the case without save-restore,
less stack memory can be reserved. This patch decouples stack allocation for
rv32e w/o save-restore and makes riscv_compute_frame_info more readable.
output of testcase rv32e_stack.c
before patch:
addi sp,sp,-16
sw ra,12(sp)
call getInt
sw a0,0(sp)
lw a0,0(sp)
call PrintInts
lw a5,0(sp)
mv a0,a5
lw ra,12(sp)
addi sp,sp,16
jr ra
after patch:
addi sp,sp,-8
sw ra,4(sp)
call getInt
sw a0,0(sp)
lw a0,0(sp)
call PrintInts
lw a5,0(sp)
mv a0,a5
lw ra,4(sp)
addi sp,sp,8
jr ra
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_avoid_save_libcall): helper function
for riscv_use_save_libcall.
(riscv_use_save_libcall): call riscv_avoid_save_libcall.
(riscv_compute_frame_info): restructure to decouple stack allocation
for rv32e w/o save-restore.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rv32e_stack.c: New test.
Diffstat (limited to 'libcpp/init.cc')
0 files changed, 0 insertions, 0 deletions