Add TargetRegisterInfo::hasRegUnit().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-08-02 14:45:53 +00:00
parent 5258d9f967
commit 28897ca434

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 {