Skip to content

Commit 3c911fd

Browse files
committed
Fixups
1 parent af48791 commit 3c911fd

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ class AArch64ExpandPseudo : public MachineFunctionPass {
9292
bool expandCALL_BTI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI);
9393
bool expandStoreSwiftAsyncContext(MachineBasicBlock &MBB,
9494
MachineBasicBlock::iterator MBBI);
95-
MachineBasicBlock *expandCommitOrRestoreZA(MachineBasicBlock &MBB,
96-
MachineBasicBlock::iterator MBBI);
95+
MachineBasicBlock *
96+
expandCommitOrRestoreZASave(MachineBasicBlock &MBB,
97+
MachineBasicBlock::iterator MBBI);
9798
MachineBasicBlock *expandCondSMToggle(MachineBasicBlock &MBB,
9899
MachineBasicBlock::iterator MBBI);
99100
};
@@ -992,13 +993,12 @@ bool AArch64ExpandPseudo::expandStoreSwiftAsyncContext(
992993

993994
static constexpr unsigned ZERO_ALL_ZA_MASK = 0b11111111;
994995

995-
MachineBasicBlock *
996-
AArch64ExpandPseudo::expandCommitOrRestoreZA(MachineBasicBlock &MBB,
997-
MachineBasicBlock::iterator MBBI) {
996+
MachineBasicBlock *AArch64ExpandPseudo::expandCommitOrRestoreZASave(
997+
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) {
998998
MachineInstr &MI = *MBBI;
999999
bool IsRestoreZA = MI.getOpcode() == AArch64::RestoreZAPseudo;
10001000
assert((MI.getOpcode() == AArch64::RestoreZAPseudo ||
1001-
MI.getOpcode() == AArch64::CommitZAPseudo) &&
1001+
MI.getOpcode() == AArch64::CommitZASavePseudo) &&
10021002
"Expected ZA commit or restore");
10031003
assert((std::next(MBBI) != MBB.end() ||
10041004
MI.getParent()->successors().begin() !=
@@ -1669,9 +1669,9 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &MBB,
16691669
return expandCALL_BTI(MBB, MBBI);
16701670
case AArch64::StoreSwiftAsyncContext:
16711671
return expandStoreSwiftAsyncContext(MBB, MBBI);
1672-
case AArch64::CommitZAPseudo:
1672+
case AArch64::CommitZASavePseudo:
16731673
case AArch64::RestoreZAPseudo: {
1674-
auto *NewMBB = expandCommitOrRestoreZA(MBB, MBBI);
1674+
auto *NewMBB = expandCommitOrRestoreZASave(MBB, MBBI);
16751675
if (NewMBB != &MBB)
16761676
NextMBBI = MBB.end(); // The NextMBBI iterator is invalidated.
16771677
return true;

llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ let hasSideEffects = 1 in {
9999
def RequiresZASavePseudo : Pseudo<(outs), (ins), []>, Sched<[]>;
100100
}
101101

102-
def CommitZAPseudo
102+
def CommitZASavePseudo
103103
: Pseudo<(outs),
104104
(ins GPR64:$tpidr2_el0, i64imm:$commit_routine, variable_ops), []>,
105105
Sched<[]>;

llvm/lib/Target/AArch64/MachineSMEABIPass.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ static bool isZAorZT0RegOp(const TargetRegisterInfo &TRI,
107107
});
108108
}
109109

110+
/// Returns the required ZA state needed before \p MI and an iterator pointing
111+
/// to where any code required to change the ZA state should be inserted.
110112
static std::pair<ZAState, MachineBasicBlock::iterator>
111-
getInstNeededZAState(const TargetRegisterInfo &TRI, MachineInstr &MI,
113+
getZAStateBeforeInst(const TargetRegisterInfo &TRI, MachineInstr &MI,
112114
bool ZALiveAtReturn) {
113115
MachineBasicBlock::iterator InsertPt(MI);
114116

@@ -254,7 +256,7 @@ void MachineSMEABI::collectNeededZAStates(SMEAttrs SMEFnAttrs) {
254256
MachineBasicBlock::iterator MBBI(MI);
255257
LiveUnits.stepBackward(MI);
256258
LiveRegs PhysLiveRegs = GetPhysLiveRegs();
257-
auto [NeededState, InsertPt] = getInstNeededZAState(
259+
auto [NeededState, InsertPt] = getZAStateBeforeInst(
258260
*TRI, MI, /*ZALiveAtReturn=*/SMEFnAttrs.hasSharedZAInterface());
259261
assert((InsertPt == MBBI ||
260262
InsertPt->getOpcode() == AArch64::ADJCALLSTACKDOWN) &&
@@ -545,14 +547,14 @@ void MachineSMEABI::emitNewZAPrologue(MachineBasicBlock &MBB,
545547
.addReg(TPIDR2EL0, RegState::Define)
546548
.addImm(AArch64SysReg::TPIDR2_EL0);
547549
// If TPIDR2_EL0 is non-zero, commit the lazy save.
548-
auto CommitZA =
549-
BuildMI(MBB, MBBI, DL, TII->get(AArch64::CommitZAPseudo))
550+
auto CommitZASave =
551+
BuildMI(MBB, MBBI, DL, TII->get(AArch64::CommitZASavePseudo))
550552
.addReg(TPIDR2EL0)
551553
.addExternalSymbol(TLI->getLibcallName(RTLIB::SMEABI_TPIDR2_SAVE))
552554
.addRegMask(TRI->SMEABISupportRoutinesCallPreservedMaskFromX0());
553555
// NOTE: Functions that only use ZT0 don't need to zero ZA.
554556
if (MF->getInfo<AArch64FunctionInfo>()->getSMEFnAttrs().hasZAState())
555-
CommitZA.addDef(AArch64::ZAB0, RegState::ImplicitDefine);
557+
CommitZASave.addDef(AArch64::ZAB0, RegState::ImplicitDefine);
556558
// Enable ZA (as ZA could have previously been in the OFF state).
557559
BuildMI(MBB, MBBI, DL, TII->get(AArch64::MSRpstatesvcrImm1))
558560
.addImm(AArch64SVCR::SVCRZA)

0 commit comments

Comments
 (0)