Skip to content

Commit f61f7bc

Browse files
Address review comments
1 parent fff3e34 commit f61f7bc

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@ struct RegPairInfo {
27622762
unsigned Reg2 = AArch64::NoRegister;
27632763
int FrameIdx;
27642764
int Offset;
2765-
enum RegType { GPR, FPR64, FPR128, ZPR, PPR } Type;
2765+
enum RegType { GPR, FPR64, FPR128, PPR, ZPR } Type;
27662766

27672767
RegPairInfo() = default;
27682768

@@ -2787,22 +2787,6 @@ struct RegPairInfo {
27872787

27882788
} // end anonymous namespace
27892789

2790-
static unsigned findFreePredicateAsCounterReg(MachineBasicBlock *MBB) {
2791-
MachineFunction *MF = MBB->getParent();
2792-
2793-
const AArch64Subtarget &Subtarget = MF->getSubtarget<AArch64Subtarget>();
2794-
const AArch64RegisterInfo &TRI = *Subtarget.getRegisterInfo();
2795-
LivePhysRegs LiveRegs(TRI);
2796-
getLiveRegsForEntryMBB(LiveRegs, *MBB);
2797-
2798-
for (MCRegister PReg :
2799-
{AArch64::PN8, AArch64::PN9, AArch64::PN10, AArch64::PN11, AArch64::PN12,
2800-
AArch64::PN13, AArch64::PN14, AArch64::PN15}){
2801-
return PReg;
2802-
}
2803-
llvm_unreachable("No predicated register free");
2804-
}
2805-
28062790
static void computeCalleeSaveRegisterPairs(
28072791
MachineFunction &MF, ArrayRef<CalleeSavedInfo> CSI,
28082792
const TargetRegisterInfo *TRI, SmallVectorImpl<RegPairInfo> &RegPairs,
@@ -3097,7 +3081,9 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters(
30973081
PairRegs = AArch64::Z0_Z1 + (RPI.Reg1 - AArch64::Z0);
30983082
if (!PtrueCreated) {
30993083
PtrueCreated = true;
3100-
PnReg = findFreePredicateAsCounterReg(&MBB);
3084+
// Any one of predicate-as-count will be free to use
3085+
// This can be replaced in the future if needed
3086+
PnReg = AArch64::PN8;
31013087
BuildMI(MBB, MI, DL, TII.get(AArch64::PTRUE_C_B), PnReg)
31023088
.setMIFlags(MachineInstr::FrameSetup);
31033089
}
@@ -3220,7 +3206,9 @@ bool AArch64FrameLowering::restoreCalleeSavedRegisters(
32203206
PairRegs = AArch64::Z0_Z1 + (RPI.Reg1 - AArch64::Z0);
32213207
if (!PtrueCreated) {
32223208
PtrueCreated = true;
3223-
PnReg = findFreePredicateAsCounterReg(&MBB);
3209+
// Any one of predicate-as-count will be free to use
3210+
// This can be replaced in the future if needed
3211+
PnReg = AArch64::PN8;
32243212
BuildMI(MBB, MBBI, DL, TII.get(AArch64::PTRUE_C_B), PnReg)
32253213
.setMIFlags(MachineInstr::FrameDestroy);
32263214
}

0 commit comments

Comments
 (0)