Skip to content

Commit 3ac2c4a

Browse files
committed
Move isArtificialRegUnit to MCRegisterInfo
1 parent a84983c commit 3ac2c4a

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

llvm/include/llvm/CodeGen/MachineRegisterInfo.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -980,12 +980,6 @@ class MachineRegisterInfo {
980980
/// expected.
981981
bool isReservedRegUnit(unsigned Unit) const;
982982

983-
/// Returns true when the given register unit is considered artificial.
984-
///
985-
/// Register units are considered artificial when at least one of the
986-
/// root registers is artificial.
987-
bool isArtificialRegUnit(unsigned Unit) const;
988-
989983
/// isAllocatable - Returns true when PhysReg belongs to an allocatable
990984
/// register class and it hasn't been reserved.
991985
///

llvm/include/llvm/MC/MCRegisterInfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ class MCRegisterInfo {
404404
/// be modelled, such as the top 16-bits of a 32-bit GPR.
405405
bool isArtificial(MCRegister RegNo) const { return get(RegNo).IsArtificial; }
406406

407+
/// Returns true when the given register unit is considered artificial.
408+
/// Register units are considered artificial when at least one of the
409+
/// root registers is artificial.
410+
bool isArtificialRegUnit(MCRegUnit Unit) const;
411+
407412
/// Return the number of registers this target has (useful for
408413
/// sizing arrays holding per register information)
409414
unsigned getNumRegs() const {

llvm/lib/CodeGen/LiveIntervals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ void LiveIntervals::addKillFlags(const VirtRegMap *VRM) {
734734
for (MCRegUnitMaskIterator UI(PhysReg, TRI); UI.isValid(); ++UI) {
735735
auto [Unit, Bitmask] = *UI;
736736
// Record lane mask for all artificial RegUnits for this physreg.
737-
if (MRI->isArtificialRegUnit(Unit))
737+
if (TRI->isArtificialRegUnit(Unit))
738738
ArtificialLanes |= Bitmask;
739739
const LiveRange &RURange = getRegUnit(Unit);
740740
if (RURange.empty())

llvm/lib/CodeGen/MachineRegisterInfo.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,3 @@ bool MachineRegisterInfo::isReservedRegUnit(unsigned Unit) const {
659659
}
660660
return false;
661661
}
662-
663-
bool MachineRegisterInfo::isArtificialRegUnit(unsigned Unit) const {
664-
const TargetRegisterInfo *TRI = getTargetRegisterInfo();
665-
for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root)
666-
if (TRI->isArtificial(*Root))
667-
return true;
668-
return false;
669-
}

llvm/lib/MC/MCRegisterInfo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,10 @@ bool MCRegisterInfo::regsOverlap(MCRegister RegA, MCRegister RegB) const {
220220
} while (*IA < *IB ? ++IA != EA : ++IB != EB);
221221
return false;
222222
}
223+
224+
bool MCRegisterInfo::isArtificialRegUnit(unsigned Unit) const {
225+
for (MCRegUnitRootIterator Root(Unit, this); Root.isValid(); ++Root)
226+
if (isArtificial(*Root))
227+
return true;
228+
return false;
229+
}

0 commit comments

Comments
 (0)