@@ -1189,9 +1189,9 @@ unsigned RAGreedy::calculateRegionSplitCost(const LiveInterval &VirtReg,
1189
1189
return BestCand;
1190
1190
}
1191
1191
1192
- Register RAGreedy::doRegionSplit (const LiveInterval &VirtReg, unsigned BestCand ,
1193
- bool HasCompact,
1194
- SmallVectorImpl<Register> &NewVRegs) {
1192
+ MCRegister RAGreedy::doRegionSplit (const LiveInterval &VirtReg,
1193
+ unsigned BestCand, bool HasCompact,
1194
+ SmallVectorImpl<Register> &NewVRegs) {
1195
1195
SmallVector<unsigned , 8 > UsedCands;
1196
1196
// Prepare split editor.
1197
1197
LiveRangeEdit LREdit (&VirtReg, NewVRegs, *MF, *LIS, VRM, this , &DeadRemats);
@@ -1226,7 +1226,7 @@ Register RAGreedy::doRegionSplit(const LiveInterval &VirtReg, unsigned BestCand,
1226
1226
}
1227
1227
1228
1228
splitAroundRegion (LREdit, UsedCands);
1229
- return Register ();
1229
+ return MCRegister ();
1230
1230
}
1231
1231
1232
1232
// VirtReg has a physical Hint, this function tries to split VirtReg around
@@ -1293,9 +1293,9 @@ 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
- Register RAGreedy::tryBlockSplit (const LiveInterval &VirtReg,
1297
- AllocationOrder &Order,
1298
- SmallVectorImpl<Register> &NewVRegs) {
1296
+ MCRegister RAGreedy::tryBlockSplit (const LiveInterval &VirtReg,
1297
+ AllocationOrder &Order,
1298
+ SmallVectorImpl<Register> &NewVRegs) {
1299
1299
assert (&SA->getParent () == &VirtReg && " Live range wasn't analyzed" );
1300
1300
Register Reg = VirtReg.reg ();
1301
1301
bool SingleInstrs = RegClassInfo.isProperSubClass (MRI->getRegClass (Reg));
@@ -1308,7 +1308,7 @@ Register RAGreedy::tryBlockSplit(const LiveInterval &VirtReg,
1308
1308
}
1309
1309
// No blocks were split.
1310
1310
if (LREdit.empty ())
1311
- return Register ();
1311
+ return MCRegister ();
1312
1312
1313
1313
// We did split for some blocks.
1314
1314
SmallVector<unsigned , 8 > IntvMap;
@@ -1327,7 +1327,7 @@ Register 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 Register ();
1330
+ return MCRegister ();
1331
1331
}
1332
1332
1333
1333
// ===----------------------------------------------------------------------===//
@@ -1414,16 +1414,16 @@ 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
- Register RAGreedy::tryInstructionSplit (const LiveInterval &VirtReg,
1418
- AllocationOrder &Order,
1419
- SmallVectorImpl<Register> &NewVRegs) {
1417
+ MCRegister RAGreedy::tryInstructionSplit (const LiveInterval &VirtReg,
1418
+ AllocationOrder &Order,
1419
+ SmallVectorImpl<Register> &NewVRegs) {
1420
1420
const TargetRegisterClass *CurRC = MRI->getRegClass (VirtReg.reg ());
1421
1421
// There is no point to this if there are no larger sub-classes.
1422
1422
1423
1423
bool SplitSubClass = true ;
1424
1424
if (!RegClassInfo.isProperSubClass (CurRC)) {
1425
1425
if (!VirtReg.hasSubRanges ())
1426
- return Register ();
1426
+ return MCRegister ();
1427
1427
SplitSubClass = false ;
1428
1428
}
1429
1429
@@ -1434,7 +1434,7 @@ Register RAGreedy::tryInstructionSplit(const LiveInterval &VirtReg,
1434
1434
1435
1435
ArrayRef<SlotIndex> Uses = SA->getUseSlots ();
1436
1436
if (Uses.size () <= 1 )
1437
- return Register ();
1437
+ return MCRegister ();
1438
1438
1439
1439
LLVM_DEBUG (dbgs () << " Split around " << Uses.size ()
1440
1440
<< " individual instrs.\n " );
@@ -1469,15 +1469,15 @@ Register RAGreedy::tryInstructionSplit(const LiveInterval &VirtReg,
1469
1469
1470
1470
if (LREdit.empty ()) {
1471
1471
LLVM_DEBUG (dbgs () << " All uses were copies.\n " );
1472
- return Register ();
1472
+ return MCRegister ();
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 Register ();
1480
+ return MCRegister ();
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
- Register RAGreedy::tryLocalSplit (const LiveInterval &VirtReg,
1571
- AllocationOrder &Order,
1572
- SmallVectorImpl<Register> &NewVRegs) {
1570
+ MCRegister RAGreedy::tryLocalSplit (const LiveInterval &VirtReg,
1571
+ AllocationOrder &Order,
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 Register ();
1576
+ return MCRegister ();
1577
1577
1578
1578
const SplitAnalysis::BlockInfo &BI = SA->getUseBlocks ().front ();
1579
1579
@@ -1586,7 +1586,7 @@ Register RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
1586
1586
1587
1587
ArrayRef<SlotIndex> Uses = SA->getUseSlots ();
1588
1588
if (Uses.size () <= 2 )
1589
- return Register ();
1589
+ return MCRegister ();
1590
1590
const unsigned NumGaps = Uses.size ()-1 ;
1591
1591
1592
1592
LLVM_DEBUG ({
@@ -1754,7 +1754,7 @@ Register RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
1754
1754
1755
1755
// Didn't find any candidates?
1756
1756
if (BestBefore == NumGaps)
1757
- return Register ();
1757
+ return MCRegister ();
1758
1758
1759
1759
LLVM_DEBUG (dbgs () << " Best local split range: " << Uses[BestBefore] << ' -'
1760
1760
<< Uses[BestAfter] << " , " << BestDiff << " , "
@@ -1788,7 +1788,7 @@ Register RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
1788
1788
}
1789
1789
++NumLocalSplits;
1790
1790
1791
- return Register ();
1791
+ return MCRegister ();
1792
1792
}
1793
1793
1794
1794
// ===----------------------------------------------------------------------===//
@@ -1798,19 +1798,20 @@ Register 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
- Register RAGreedy::trySplit (const LiveInterval &VirtReg, AllocationOrder &Order,
1802
- SmallVectorImpl<Register> &NewVRegs,
1803
- const SmallVirtRegSet &FixedRegisters) {
1801
+ MCRegister RAGreedy::trySplit (const LiveInterval &VirtReg,
1802
+ AllocationOrder &Order,
1803
+ SmallVectorImpl<Register> &NewVRegs,
1804
+ const SmallVirtRegSet &FixedRegisters) {
1804
1805
// Ranges must be Split2 or less.
1805
1806
if (ExtraInfo->getStage (VirtReg) >= RS_Spill)
1806
- return Register ();
1807
+ return MCRegister ();
1807
1808
1808
1809
// Local intervals are handled separately.
1809
1810
if (LIS->intervalIsInOneMBB (VirtReg)) {
1810
1811
NamedRegionTimer T (" local_split" , " Local Splitting" , TimerGroupName,
1811
1812
TimerGroupDescription, TimePassesIsEnabled);
1812
1813
SA->analyze (&VirtReg);
1813
- Register PhysReg = tryLocalSplit (VirtReg, Order, NewVRegs);
1814
+ MCRegister PhysReg = tryLocalSplit (VirtReg, Order, NewVRegs);
1814
1815
if (PhysReg || !NewVRegs.empty ())
1815
1816
return PhysReg;
1816
1817
return tryInstructionSplit (VirtReg, Order, NewVRegs);
@@ -1954,12 +1955,10 @@ bool RAGreedy::mayRecolorAllInterferences(
1954
1955
// / \p Depth gives the current depth of the last chance recoloring.
1955
1956
// / \return a physical register that can be used for VirtReg or ~0u if none
1956
1957
// / exists.
1957
- Register RAGreedy::tryLastChanceRecoloring (const LiveInterval &VirtReg,
1958
- AllocationOrder &Order,
1959
- SmallVectorImpl<Register> &NewVRegs,
1960
- SmallVirtRegSet &FixedRegisters,
1961
- RecoloringStack &RecolorStack,
1962
- unsigned Depth) {
1958
+ MCRegister RAGreedy::tryLastChanceRecoloring (
1959
+ const LiveInterval &VirtReg, AllocationOrder &Order,
1960
+ SmallVectorImpl<Register> &NewVRegs, SmallVirtRegSet &FixedRegisters,
1961
+ RecoloringStack &RecolorStack, unsigned Depth) {
1963
1962
if (!TRI->shouldUseLastChanceRecoloringForVirtReg (*MF, VirtReg))
1964
1963
return ~0u ;
1965
1964
@@ -2058,7 +2057,7 @@ Register RAGreedy::tryLastChanceRecoloring(const LiveInterval &VirtReg,
2058
2057
LLVM_DEBUG (dbgs () << " tryRecoloringCandidates deleted a fixed register "
2059
2058
<< printReg (ThisVirtReg) << ' \n ' );
2060
2059
FixedRegisters.erase (ThisVirtReg);
2061
- return Register ();
2060
+ return MCRegister ();
2062
2061
}
2063
2062
2064
2063
LLVM_DEBUG (dbgs () << " Fail to assign: " << VirtReg << " to "
@@ -2485,7 +2484,7 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
2485
2484
if (Stage < RS_Spill && !VirtReg.empty ()) {
2486
2485
// Try splitting VirtReg or interferences.
2487
2486
unsigned NewVRegSizeBefore = NewVRegs.size ();
2488
- Register PhysReg = trySplit (VirtReg, Order, NewVRegs, FixedRegisters);
2487
+ MCRegister PhysReg = trySplit (VirtReg, Order, NewVRegs, FixedRegisters);
2489
2488
if (PhysReg || (NewVRegs.size () - NewVRegSizeBefore))
2490
2489
return PhysReg;
2491
2490
}
0 commit comments