[PATCH] D135757: [LoongArch] Add emergency spill slot for GPR for large frames

wanglei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 02:22:39 PDT 2022


wangleiat created this revision.
wangleiat added reviewers: SixWeining, xen0n, xry111, gonglingqin, MaskRay.
Herald added subscribers: StephenFan, luismarques, s.egerton, PkmX, simoncook, hiraditya, arichardson, qcolombet.
Herald added a project: All.
wangleiat requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.

An emergency spill slot is created when the stack size cannot be
represented by an 11-bit signed number.

This patch also modifies how the `sp` is adjusted in the prologue.

`RegScavenger` will place the spill instruction before the prologue
if a VReg is created in the prologue. This will pollute the caller's
stack data. Therefore, until there is better way, we just use the
`addi.w/d` instruction for stack adjustment to ensure that VReg will
not be created. (RISCV has the same issue #58286)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135757

Files:
  llvm/lib/Target/LoongArch/LoongArchFrameLowering.cpp
  llvm/lib/Target/LoongArch/LoongArchFrameLowering.h
  llvm/test/CodeGen/LoongArch/emergency-spill-slot.ll
  llvm/test/CodeGen/LoongArch/frame.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135757.467071.patch
Type: text/x-patch
Size: 8062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221012/c1a48490/attachment.bin>


More information about the llvm-commits mailing list