Skip to content

Commit 5ef646d

Browse files
committed
AMDGPU: cast MCRegUnit now that it is a class enum
1 parent 20018c5 commit 5ef646d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

llvm/lib/Target/AMDGPU/AMDGPUHotBlockRegisterRenaming.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ bool AMDGPUHotBlockRegisterRenamingImpl::processBasicBlock(
256256
const TargetRegisterClass *VGPR_32_RC =
257257
TRI->getRegClass(AMDGPU::VGPR_32RegClassID);
258258
DenseMap<MCRegister, SmallVector<SlotIndex, 4>> PhysRegDefs;
259-
259+
260260
for (MachineInstr &MI : *MBB) {
261261
SlotIndex Idx = LIS->getInstructionIndex(MI);
262262
for (const MachineOperand &MO : MI.operands()) {
@@ -274,7 +274,7 @@ bool AMDGPUHotBlockRegisterRenamingImpl::processBasicBlock(
274274
}
275275

276276
LLVM_DEBUG({
277-
dbgs() << " Built PhysRegDefs cache: " << PhysRegDefs.size()
277+
dbgs() << " Built PhysRegDefs cache: " << PhysRegDefs.size()
278278
<< " registers have definitions in this BB\n";
279279
});
280280

@@ -348,7 +348,8 @@ void AMDGPUHotBlockRegisterRenamingImpl::calculateValueDensity(
348348

349349
// Access LiveIntervalUnion for this PhysReg
350350
for (MCRegUnit Unit : TRI->regunits(PhysReg)) {
351-
LiveIntervalUnion &LIU = LRM->getLiveUnions()[Unit];
351+
LiveIntervalUnion &LIU =
352+
LRM->getLiveUnions()[static_cast<unsigned>(Unit)];
352353

353354
for (LiveIntervalUnion::SegmentIter SI = LIU.begin(); SI.valid(); ++SI) {
354355
SlotIndex SegStart = SI.start();
@@ -389,7 +390,8 @@ void AMDGPUHotBlockRegisterRenamingImpl::findFreeRegisters(
389390

390391
// Check all register units
391392
for (MCRegUnit Unit : TRI->regunits(PhysReg)) {
392-
LiveIntervalUnion &LIU = LRM->getLiveUnions()[Unit];
393+
LiveIntervalUnion &LIU =
394+
LRM->getLiveUnions()[static_cast<unsigned>(Unit)];
393395

394396
// Check if anything is live in this BB
395397
LiveIntervalUnion::SegmentIter SI = LIU.find(BBStart);
@@ -419,18 +421,18 @@ bool AMDGPUHotBlockRegisterRenamingImpl::isVirtRegMovable(Register VirtReg,
419421
if (S.start >= BBStart && S.end <= BBEnd)
420422
SegmentCount++;
421423
}
422-
424+
423425
// Cannot move registers with multiple segments in BB (e.g., PHI nodes)
424426
if (SegmentCount != 1) {
425427
LLVM_DEBUG(dbgs() << " Cannot move " << printReg(VirtReg, TRI)
426428
<< ": has " << SegmentCount << " segments in BB\n");
427429
return false;
428430
}
429-
431+
430432
// Cannot move registers with multiple definitions (e.g., from PHI merge)
431433
if (VirtRegLI.getNumValNums() != 1) {
432434
LLVM_DEBUG(dbgs() << " Cannot move " << printReg(VirtReg, TRI)
433-
<< ": has " << VirtRegLI.getNumValNums()
435+
<< ": has " << VirtRegLI.getNumValNums()
434436
<< " value definitions\n");
435437
return false;
436438
}
@@ -457,7 +459,7 @@ bool AMDGPUHotBlockRegisterRenamingImpl::isVirtRegMovable(Register VirtReg,
457459
// Found a tied def - need to check the source operand it's tied to
458460
unsigned TiedIdx = DefMI->findTiedOperandIdx(OpIdx);
459461
const MachineOperand &TiedMO = DefMI->getOperand(TiedIdx);
460-
462+
461463
// If the tied source is a register, verify it won't conflict
462464
if (TiedMO.isReg()) {
463465
Register TiedReg = TiedMO.getReg();
@@ -475,7 +477,7 @@ bool AMDGPUHotBlockRegisterRenamingImpl::isVirtRegMovable(Register VirtReg,
475477
}
476478
}
477479
}
478-
480+
479481
LLVM_DEBUG(dbgs() << " Cannot move " << printReg(VirtReg, TRI)
480482
<< ": has tied def at " << S.start << " in "
481483
<< *DefMI);
@@ -498,7 +500,7 @@ bool AMDGPUHotBlockRegisterRenamingImpl::tryMoveValue(
498500
const DenseMap<MCRegister, SmallVector<SlotIndex, 4>> &PhysRegDefs) {
499501
// Find a movable local value in DenseReg
500502
for (MCRegUnit Unit : TRI->regunits(DenseReg)) {
501-
LiveIntervalUnion &LIU = LRM->getLiveUnions()[Unit];
503+
LiveIntervalUnion &LIU = LRM->getLiveUnions()[static_cast<unsigned>(Unit)];
502504

503505
for (LiveIntervalUnion::SegmentIter SI = LIU.begin(); SI.valid(); ++SI) {
504506
Register VirtReg = SI.value()->reg();

0 commit comments

Comments
 (0)