]> granicus.if.org Git - llvm/commit
[RISCV] Minimal stack realignment support
authorSam Elliott <selliott@lowrisc.org>
Thu, 8 Aug 2019 14:40:54 +0000 (14:40 +0000)
committerSam Elliott <selliott@lowrisc.org>
Thu, 8 Aug 2019 14:40:54 +0000 (14:40 +0000)
commitf45059d8aca21b5af4303966485c2caf25e94b0d
treefadf68aef382c7bed682ac4f4a9bc416f974294a
parent28fdaaed4aa5dcb273f8d9cb77dddceb472f1f1d
[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
lib/Target/RISCV/RISCVFrameLowering.cpp
test/CodeGen/RISCV/stack-realignment-unsupported.ll [new file with mode: 0644]
test/CodeGen/RISCV/stack-realignment.ll [new file with mode: 0644]