Skip to content

Commit

Permalink
[AArch64] Use spill size when calculating callee saves size (NFC) (#1…
Browse files Browse the repository at this point in the history
…23086)

This is an NFC right now, as currently, all register and spill sizes are
the same, but the spill size is the correct size to use here.
  • Loading branch information
MacDue authored Jan 17, 2025
1 parent 3b3590a commit 2c9dc08
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3795,14 +3795,15 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,
unsigned CSStackSize = 0;
unsigned SVECSStackSize = 0;
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
const MachineRegisterInfo &MRI = MF.getRegInfo();
for (unsigned Reg : SavedRegs.set_bits()) {
auto RegSize = TRI->getRegSizeInBits(Reg, MRI) / 8;
auto *RC = TRI->getMinimalPhysRegClass(Reg);
assert(RC && "expected register class!");
auto SpillSize = TRI->getSpillSize(*RC);
if (AArch64::PPRRegClass.contains(Reg) ||
AArch64::ZPRRegClass.contains(Reg))
SVECSStackSize += RegSize;
SVECSStackSize += SpillSize;
else
CSStackSize += RegSize;
CSStackSize += SpillSize;
}

// Increase the callee-saved stack size if the function has streaming mode
Expand Down

0 comments on commit 2c9dc08

Please sign in to comment.