Skip to content

Commit 1f4858f

Browse files
committed
Rebase
Change-Id: I1208aebeabbc4df1c81f1c8f5a222688c28ef985
1 parent 4e231e7 commit 1f4858f

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4205,9 +4205,7 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,
42054205
// instructions.
42064206
AFI->setCalleeSavedStackSize(AlignedCSStackSize);
42074207
AFI->setCalleeSaveStackHasFreeSpace(AlignedCSStackSize != CSStackSize);
4208-
4209-
AFI->setZPRCalleeSavedStackSize(ZPRCSStackSize);
4210-
AFI->setPPRCalleeSavedStackSize(alignTo(PPRCSStackSize, 16));
4208+
AFI->setSVECalleeSavedStackSize(ZPRCSStackSize, alignTo(PPRCSStackSize, 16));
42114209
}
42124210

42134211
bool AArch64FrameLowering::assignCalleeSavedSpillSlots(

llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,21 @@
2323

2424
using namespace llvm;
2525

26+
static std::optional<uint64_t>
27+
getSVEStackSize(const AArch64FunctionInfo &MFI,
28+
uint64_t (AArch64FunctionInfo::*GetStackSize)() const) {
29+
if (!MFI.hasCalculatedStackSizeSVE())
30+
return std::nullopt;
31+
return (MFI.*GetStackSize)();
32+
}
33+
2634
yaml::AArch64FunctionInfo::AArch64FunctionInfo(
2735
const llvm::AArch64FunctionInfo &MFI)
2836
: HasRedZone(MFI.hasRedZone()),
29-
StackSizeSVE(MFI.hasCalculatedStackSizeSVE()
30-
? std::optional<uint64_t>(MFI.getStackSizeSVE())
31-
: std::nullopt) {}
37+
StackSizeZPR(
38+
getSVEStackSize(MFI, &llvm::AArch64FunctionInfo::getStackSizeZPR)),
39+
StackSizePPR(
40+
getSVEStackSize(MFI, &llvm::AArch64FunctionInfo::getStackSizePPR)) {}
3241

3342
void yaml::AArch64FunctionInfo::mappingImpl(yaml::IO &YamlIO) {
3443
MappingTraits<AArch64FunctionInfo>::mapping(YamlIO, *this);
@@ -38,8 +47,9 @@ void AArch64FunctionInfo::initializeBaseYamlFields(
3847
const yaml::AArch64FunctionInfo &YamlMFI) {
3948
if (YamlMFI.HasRedZone)
4049
HasRedZone = YamlMFI.HasRedZone;
41-
if (YamlMFI.StackSizeSVE)
42-
setStackSizeSVE(*YamlMFI.StackSizeSVE);
50+
if (YamlMFI.StackSizeZPR || YamlMFI.StackSizePPR)
51+
setStackSizeSVE(YamlMFI.StackSizeZPR.value_or(0),
52+
YamlMFI.StackSizePPR.value_or(0));
4353
}
4454

4555
static std::pair<bool, bool> GetSignReturnAddress(const Function &F) {

llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -409,22 +409,16 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
409409
}
410410

411411
// Saves the CalleeSavedStackSize for SVE vectors in 'scalable bytes'
412-
void setZPRCalleeSavedStackSize(unsigned Size) {
413-
ZPRCalleeSavedStackSize = Size;
412+
void setSVECalleeSavedStackSize(unsigned ZPR, unsigned PPR = 0) {
413+
ZPRCalleeSavedStackSize = ZPR;
414+
PPRCalleeSavedStackSize = PPR;
414415
HasSVECalleeSavedStackSize = true;
415416
}
416417
unsigned getZPRCalleeSavedStackSize() const {
417418
assert(HasSVECalleeSavedStackSize &&
418419
"ZPRCalleeSavedStackSize has not been calculated");
419420
return ZPRCalleeSavedStackSize;
420421
}
421-
422-
// Saves the CalleeSavedStackSize for SVE predicate vectors in 'scalable
423-
// bytes'
424-
void setPPRCalleeSavedStackSize(unsigned Size) {
425-
PPRCalleeSavedStackSize = Size;
426-
HasSVECalleeSavedStackSize = true;
427-
}
428422
unsigned getPPRCalleeSavedStackSize() const {
429423
assert(HasSVECalleeSavedStackSize &&
430424
"PPRCalleeSavedStackSize has not been calculated");
@@ -616,7 +610,8 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
616610
namespace yaml {
617611
struct AArch64FunctionInfo final : public yaml::MachineFunctionInfo {
618612
std::optional<bool> HasRedZone;
619-
std::optional<uint64_t> StackSizeSVE;
613+
std::optional<uint64_t> StackSizeZPR;
614+
std::optional<uint64_t> StackSizePPR;
620615

621616
AArch64FunctionInfo() = default;
622617
AArch64FunctionInfo(const llvm::AArch64FunctionInfo &MFI);
@@ -628,7 +623,8 @@ struct AArch64FunctionInfo final : public yaml::MachineFunctionInfo {
628623
template <> struct MappingTraits<AArch64FunctionInfo> {
629624
static void mapping(IO &YamlIO, AArch64FunctionInfo &MFI) {
630625
YamlIO.mapOptional("hasRedZone", MFI.HasRedZone);
631-
YamlIO.mapOptional("stackSizeSVE", MFI.StackSizeSVE);
626+
YamlIO.mapOptional("stackSizeZPR", MFI.StackSizeZPR);
627+
YamlIO.mapOptional("stackSizePPR", MFI.StackSizePPR);
632628
}
633629
};
634630

llvm/test/DebugInfo/AArch64/asan-stack-vars.mir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ frameInfo:
366366
maxCallFrameSize: 0
367367
localFrameSize: 144
368368
machineFunctionInfo:
369-
stackSizeSVE: 0
369+
stackSizeZPR: 0
370+
stackSizePPR: 0
370371
stack:
371372
- { id: 0, name: StackGuardSlot, offset: -40, size: 8, alignment: 8,
372373
stack-id: default, local-offset: -8 }

llvm/test/DebugInfo/AArch64/compiler-gen-bbs-livedebugvalues.mir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ frameInfo:
6969
hasCalls: true
7070
maxCallFrameSize: 0
7171
machineFunctionInfo:
72-
stackSizeSVE: 0
72+
stackSizeZPR: 0
73+
stackSizePPR: 0
7374
stack:
7475
- { id: 0, type: spill-slot, offset: -20, size: 4, alignment: 4, stack-id: default }
7576
- { id: 1, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: default,

0 commit comments

Comments
 (0)