5 Commits

Author SHA1 Message Date
Shiva Chen
515eefeb33 [RISCV] Split SP adjustment to reduce the offset of callee saved register spill and restore
We would like to split the SP adjustment to reduce the instructions in
prologue and epilogue as the following case. In this way, the offset of
the callee saved register could fit in a single store.

    add     sp,sp,-2032
    sw      ra,2028(sp)
    sw      s0,2024(sp)
    sw      s1,2020(sp)
    sw      s3,2012(sp)
    sw      s4,2008(sp)
    add     sp,sp,-64

Differential Revision: https://reviews.llvm.org/D68011

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373688 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-04 02:00:57 +00:00
Shiva Chen
6e5264ef03 [RISCV] Support stack offset exceed 32-bit for RV64
Differential Revision: https://reviews.llvm.org/D61884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371810 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 04:03:32 +00:00
Shiva Chen
e1a0a6d1f2 Revert "[RISCV] Support stack offset exceed 32-bit for RV64"
This reverts commit 1c340c6205.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371809 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 04:03:24 +00:00
Shiva Chen
1c340c6205 [RISCV] Support stack offset exceed 32-bit for RV64
Differential Revision: https://reviews.llvm.org/D61884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371806 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 02:50:13 +00:00
Sam Elliott
f45059d8ac [RISCV] Minimal stack realignment support
Summary:
Currently the RISC-V backend does not realign the stack. This can be an issue even for the RV32I/RV64I ABIs (where the stack is 16-byte aligned), though is rare. It will be much more comment with RV32E (though the alignment requirements for common data types remain under-documented...).

This patch adds minimal support for stack realignment. It should cope with large realignments. It will error out if the stack needs realignment and variable sized objects are present.

It feels like a lot of the code like getFrameIndexReference and determineFrameLayout could be refactored somehow, as right now it feels fiddly and brittle. We also seem to allocate a lot more memory than GCC does for equivalent C code.

Reviewers: asb

Reviewed By: asb

Subscribers: wwei, jrtc27, s.egerton, MaskRay, Jim, lenary, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62007

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368300 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-08 14:40:54 +00:00