Skip to content

Commit 388ef61

Browse files
authored
[RegAllocGreedy] Use MCRegister instead of MCPhysReg. NFC (llvm#167974)
1 parent e6b9805 commit 388ef61

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

llvm/lib/CodeGen/RegAllocGreedy.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,12 +1225,11 @@ MCRegister RAGreedy::tryRegionSplit(const LiveInterval &VirtReg,
12251225
return doRegionSplit(VirtReg, BestCand, HasCompact, NewVRegs);
12261226
}
12271227

1228-
unsigned
1229-
RAGreedy::calculateRegionSplitCostAroundReg(MCPhysReg PhysReg,
1230-
AllocationOrder &Order,
1231-
BlockFrequency &BestCost,
1232-
unsigned &NumCands,
1233-
unsigned &BestCand) {
1228+
unsigned RAGreedy::calculateRegionSplitCostAroundReg(MCRegister PhysReg,
1229+
AllocationOrder &Order,
1230+
BlockFrequency &BestCost,
1231+
unsigned &NumCands,
1232+
unsigned &BestCand) {
12341233
// Discard bad candidates before we run out of interference cache cursors.
12351234
// This will only affect register classes with a lot of registers (>32).
12361235
if (NumCands == IntfCache.getMaxCursors()) {
@@ -1309,7 +1308,7 @@ unsigned RAGreedy::calculateRegionSplitCost(const LiveInterval &VirtReg,
13091308
unsigned &NumCands,
13101309
bool IgnoreCSR) {
13111310
unsigned BestCand = NoCand;
1312-
for (MCPhysReg PhysReg : Order) {
1311+
for (MCRegister PhysReg : Order) {
13131312
assert(PhysReg);
13141313
if (IgnoreCSR && EvictAdvisor->isUnusedCalleeSavedReg(PhysReg))
13151314
continue;
@@ -1363,7 +1362,7 @@ MCRegister RAGreedy::doRegionSplit(const LiveInterval &VirtReg,
13631362

13641363
// VirtReg has a physical Hint, this function tries to split VirtReg around
13651364
// Hint if we can place new COPY instructions in cold blocks.
1366-
bool RAGreedy::trySplitAroundHintReg(MCPhysReg Hint,
1365+
bool RAGreedy::trySplitAroundHintReg(MCRegister Hint,
13671366
const LiveInterval &VirtReg,
13681367
SmallVectorImpl<Register> &NewVRegs,
13691368
AllocationOrder &Order) {
@@ -1427,8 +1426,7 @@ bool RAGreedy::trySplitAroundHintReg(MCPhysReg Hint,
14271426

14281427
MCRegister OtherPhysReg =
14291428
OtherReg.isPhysical() ? OtherReg.asMCReg() : VRM->getPhys(OtherReg);
1430-
MCRegister ThisHint =
1431-
SubReg ? TRI->getSubReg(Hint, SubReg) : MCRegister(Hint);
1429+
MCRegister ThisHint = SubReg ? TRI->getSubReg(Hint, SubReg) : Hint;
14321430
if (OtherPhysReg == ThisHint)
14331431
Cost += MBFI->getBlockFreq(Instr.getParent());
14341432
}
@@ -1822,7 +1820,7 @@ MCRegister RAGreedy::tryLocalSplit(const LiveInterval &VirtReg,
18221820
(1.0f / MBFI->getEntryFreq().getFrequency());
18231821
SmallVector<float, 8> GapWeight;
18241822

1825-
for (MCPhysReg PhysReg : Order) {
1823+
for (MCRegister PhysReg : Order) {
18261824
assert(PhysReg);
18271825
// Keep track of the largest spill weight that would need to be evicted in
18281826
// order to make use of PhysReg between UseSlots[I] and UseSlots[I + 1].

llvm/lib/CodeGen/RegAllocGreedy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class LLVM_LIBRARY_VISIBILITY RAGreedy : public RegAllocBase,
336336
MCRegister tryRegionSplit(const LiveInterval &, AllocationOrder &,
337337
SmallVectorImpl<Register> &);
338338
/// Calculate cost of region splitting around the specified register.
339-
unsigned calculateRegionSplitCostAroundReg(MCPhysReg PhysReg,
339+
unsigned calculateRegionSplitCostAroundReg(MCRegister PhysReg,
340340
AllocationOrder &Order,
341341
BlockFrequency &BestCost,
342342
unsigned &NumCands,
@@ -351,7 +351,7 @@ class LLVM_LIBRARY_VISIBILITY RAGreedy : public RegAllocBase,
351351
bool HasCompact,
352352
SmallVectorImpl<Register> &NewVRegs);
353353
/// Try to split VirtReg around physical Hint register.
354-
bool trySplitAroundHintReg(MCPhysReg Hint, const LiveInterval &VirtReg,
354+
bool trySplitAroundHintReg(MCRegister Hint, const LiveInterval &VirtReg,
355355
SmallVectorImpl<Register> &NewVRegs,
356356
AllocationOrder &Order);
357357
/// Check other options before using a callee-saved register for the first

0 commit comments

Comments
 (0)