Skip to content

Commit 84314d0

Browse files
committed
Revert "[AArch64][NFC] Switch to LiveRegUnits (llvm#87313)"
This reverts commit 0f8a747. PR merged without approval.
1 parent af16d49 commit 84314d0

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@
197197
#include "llvm/ADT/SmallVector.h"
198198
#include "llvm/ADT/Statistic.h"
199199
#include "llvm/CodeGen/LivePhysRegs.h"
200-
#include "llvm/CodeGen/LiveRegUnits.h"
201200
#include "llvm/CodeGen/MachineBasicBlock.h"
202201
#include "llvm/CodeGen/MachineFrameInfo.h"
203202
#include "llvm/CodeGen/MachineFunction.h"
@@ -989,7 +988,7 @@ void AArch64FrameLowering::emitZeroCallUsedRegs(BitVector RegsToZero,
989988
}
990989
}
991990

992-
static void getLiveRegsForEntryMBB(LiveRegUnits &LiveRegs,
991+
static void getLiveRegsForEntryMBB(LivePhysRegs &LiveRegs,
993992
const MachineBasicBlock &MBB) {
994993
const MachineFunction *MF = MBB.getParent();
995994
LiveRegs.addLiveIns(MBB);
@@ -1019,18 +1018,16 @@ static Register findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB) {
10191018

10201019
const AArch64Subtarget &Subtarget = MF->getSubtarget<AArch64Subtarget>();
10211020
const AArch64RegisterInfo &TRI = *Subtarget.getRegisterInfo();
1022-
LiveRegUnits LiveRegs(TRI);
1021+
LivePhysRegs LiveRegs(TRI);
10231022
getLiveRegsForEntryMBB(LiveRegs, *MBB);
10241023

10251024
// Prefer X9 since it was historically used for the prologue scratch reg.
1026-
if (LiveRegs.available(AArch64::X9))
1025+
const MachineRegisterInfo &MRI = MF->getRegInfo();
1026+
if (LiveRegs.available(MRI, AArch64::X9))
10271027
return AArch64::X9;
10281028

1029-
BitVector Allocatable =
1030-
TRI.getAllocatableSet(*MF, TRI.getRegClass(AArch64::GPR64RegClassID));
1031-
1032-
for (unsigned Reg : Allocatable.set_bits()) {
1033-
if (LiveRegs.available(Reg))
1029+
for (unsigned Reg : AArch64::GPR64RegClass) {
1030+
if (LiveRegs.available(MRI, Reg))
10341031
return Reg;
10351032
}
10361033
return AArch64::NoRegister;
@@ -1046,11 +1043,14 @@ bool AArch64FrameLowering::canUseAsPrologue(
10461043
const AArch64FunctionInfo *AFI = MF->getInfo<AArch64FunctionInfo>();
10471044

10481045
if (AFI->hasSwiftAsyncContext()) {
1049-
LiveRegUnits LiveRegs(*RegInfo);
1046+
const AArch64RegisterInfo &TRI = *Subtarget.getRegisterInfo();
1047+
const MachineRegisterInfo &MRI = MF->getRegInfo();
1048+
LivePhysRegs LiveRegs(TRI);
10501049
getLiveRegsForEntryMBB(LiveRegs, MBB);
10511050
// The StoreSwiftAsyncContext clobbers X16 and X17. Make sure they are
10521051
// available.
1053-
if (!LiveRegs.available(AArch64::X16) || !LiveRegs.available(AArch64::X17))
1052+
if (!LiveRegs.available(MRI, AArch64::X16) ||
1053+
!LiveRegs.available(MRI, AArch64::X17))
10541054
return false;
10551055
}
10561056

@@ -1606,7 +1606,7 @@ static void emitDefineCFAWithFP(MachineFunction &MF, MachineBasicBlock &MBB,
16061606
/// Collect live registers from the end of \p MI's parent up to (including) \p
16071607
/// MI in \p LiveRegs.
16081608
static void getLivePhysRegsUpTo(MachineInstr &MI, const TargetRegisterInfo &TRI,
1609-
LiveRegUnits &LiveRegs) {
1609+
LivePhysRegs &LiveRegs) {
16101610

16111611
MachineBasicBlock &MBB = *MI.getParent();
16121612
LiveRegs.addLiveOuts(MBB);
@@ -1644,7 +1644,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
16441644
NonFrameStart->getFlag(MachineInstr::FrameSetup))
16451645
++NonFrameStart;
16461646

1647-
LiveRegUnits LiveRegs(*TRI);
1647+
LivePhysRegs LiveRegs(*TRI);
16481648
if (NonFrameStart != MBB.end()) {
16491649
getLivePhysRegsUpTo(*NonFrameStart, *TRI, LiveRegs);
16501650
// Ignore registers used for stack management for now.
@@ -1662,7 +1662,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
16621662
make_range(MBB.instr_begin(), NonFrameStart->getIterator())) {
16631663
for (auto &Op : MI.operands())
16641664
if (Op.isReg() && Op.isDef())
1665-
assert(LiveRegs.available(Op.getReg()) &&
1665+
assert(!LiveRegs.contains(Op.getReg()) &&
16661666
"live register clobbered by inserted prologue instructions");
16671667
}
16681668
});
@@ -4132,7 +4132,7 @@ MachineBasicBlock::iterator tryMergeAdjacentSTG(MachineBasicBlock::iterator II,
41324132
// FIXME : This approach of bailing out from merge is conservative in
41334133
// some ways like even if stg loops are not present after merge the
41344134
// insert list, this liveness check is done (which is not needed).
4135-
LiveRegUnits LiveRegs(*(MBB->getParent()->getSubtarget().getRegisterInfo()));
4135+
LivePhysRegs LiveRegs(*(MBB->getParent()->getSubtarget().getRegisterInfo()));
41364136
LiveRegs.addLiveOuts(*MBB);
41374137
for (auto I = MBB->rbegin();; ++I) {
41384138
MachineInstr &MI = *I;
@@ -4141,7 +4141,7 @@ MachineBasicBlock::iterator tryMergeAdjacentSTG(MachineBasicBlock::iterator II,
41414141
LiveRegs.stepBackward(*I);
41424142
}
41434143
InsertI++;
4144-
if (!LiveRegs.available(AArch64::NZCV))
4144+
if (LiveRegs.contains(AArch64::NZCV))
41454145
return InsertI;
41464146

41474147
llvm::stable_sort(Instrs,

0 commit comments

Comments
 (0)