197
197
#include " llvm/ADT/SmallVector.h"
198
198
#include " llvm/ADT/Statistic.h"
199
199
#include " llvm/CodeGen/LivePhysRegs.h"
200
+ #include " llvm/CodeGen/LiveRegUnits.h"
200
201
#include " llvm/CodeGen/MachineBasicBlock.h"
201
202
#include " llvm/CodeGen/MachineFrameInfo.h"
202
203
#include " llvm/CodeGen/MachineFunction.h"
@@ -988,7 +989,7 @@ void AArch64FrameLowering::emitZeroCallUsedRegs(BitVector RegsToZero,
988
989
}
989
990
}
990
991
991
- static void getLiveRegsForEntryMBB (LivePhysRegs &LiveRegs,
992
+ static void getLiveRegsForEntryMBB (LiveRegUnits &LiveRegs,
992
993
const MachineBasicBlock &MBB) {
993
994
const MachineFunction *MF = MBB.getParent ();
994
995
LiveRegs.addLiveIns (MBB);
@@ -1018,16 +1019,15 @@ static Register findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB) {
1018
1019
1019
1020
const AArch64Subtarget &Subtarget = MF->getSubtarget <AArch64Subtarget>();
1020
1021
const AArch64RegisterInfo &TRI = *Subtarget.getRegisterInfo ();
1021
- LivePhysRegs LiveRegs (TRI);
1022
+ LiveRegUnits LiveRegs (TRI);
1022
1023
getLiveRegsForEntryMBB (LiveRegs, *MBB);
1023
1024
1024
1025
// Prefer X9 since it was historically used for the prologue scratch reg.
1025
- const MachineRegisterInfo &MRI = MF->getRegInfo ();
1026
- if (LiveRegs.available (MRI, AArch64::X9))
1026
+ if (LiveRegs.available (AArch64::X9))
1027
1027
return AArch64::X9;
1028
1028
1029
- for (unsigned Reg : AArch64::GPR64RegClass) {
1030
- if (LiveRegs.available (MRI, Reg))
1029
+ for (Register Reg : AArch64::GPR64RegClass) {
1030
+ if (LiveRegs.available (Reg))
1031
1031
return Reg;
1032
1032
}
1033
1033
return AArch64::NoRegister;
@@ -1044,13 +1044,11 @@ bool AArch64FrameLowering::canUseAsPrologue(
1044
1044
1045
1045
if (AFI->hasSwiftAsyncContext ()) {
1046
1046
const AArch64RegisterInfo &TRI = *Subtarget.getRegisterInfo ();
1047
- const MachineRegisterInfo &MRI = MF->getRegInfo ();
1048
- LivePhysRegs LiveRegs (TRI);
1047
+ LiveRegUnits LiveRegs (TRI);
1049
1048
getLiveRegsForEntryMBB (LiveRegs, MBB);
1050
1049
// The StoreSwiftAsyncContext clobbers X16 and X17. Make sure they are
1051
1050
// available.
1052
- if (!LiveRegs.available (MRI, AArch64::X16) ||
1053
- !LiveRegs.available (MRI, AArch64::X17))
1051
+ if (!LiveRegs.available (AArch64::X16) || !LiveRegs.available (AArch64::X17))
1054
1052
return false ;
1055
1053
}
1056
1054
@@ -1603,7 +1601,7 @@ static void emitDefineCFAWithFP(MachineFunction &MF, MachineBasicBlock &MBB,
1603
1601
// / Collect live registers from the end of \p MI's parent up to (including) \p
1604
1602
// / MI in \p LiveRegs.
1605
1603
static void getLivePhysRegsUpTo (MachineInstr &MI, const TargetRegisterInfo &TRI,
1606
- LivePhysRegs &LiveRegs) {
1604
+ LiveRegUnits &LiveRegs) {
1607
1605
1608
1606
MachineBasicBlock &MBB = *MI.getParent ();
1609
1607
LiveRegs.addLiveOuts (MBB);
@@ -1641,7 +1639,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
1641
1639
NonFrameStart->getFlag (MachineInstr::FrameSetup))
1642
1640
++NonFrameStart;
1643
1641
1644
- LivePhysRegs LiveRegs (*TRI);
1642
+ LiveRegUnits LiveRegs (*TRI);
1645
1643
if (NonFrameStart != MBB.end ()) {
1646
1644
getLivePhysRegsUpTo (*NonFrameStart, *TRI, LiveRegs);
1647
1645
// Ignore registers used for stack management for now.
@@ -1659,7 +1657,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
1659
1657
make_range (MBB.instr_begin (), NonFrameStart->getIterator ())) {
1660
1658
for (auto &Op : MI.operands ())
1661
1659
if (Op.isReg () && Op.isDef ())
1662
- assert (! LiveRegs.contains (Op.getReg ()) &&
1660
+ assert (LiveRegs.available (Op.getReg ()) &&
1663
1661
" live register clobbered by inserted prologue instructions" );
1664
1662
}
1665
1663
});
@@ -4014,7 +4012,7 @@ MachineBasicBlock::iterator tryMergeAdjacentSTG(MachineBasicBlock::iterator II,
4014
4012
// FIXME : This approach of bailing out from merge is conservative in
4015
4013
// some ways like even if stg loops are not present after merge the
4016
4014
// insert list, this liveness check is done (which is not needed).
4017
- LivePhysRegs LiveRegs (*(MBB->getParent ()->getSubtarget ().getRegisterInfo ()));
4015
+ LiveRegUnits LiveRegs (*(MBB->getParent ()->getSubtarget ().getRegisterInfo ()));
4018
4016
LiveRegs.addLiveOuts (*MBB);
4019
4017
for (auto I = MBB->rbegin ();; ++I) {
4020
4018
MachineInstr &MI = *I;
@@ -4023,7 +4021,7 @@ MachineBasicBlock::iterator tryMergeAdjacentSTG(MachineBasicBlock::iterator II,
4023
4021
LiveRegs.stepBackward (*I);
4024
4022
}
4025
4023
InsertI++;
4026
- if (LiveRegs.contains (AArch64::NZCV))
4024
+ if (! LiveRegs.available (AArch64::NZCV))
4027
4025
return InsertI;
4028
4026
4029
4027
llvm::stable_sort (Instrs,
0 commit comments