On Sat, 29 Apr 2023 08:38:06 PDT (-0700), jeffreya...@gmail.com wrote:


On 4/29/23 04:59, Fei Gao wrote:
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.

Are you guys using rv32e? It's not widely tested, at least by most upstream folks. If you're actively trying to ship it then we should probably add it to the various lists of targest that get tested, as I'd bet there's a lot of oddness floating around.

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.
Thanks.  I rewrapped the ChangeLog and pushed this to the trunk.

Works for me, thanks for reviewing all this stuff -- we're all pretty buried ;)


jeff

Reply via email to