@@ -431,7 +431,7 @@ MCRegister RAGreedy::tryAssign(const LiveInterval &VirtReg,
431
431
432
432
// We can also split the virtual register in cold blocks.
433
433
if (trySplitAroundHintReg (PhysHint, VirtReg, NewVRegs, Order))
434
- return 0 ;
434
+ return MCRegister () ;
435
435
436
436
// Record the missed hint, we may be able to recover
437
437
// at the end if the surrounding allocation changed.
@@ -1189,7 +1189,7 @@ unsigned RAGreedy::calculateRegionSplitCost(const LiveInterval &VirtReg,
1189
1189
return BestCand;
1190
1190
}
1191
1191
1192
- unsigned RAGreedy::doRegionSplit (const LiveInterval &VirtReg, unsigned BestCand,
1192
+ Register RAGreedy::doRegionSplit (const LiveInterval &VirtReg, unsigned BestCand,
1193
1193
bool HasCompact,
1194
1194
SmallVectorImpl<Register> &NewVRegs) {
1195
1195
SmallVector<unsigned , 8 > UsedCands;
@@ -1226,7 +1226,7 @@ unsigned RAGreedy::doRegionSplit(const LiveInterval &VirtReg, unsigned BestCand,
1226
1226
}
1227
1227
1228
1228
splitAroundRegion (LREdit, UsedCands);
1229
- return 0 ;
1229
+ return Register () ;
1230
1230
}
1231
1231
1232
1232
// VirtReg has a physical Hint, this function tries to split VirtReg around
@@ -1293,7 +1293,7 @@ bool RAGreedy::trySplitAroundHintReg(MCPhysReg Hint,
1293
1293
// / tryBlockSplit - Split a global live range around every block with uses. This
1294
1294
// / creates a lot of local live ranges, that will be split by tryLocalSplit if
1295
1295
// / they don't allocate.
1296
- unsigned RAGreedy::tryBlockSplit (const LiveInterval &VirtReg,
1296
+ Register RAGreedy::tryBlockSplit (const LiveInterval &VirtReg,
1297
1297
AllocationOrder &Order,
1298
1298
SmallVectorImpl<Register> &NewVRegs) {
1299
1299
assert (&SA->getParent () == &VirtReg && " Live range wasn't analyzed" );
@@ -1308,7 +1308,7 @@ unsigned RAGreedy::tryBlockSplit(const LiveInterval &VirtReg,
1308
1308
}
1309
1309
// No blocks were split.
1310
1310
if (LREdit.empty ())
1311
- return 0 ;
1311
+ return Register () ;
1312
1312
1313
1313
// We did split for some blocks.
1314
1314
SmallVector<unsigned , 8 > IntvMap;
@@ -1327,7 +1327,7 @@ unsigned RAGreedy::tryBlockSplit(const LiveInterval &VirtReg,
1327
1327
1328
1328
if (VerifyEnabled)
1329
1329
MF->verify (this , " After splitting live range around basic blocks" , &errs ());
1330
- return 0 ;
1330
+ return Register () ;
1331
1331
}
1332
1332
1333
1333
// ===----------------------------------------------------------------------===//
@@ -1414,7 +1414,7 @@ static bool readsLaneSubset(const MachineRegisterInfo &MRI,
1414
1414
// / be moved to a larger register class.
1415
1415
// /
1416
1416
// / This is similar to spilling to a larger register class.
1417
- unsigned RAGreedy::tryInstructionSplit (const LiveInterval &VirtReg,
1417
+ Register RAGreedy::tryInstructionSplit (const LiveInterval &VirtReg,
1418
1418
AllocationOrder &Order,
1419
1419
SmallVectorImpl<Register> &NewVRegs) {
1420
1420
const TargetRegisterClass *CurRC = MRI->getRegClass (VirtReg.reg ());
@@ -1469,15 +1469,15 @@ unsigned RAGreedy::tryInstructionSplit(const LiveInterval &VirtReg,
1469
1469
1470
1470
if (LREdit.empty ()) {
1471
1471
LLVM_DEBUG (dbgs () << " All uses were copies.\n " );
1472
- return 0 ;
1472
+ return Register () ;
1473
1473
}
1474
1474
1475
1475
SmallVector<unsigned , 8 > IntvMap;
1476
1476
SE->finish (&IntvMap);
1477
1477
DebugVars->splitRegister (VirtReg.reg (), LREdit.regs (), *LIS);
1478
1478
// Assign all new registers to RS_Spill. This was the last chance.
1479
1479
ExtraInfo->setStage (LREdit.begin (), LREdit.end (), RS_Spill);
1480
- return 0 ;
1480
+ return Register () ;
1481
1481
}
1482
1482
1483
1483
// ===----------------------------------------------------------------------===//
@@ -1567,13 +1567,13 @@ void RAGreedy::calcGapWeights(MCRegister PhysReg,
1567
1567
// / tryLocalSplit - Try to split VirtReg into smaller intervals inside its only
1568
1568
// / basic block.
1569
1569
// /
1570
- unsigned RAGreedy::tryLocalSplit (const LiveInterval &VirtReg,
1570
+ Register RAGreedy::tryLocalSplit (const LiveInterval &VirtReg,
1571
1571
AllocationOrder &Order,
1572
1572
SmallVectorImpl<Register> &NewVRegs) {
1573
1573
// TODO: the function currently only handles a single UseBlock; it should be
1574
1574
// possible to generalize.
1575
1575
if (SA->getUseBlocks ().size () != 1 )
1576
- return 0 ;
1576
+ return Register () ;
1577
1577
1578
1578
const SplitAnalysis::BlockInfo &BI = SA->getUseBlocks ().front ();
1579
1579
@@ -1754,7 +1754,7 @@ unsigned RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
1754
1754
1755
1755
// Didn't find any candidates?
1756
1756
if (BestBefore == NumGaps)
1757
- return 0 ;
1757
+ return Register () ;
1758
1758
1759
1759
LLVM_DEBUG (dbgs () << " Best local split range: " << Uses[BestBefore] << ' -'
1760
1760
<< Uses[BestAfter] << " , " << BestDiff << " , "
@@ -1788,7 +1788,7 @@ unsigned RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
1788
1788
}
1789
1789
++NumLocalSplits;
1790
1790
1791
- return 0 ;
1791
+ return Register () ;
1792
1792
}
1793
1793
1794
1794
// ===----------------------------------------------------------------------===//
@@ -1798,12 +1798,12 @@ unsigned RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
1798
1798
// / trySplit - Try to split VirtReg or one of its interferences, making it
1799
1799
// / assignable.
1800
1800
// / @return Physreg when VirtReg may be assigned and/or new NewVRegs.
1801
- unsigned RAGreedy::trySplit (const LiveInterval &VirtReg, AllocationOrder &Order,
1801
+ Register RAGreedy::trySplit (const LiveInterval &VirtReg, AllocationOrder &Order,
1802
1802
SmallVectorImpl<Register> &NewVRegs,
1803
1803
const SmallVirtRegSet &FixedRegisters) {
1804
1804
// Ranges must be Split2 or less.
1805
1805
if (ExtraInfo->getStage (VirtReg) >= RS_Spill)
1806
- return 0 ;
1806
+ return Register () ;
1807
1807
1808
1808
// Local intervals are handled separately.
1809
1809
if (LIS->intervalIsInOneMBB (VirtReg)) {
@@ -1839,7 +1839,7 @@ unsigned RAGreedy::trySplit(const LiveInterval &VirtReg, AllocationOrder &Order,
1839
1839
// ===----------------------------------------------------------------------===//
1840
1840
1841
1841
// / Return true if \p reg has any tied def operand.
1842
- static bool hasTiedDef (MachineRegisterInfo *MRI, unsigned reg) {
1842
+ static bool hasTiedDef (MachineRegisterInfo *MRI, Register reg) {
1843
1843
for (const MachineOperand &MO : MRI->def_operands (reg))
1844
1844
if (MO.isTied ())
1845
1845
return true ;
@@ -1954,7 +1954,7 @@ bool RAGreedy::mayRecolorAllInterferences(
1954
1954
// / \p Depth gives the current depth of the last chance recoloring.
1955
1955
// / \return a physical register that can be used for VirtReg or ~0u if none
1956
1956
// / exists.
1957
- unsigned RAGreedy::tryLastChanceRecoloring (const LiveInterval &VirtReg,
1957
+ Register RAGreedy::tryLastChanceRecoloring (const LiveInterval &VirtReg,
1958
1958
AllocationOrder &Order,
1959
1959
SmallVectorImpl<Register> &NewVRegs,
1960
1960
SmallVirtRegSet &FixedRegisters,
@@ -2058,7 +2058,7 @@ unsigned RAGreedy::tryLastChanceRecoloring(const LiveInterval &VirtReg,
2058
2058
LLVM_DEBUG (dbgs () << " tryRecoloringCandidates deleted a fixed register "
2059
2059
<< printReg (ThisVirtReg) << ' \n ' );
2060
2060
FixedRegisters.erase (ThisVirtReg);
2061
- return 0 ;
2061
+ return Register () ;
2062
2062
}
2063
2063
2064
2064
LLVM_DEBUG (dbgs () << " Fail to assign: " << VirtReg << " to "
@@ -2198,7 +2198,7 @@ MCRegister RAGreedy::tryAssignCSRFirstTime(
2198
2198
// We are going to spill, set CostPerUseLimit to 1 to make sure that
2199
2199
// we will not use a callee-saved register in tryEvict.
2200
2200
CostPerUseLimit = 1 ;
2201
- return 0 ;
2201
+ return MCRegister () ;
2202
2202
}
2203
2203
if (ExtraInfo->getStage (VirtReg) < RS_Split) {
2204
2204
// We choose pre-splitting over using the CSR for the first time if
@@ -2214,7 +2214,7 @@ MCRegister RAGreedy::tryAssignCSRFirstTime(
2214
2214
2215
2215
// Perform the actual pre-splitting.
2216
2216
doRegionSplit (VirtReg, BestCand, false /* HasCompact*/ , NewVRegs);
2217
- return 0 ;
2217
+ return MCRegister () ;
2218
2218
}
2219
2219
return PhysReg;
2220
2220
}
@@ -2299,7 +2299,7 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
2299
2299
// reusing PhysReg for the copy-related live-ranges. Indeed, we evicted
2300
2300
// some register and PhysReg may be available for the other live-ranges.
2301
2301
SmallSet<Register, 4 > Visited;
2302
- SmallVector<unsigned , 2 > RecoloringCandidates;
2302
+ SmallVector<Register , 2 > RecoloringCandidates;
2303
2303
HintsInfo Info;
2304
2304
Register Reg = VirtReg.reg ();
2305
2305
MCRegister PhysReg = VRM->getPhys (Reg);
@@ -2446,7 +2446,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
2446
2446
}
2447
2447
// Non empty NewVRegs means VirtReg has been split.
2448
2448
if (!NewVRegs.empty ())
2449
- return 0 ;
2449
+ return MCRegister () ;
2450
2450
2451
2451
LiveRangeStage Stage = ExtraInfo->getStage (VirtReg);
2452
2452
LLVM_DEBUG (dbgs () << StageName[Stage] << " Cascade "
@@ -2479,7 +2479,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
2479
2479
ExtraInfo->setStage (VirtReg, RS_Split);
2480
2480
LLVM_DEBUG (dbgs () << " wait for second round\n " );
2481
2481
NewVRegs.push_back (VirtReg.reg ());
2482
- return 0 ;
2482
+ return MCRegister () ;
2483
2483
}
2484
2484
2485
2485
if (Stage < RS_Spill && !VirtReg.empty ()) {
@@ -2529,7 +2529,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
2529
2529
2530
2530
// The live virtual register requesting allocation was spilled, so tell
2531
2531
// the caller not to allocate anything during this round.
2532
- return 0 ;
2532
+ return MCRegister () ;
2533
2533
}
2534
2534
2535
2535
void RAGreedy::RAGreedyStats::report (MachineOptimizationRemarkMissed &R) {
0 commit comments