Add TargetRegisterInfo::hasRegUnit().

This trivial helper function tests if a register contains a register
unit. It is similar to regsOverlap(), but with asymmetric arguments.

llvm-svn: 161180
This commit is contained in:
Jakob Stoklund Olesen 2012-08-02 14:45:53 +00:00
parent 528a4fa860
commit 232ae7cc20

View File

@ -349,6 +349,14 @@ public:
return false;
}
/// hasRegUnit - Returns true if Reg contains RegUnit.
bool hasRegUnit(unsigned Reg, unsigned RegUnit) const {
for (MCRegUnitIterator Units(Reg, this); Units.isValid(); ++Units)
if (*Units == RegUnit)
return true;
return false;
}
/// isSubRegister - Returns true if regB is a sub-register of regA.
///
bool isSubRegister(unsigned regA, unsigned regB) const {