Skip to content

Commit

Permalink
[PowerPC/SPE] powerpcspe load and store instruction has
Browse files Browse the repository at this point in the history
8-bit offset instead of 16-bit unlike other load/store instructions.
so if stack grows any further than 8-bit, create one emergency slot
for spilling.
  • Loading branch information
Long5hot committed Jul 23, 2023
1 parent e126fa2 commit 41af6ec
Show file tree
Hide file tree
Showing 2 changed files with 5,625 additions and 4 deletions.
10 changes: 6 additions & 4 deletions llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2286,13 +2286,15 @@ PPCFrameLowering::addScavengingSpillSlot(MachineFunction &MF,
// slot for dynamic stack allocations.

// The scavenger might be invoked if the frame offset does not fit into
// the 16-bit immediate. We don't know the complete frame size here
// because we've not yet computed callee-saved register spills or the
// needed alignment padding.
// the 16-bit immediate in case of not SPE and 8-bit in case of SPE.
// We don't know the complete frame size here because we've not yet computed
// callee-saved register spills or the needed alignment padding.
unsigned StackSize = determineFrameLayout(MF, true);
MachineFrameInfo &MFI = MF.getFrameInfo();
bool NeedSpills = Subtarget.hasSPE() ? !isInt<8>(StackSize) : !isInt<16>(StackSize);

if (MFI.hasVarSizedObjects() || spillsCR(MF) || hasNonRISpills(MF) ||
(hasSpills(MF) && !isInt<16>(StackSize))) {
(hasSpills(MF) && NeedSpills)) {
const TargetRegisterClass &GPRC = PPC::GPRCRegClass;
const TargetRegisterClass &G8RC = PPC::G8RCRegClass;
const TargetRegisterClass &RC = Subtarget.isPPC64() ? G8RC : GPRC;
Expand Down

0 comments on commit 41af6ec

Please sign in to comment.