diff options
author | Fei Gao <gaofei@eswincomputing.com> | 2023-04-17 16:47:23 -0600 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro> | 2023-04-17 16:47:23 -0600 |
commit | 60524be1e3929d83e15fceac6e2aa053c8a6fb20 (patch) | |
tree | de52eccd4d2666b36932c68223334cf482cecbd4 /gcc/data-streamer.cc | |
parent | 6d4ad4cca5d2b15d01a50a893348cbcfc340cdd5 (diff) | |
download | gcc-60524be1e3929d83e15fceac6e2aa053c8a6fb20.zip gcc-60524be1e3929d83e15fceac6e2aa053c8a6fb20.tar.gz gcc-60524be1e3929d83e15fceac6e2aa053c8a6fb20.tar.bz2 |
RISC-V: optimize stack manipulation in save-restore
The stack that save-restore reserves is not well accumulated in stack allocation and deallocation.
This patch allows less instructions to be used in stack allocation and deallocation if save-restore enabled.
before patch:
bar:
call t0,__riscv_save_4
addi sp,sp,-64
...
li t0,-12288
addi t0,t0,-1968 # optimized out after patch
add sp,sp,t0 # prologue
...
li t0,12288 # epilogue
addi t0,t0,2000 # optimized out after patch
add sp,sp,t0
...
addi sp,sp,32
tail __riscv_restore_4
after patch:
bar:
call t0,__riscv_save_4
addi sp,sp,-2032
...
li t0,-12288
add sp,sp,t0 # prologue
...
li t0,12288 # epilogue
add sp,sp,t0
...
addi sp,sp,2032
tail __riscv_restore_4
gcc/
* config/riscv/riscv.cc (riscv_expand_prologue): Consider save-restore in
stack allocation.
(riscv_expand_epilogue): Consider save-restore in stack deallocation.
gcc/testsuite
* gcc.target/riscv/stack_save_restore.c: New test.
Diffstat (limited to 'gcc/data-streamer.cc')
0 files changed, 0 insertions, 0 deletions