@@ -431,7 +431,7 @@ MCRegister RAGreedy::tryAssign(const LiveInterval &VirtReg,
431431
432432 // We can also split the virtual register in cold blocks.
433433 if (trySplitAroundHintReg (PhysHint, VirtReg, NewVRegs, Order))
434- return 0 ;
434+ return MCRegister () ;
435435
436436 // Record the missed hint, we may be able to recover
437437 // at the end if the surrounding allocation changed.
@@ -1189,7 +1189,7 @@ unsigned RAGreedy::calculateRegionSplitCost(const LiveInterval &VirtReg,
11891189 return BestCand;
11901190}
11911191
1192- unsigned RAGreedy::doRegionSplit (const LiveInterval &VirtReg, unsigned BestCand,
1192+ Register RAGreedy::doRegionSplit (const LiveInterval &VirtReg, unsigned BestCand,
11931193 bool HasCompact,
11941194 SmallVectorImpl<Register> &NewVRegs) {
11951195 SmallVector<unsigned , 8 > UsedCands;
@@ -1226,7 +1226,7 @@ unsigned RAGreedy::doRegionSplit(const LiveInterval &VirtReg, unsigned BestCand,
12261226 }
12271227
12281228 splitAroundRegion (LREdit, UsedCands);
1229- return 0 ;
1229+ return Register () ;
12301230}
12311231
12321232// VirtReg has a physical Hint, this function tries to split VirtReg around
@@ -1293,7 +1293,7 @@ bool RAGreedy::trySplitAroundHintReg(MCPhysReg Hint,
12931293// / tryBlockSplit - Split a global live range around every block with uses. This
12941294// / creates a lot of local live ranges, that will be split by tryLocalSplit if
12951295// / they don't allocate.
1296- unsigned RAGreedy::tryBlockSplit (const LiveInterval &VirtReg,
1296+ Register RAGreedy::tryBlockSplit (const LiveInterval &VirtReg,
12971297 AllocationOrder &Order,
12981298 SmallVectorImpl<Register> &NewVRegs) {
12991299 assert (&SA->getParent () == &VirtReg && " Live range wasn't analyzed" );
@@ -1308,7 +1308,7 @@ unsigned RAGreedy::tryBlockSplit(const LiveInterval &VirtReg,
13081308 }
13091309 // No blocks were split.
13101310 if (LREdit.empty ())
1311- return 0 ;
1311+ return Register () ;
13121312
13131313 // We did split for some blocks.
13141314 SmallVector<unsigned , 8 > IntvMap;
@@ -1327,7 +1327,7 @@ unsigned RAGreedy::tryBlockSplit(const LiveInterval &VirtReg,
13271327
13281328 if (VerifyEnabled)
13291329 MF->verify (this , " After splitting live range around basic blocks" , &errs ());
1330- return 0 ;
1330+ return Register () ;
13311331}
13321332
13331333// ===----------------------------------------------------------------------===//
@@ -1414,7 +1414,7 @@ static bool readsLaneSubset(const MachineRegisterInfo &MRI,
14141414// / be moved to a larger register class.
14151415// /
14161416// / This is similar to spilling to a larger register class.
1417- unsigned RAGreedy::tryInstructionSplit (const LiveInterval &VirtReg,
1417+ Register RAGreedy::tryInstructionSplit (const LiveInterval &VirtReg,
14181418 AllocationOrder &Order,
14191419 SmallVectorImpl<Register> &NewVRegs) {
14201420 const TargetRegisterClass *CurRC = MRI->getRegClass (VirtReg.reg ());
@@ -1469,15 +1469,15 @@ unsigned RAGreedy::tryInstructionSplit(const LiveInterval &VirtReg,
14691469
14701470 if (LREdit.empty ()) {
14711471 LLVM_DEBUG (dbgs () << " All uses were copies.\n " );
1472- return 0 ;
1472+ return Register () ;
14731473 }
14741474
14751475 SmallVector<unsigned , 8 > IntvMap;
14761476 SE->finish (&IntvMap);
14771477 DebugVars->splitRegister (VirtReg.reg (), LREdit.regs (), *LIS);
14781478 // Assign all new registers to RS_Spill. This was the last chance.
14791479 ExtraInfo->setStage (LREdit.begin (), LREdit.end (), RS_Spill);
1480- return 0 ;
1480+ return Register () ;
14811481}
14821482
14831483// ===----------------------------------------------------------------------===//
@@ -1567,13 +1567,13 @@ void RAGreedy::calcGapWeights(MCRegister PhysReg,
15671567// / tryLocalSplit - Try to split VirtReg into smaller intervals inside its only
15681568// / basic block.
15691569// /
1570- unsigned RAGreedy::tryLocalSplit (const LiveInterval &VirtReg,
1570+ Register RAGreedy::tryLocalSplit (const LiveInterval &VirtReg,
15711571 AllocationOrder &Order,
15721572 SmallVectorImpl<Register> &NewVRegs) {
15731573 // TODO: the function currently only handles a single UseBlock; it should be
15741574 // possible to generalize.
15751575 if (SA->getUseBlocks ().size () != 1 )
1576- return 0 ;
1576+ return Register () ;
15771577
15781578 const SplitAnalysis::BlockInfo &BI = SA->getUseBlocks ().front ();
15791579
@@ -1754,7 +1754,7 @@ unsigned RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
17541754
17551755 // Didn't find any candidates?
17561756 if (BestBefore == NumGaps)
1757- return 0 ;
1757+ return Register () ;
17581758
17591759 LLVM_DEBUG (dbgs () << " Best local split range: " << Uses[BestBefore] << ' -'
17601760 << Uses[BestAfter] << " , " << BestDiff << " , "
@@ -1788,7 +1788,7 @@ unsigned RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
17881788 }
17891789 ++NumLocalSplits;
17901790
1791- return 0 ;
1791+ return Register () ;
17921792}
17931793
17941794// ===----------------------------------------------------------------------===//
@@ -1798,12 +1798,12 @@ unsigned RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
17981798// / trySplit - Try to split VirtReg or one of its interferences, making it
17991799// / assignable.
18001800// / @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,
18021802 SmallVectorImpl<Register> &NewVRegs,
18031803 const SmallVirtRegSet &FixedRegisters) {
18041804 // Ranges must be Split2 or less.
18051805 if (ExtraInfo->getStage (VirtReg) >= RS_Spill)
1806- return 0 ;
1806+ return Register () ;
18071807
18081808 // Local intervals are handled separately.
18091809 if (LIS->intervalIsInOneMBB (VirtReg)) {
@@ -1839,7 +1839,7 @@ unsigned RAGreedy::trySplit(const LiveInterval &VirtReg, AllocationOrder &Order,
18391839// ===----------------------------------------------------------------------===//
18401840
18411841// / 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) {
18431843 for (const MachineOperand &MO : MRI->def_operands (reg))
18441844 if (MO.isTied ())
18451845 return true ;
@@ -1954,7 +1954,7 @@ bool RAGreedy::mayRecolorAllInterferences(
19541954// / \p Depth gives the current depth of the last chance recoloring.
19551955// / \return a physical register that can be used for VirtReg or ~0u if none
19561956// / exists.
1957- unsigned RAGreedy::tryLastChanceRecoloring (const LiveInterval &VirtReg,
1957+ Register RAGreedy::tryLastChanceRecoloring (const LiveInterval &VirtReg,
19581958 AllocationOrder &Order,
19591959 SmallVectorImpl<Register> &NewVRegs,
19601960 SmallVirtRegSet &FixedRegisters,
@@ -2058,7 +2058,7 @@ unsigned RAGreedy::tryLastChanceRecoloring(const LiveInterval &VirtReg,
20582058 LLVM_DEBUG (dbgs () << " tryRecoloringCandidates deleted a fixed register "
20592059 << printReg (ThisVirtReg) << ' \n ' );
20602060 FixedRegisters.erase (ThisVirtReg);
2061- return 0 ;
2061+ return Register () ;
20622062 }
20632063
20642064 LLVM_DEBUG (dbgs () << " Fail to assign: " << VirtReg << " to "
@@ -2198,7 +2198,7 @@ MCRegister RAGreedy::tryAssignCSRFirstTime(
21982198 // We are going to spill, set CostPerUseLimit to 1 to make sure that
21992199 // we will not use a callee-saved register in tryEvict.
22002200 CostPerUseLimit = 1 ;
2201- return 0 ;
2201+ return MCRegister () ;
22022202 }
22032203 if (ExtraInfo->getStage (VirtReg) < RS_Split) {
22042204 // We choose pre-splitting over using the CSR for the first time if
@@ -2214,7 +2214,7 @@ MCRegister RAGreedy::tryAssignCSRFirstTime(
22142214
22152215 // Perform the actual pre-splitting.
22162216 doRegionSplit (VirtReg, BestCand, false /* HasCompact*/ , NewVRegs);
2217- return 0 ;
2217+ return MCRegister () ;
22182218 }
22192219 return PhysReg;
22202220}
@@ -2299,7 +2299,7 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
22992299 // reusing PhysReg for the copy-related live-ranges. Indeed, we evicted
23002300 // some register and PhysReg may be available for the other live-ranges.
23012301 SmallSet<Register, 4 > Visited;
2302- SmallVector<unsigned , 2 > RecoloringCandidates;
2302+ SmallVector<Register , 2 > RecoloringCandidates;
23032303 HintsInfo Info;
23042304 Register Reg = VirtReg.reg ();
23052305 MCRegister PhysReg = VRM->getPhys (Reg);
@@ -2446,7 +2446,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
24462446 }
24472447 // Non empty NewVRegs means VirtReg has been split.
24482448 if (!NewVRegs.empty ())
2449- return 0 ;
2449+ return MCRegister () ;
24502450
24512451 LiveRangeStage Stage = ExtraInfo->getStage (VirtReg);
24522452 LLVM_DEBUG (dbgs () << StageName[Stage] << " Cascade "
@@ -2479,7 +2479,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
24792479 ExtraInfo->setStage (VirtReg, RS_Split);
24802480 LLVM_DEBUG (dbgs () << " wait for second round\n " );
24812481 NewVRegs.push_back (VirtReg.reg ());
2482- return 0 ;
2482+ return MCRegister () ;
24832483 }
24842484
24852485 if (Stage < RS_Spill && !VirtReg.empty ()) {
@@ -2529,7 +2529,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
25292529
25302530 // The live virtual register requesting allocation was spilled, so tell
25312531 // the caller not to allocate anything during this round.
2532- return 0 ;
2532+ return MCRegister () ;
25332533}
25342534
25352535void RAGreedy::RAGreedyStats::report (MachineOptimizationRemarkMissed &R) {
0 commit comments