OSDN Git Service

Merging r368300:
authorHans Wennborg <hans@hanshq.net>
Wed, 14 Aug 2019 12:59:17 +0000 (12:59 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 14 Aug 2019 12:59:17 +0000 (12:59 +0000)
commitd48ca225eda4c1faef3e1738c289af633f65ea87
tree4f27c2c570565ebb00cf67340f086bfb0fe33fef
parent35cfab3d0419e023fb6a27c5ae50ccfa4c29a5d9
Merging r368300:
------------------------------------------------------------------------
r368300 | lenary | 2019-08-08 16:40:54 +0200 (Thu, 08 Aug 2019) | 18 lines

[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/branches/release_90@368846 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]