Skip to content

Commit ad63911

Browse files
committed
Don't use setIsSVECC()
Change-Id: I58542d83ae47b292ba3fa15f47ca0b9cb5a16141
1 parent c053a92 commit ad63911

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,16 @@ void AArch64FrameLowering::determineStackHazardSlot(
23942394
return;
23952395
}
23962396

2397+
// If another calling convention is explicitly set FPRs can't be promoted to
2398+
// ZPR callee-saves.
2399+
if (!is_contained({CallingConv::C, CallingConv::Fast,
2400+
CallingConv::AArch64_SVE_VectorCall},
2401+
MF.getFunction().getCallingConv())) {
2402+
LLVM_DEBUG(
2403+
dbgs() << "Calling convention is not supported with SplitSVEObjects");
2404+
return;
2405+
}
2406+
23972407
[[maybe_unused]] const AArch64Subtarget &Subtarget =
23982408
MF.getSubtarget<AArch64Subtarget>();
23992409
assert(Subtarget.isSVEorStreamingSVEAvailable() &&
@@ -2423,9 +2433,6 @@ void AArch64FrameLowering::determineStackHazardSlot(
24232433
}
24242434
SavedRegs |= FPRZRegs;
24252435

2426-
// FIXME: Avoid setting setting the CC. Since we've replaced FPRs with ZPRs
2427-
// we need to set this or later in PEI the ZPR CS will be masked out.
2428-
AFI->setIsSVECC(true);
24292436
AFI->setSplitSVEObjects(true);
24302437
}
24312438
}

llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,12 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
493493
bool hasSplitSVEObjects() const { return SplitSVEObjects; }
494494
void setSplitSVEObjects(bool s) { SplitSVEObjects = s; }
495495

496+
bool hasSVE_AAPCS(const MachineFunction &MF) const {
497+
return hasSplitSVEObjects() || isSVECC() ||
498+
MF.getFunction().getCallingConv() ==
499+
CallingConv::AArch64_SVE_VectorCall;
500+
}
501+
496502
SMEAttrs getSMEFnAttrs() const { return SMEFnAttrs; }
497503

498504
unsigned getSRetReturnReg() const { return SRetReturnReg; }

llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ bool AArch64RegisterInfo::regNeedsCFI(MCRegister Reg,
7171
const MCPhysReg *
7272
AArch64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
7373
assert(MF && "Invalid MachineFunction pointer.");
74+
auto &AFI = *MF->getInfo<AArch64FunctionInfo>();
7475

7576
if (MF->getFunction().getCallingConv() == CallingConv::GHC)
7677
// GHC set of callee saved regs is empty as all those regs are
@@ -101,10 +102,7 @@ AArch64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
101102
return CSR_Win_AArch64_AAPCS_SwiftTail_SaveList;
102103
if (MF->getFunction().getCallingConv() == CallingConv::AArch64_VectorCall)
103104
return CSR_Win_AArch64_AAVPCS_SaveList;
104-
if (MF->getFunction().getCallingConv() ==
105-
CallingConv::AArch64_SVE_VectorCall)
106-
return CSR_Win_AArch64_SVE_AAPCS_SaveList;
107-
if (MF->getInfo<AArch64FunctionInfo>()->isSVECC())
105+
if (AFI.hasSVE_AAPCS(*MF))
108106
return CSR_Win_AArch64_SVE_AAPCS_SaveList;
109107
return CSR_Win_AArch64_AAPCS_SaveList;
110108
}
@@ -148,7 +146,7 @@ AArch64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
148146
// This is for OSes other than Windows; Windows is a separate case further
149147
// above.
150148
return CSR_AArch64_AAPCS_X18_SaveList;
151-
if (MF->getInfo<AArch64FunctionInfo>()->isSVECC())
149+
if (AFI.hasSVE_AAPCS(*MF))
152150
return CSR_AArch64_SVE_AAPCS_SaveList;
153151
return CSR_AArch64_AAPCS_SaveList;
154152
}
@@ -158,6 +156,7 @@ AArch64RegisterInfo::getDarwinCalleeSavedRegs(const MachineFunction *MF) const {
158156
assert(MF && "Invalid MachineFunction pointer.");
159157
assert(MF->getSubtarget<AArch64Subtarget>().isTargetDarwin() &&
160158
"Invalid subtarget for getDarwinCalleeSavedRegs");
159+
auto &AFI = *MF->getInfo<AArch64FunctionInfo>();
161160

162161
if (MF->getFunction().getCallingConv() == CallingConv::CFGuard_Check)
163162
report_fatal_error(
@@ -205,7 +204,7 @@ AArch64RegisterInfo::getDarwinCalleeSavedRegs(const MachineFunction *MF) const {
205204
return CSR_Darwin_AArch64_RT_AllRegs_SaveList;
206205
if (MF->getFunction().getCallingConv() == CallingConv::Win64)
207206
return CSR_Darwin_AArch64_AAPCS_Win64_SaveList;
208-
if (MF->getInfo<AArch64FunctionInfo>()->isSVECC())
207+
if (AFI.hasSVE_AAPCS(*MF))
209208
return CSR_Darwin_AArch64_SVE_AAPCS_SaveList;
210209
return CSR_Darwin_AArch64_AAPCS_SaveList;
211210
}

0 commit comments

Comments
 (0)