Skip to content

Commit b3639e9

Browse files
committed
RegisterCoalescer: Use Register
1 parent 43a38a6 commit b3639e9

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace {
143143
/// To avoid repeatedly merging sets of DbgValueLocs, instead record
144144
/// which vregs have been coalesced, and where to. This map is from
145145
/// vreg => {set of vregs merged in}.
146-
DenseMap<Register, SmallVector<unsigned, 4>> DbgMergedVRegNums;
146+
DenseMap<Register, SmallVector<Register, 4>> DbgMergedVRegNums;
147147

148148
/// A LaneMask to remember on which subregister live ranges we need to call
149149
/// shrinkToUses() later.
@@ -178,11 +178,11 @@ namespace {
178178
/// The collection of live intervals which should have been updated
179179
/// immediately after rematerialiation but delayed until
180180
/// lateLiveIntervalUpdate is called.
181-
DenseSet<unsigned> ToBeUpdated;
181+
DenseSet<Register> ToBeUpdated;
182182

183183
/// Record how many times the large live interval with many valnos
184184
/// has been tried to join with other live interval.
185-
DenseMap<unsigned, unsigned long> LargeLIVisitCounter;
185+
DenseMap<Register, unsigned long> LargeLIVisitCounter;
186186

187187
/// Recursively eliminate dead defs in DeadDefs.
188188
void eliminateDeadDefs();
@@ -424,7 +424,7 @@ static bool isSplitEdge(const MachineBasicBlock *MBB) {
424424
}
425425

426426
bool CoalescerPair::setRegisters(const MachineInstr *MI) {
427-
SrcReg = DstReg = 0;
427+
SrcReg = DstReg = Register();
428428
SrcIdx = DstIdx = 0;
429429
NewRC = nullptr;
430430
Flipped = CrossClass = false;
@@ -1231,8 +1231,8 @@ bool RegisterCoalescer::removePartialRedundancy(const CoalescerPair &CP,
12311231
/// Returns true if @p MI defines the full vreg @p Reg, as opposed to just
12321232
/// defining a subregister.
12331233
static bool definesFullReg(const MachineInstr &MI, Register Reg) {
1234-
assert(!Register::isPhysicalRegister(Reg) &&
1235-
"This code cannot handle physreg aliasing");
1234+
assert(!Reg.isPhysical() && "This code cannot handle physreg aliasing");
1235+
12361236
for (const MachineOperand &Op : MI.operands()) {
12371237
if (!Op.isReg() || !Op.isDef() || Op.getReg() != Reg)
12381238
continue;
@@ -1297,7 +1297,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
12971297

12981298
const TargetRegisterClass *DefRC = TII->getRegClass(MCID, 0, TRI, *MF);
12991299
if (!DefMI->isImplicitDef()) {
1300-
if (Register::isPhysicalRegister(DstReg)) {
1300+
if (DstReg.isPhysical()) {
13011301
Register NewDstReg = DstReg;
13021302

13031303
unsigned NewDstIdx = TRI->composeSubRegIndices(CP.getSrcIdx(),
@@ -1384,7 +1384,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
13841384
}
13851385
}
13861386

1387-
if (Register::isVirtualRegister(DstReg)) {
1387+
if (DstReg.isVirtual()) {
13881388
unsigned NewIdx = NewMI.getOperand(0).getSubReg();
13891389

13901390
if (DefRC != nullptr) {
@@ -2481,7 +2481,7 @@ JoinVals::followCopyChain(const VNInfo *VNI) const {
24812481
if (!MI->isFullCopy())
24822482
return std::make_pair(VNI, TrackReg);
24832483
Register SrcReg = MI->getOperand(1).getReg();
2484-
if (!Register::isVirtualRegister(SrcReg))
2484+
if (!SrcReg.isVirtual())
24852485
return std::make_pair(VNI, TrackReg);
24862486

24872487
const LiveInterval &LI = LIS->getInterval(SrcReg);
@@ -3537,7 +3537,7 @@ void RegisterCoalescer::checkMergingChangesDbgValues(CoalescerPair &CP,
35373537

35383538
// Scan for potentially unsound DBG_VALUEs: examine first the register number
35393539
// Reg, and then any other vregs that may have been merged into it.
3540-
auto PerformScan = [this](Register Reg, std::function<void(unsigned)> Func) {
3540+
auto PerformScan = [this](Register Reg, std::function<void(Register)> Func) {
35413541
Func(Reg);
35423542
if (DbgMergedVRegNums.count(Reg))
35433543
for (Register X : DbgMergedVRegNums[Reg])
@@ -3675,7 +3675,7 @@ static bool isLocalCopy(MachineInstr *Copy, const LiveIntervals *LIS) {
36753675
}
36763676

36773677
void RegisterCoalescer::lateLiveIntervalUpdate() {
3678-
for (unsigned reg : ToBeUpdated) {
3678+
for (Register reg : ToBeUpdated) {
36793679
if (!LIS->hasInterval(reg))
36803680
continue;
36813681
LiveInterval &LI = LIS->getInterval(reg);
@@ -3728,11 +3728,11 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const {
37283728
if (!isMoveInstr(*TRI, &Copy, SrcReg, DstReg, SrcSubReg, DstSubReg))
37293729
return false;
37303730
// Check if the destination of this copy has any other affinity.
3731-
if (Register::isPhysicalRegister(DstReg) ||
3731+
if (DstReg.isPhysical() ||
37323732
// If SrcReg is a physical register, the copy won't be coalesced.
37333733
// Ignoring it may have other side effect (like missing
37343734
// rematerialization). So keep it.
3735-
Register::isPhysicalRegister(SrcReg) || !isTerminalReg(DstReg, Copy, MRI))
3735+
SrcReg.isPhysical() || !isTerminalReg(DstReg, Copy, MRI))
37363736
return false;
37373737

37383738
// DstReg is a terminal node. Check if it interferes with any other

0 commit comments

Comments
 (0)