Add MCRegisterInfo::RegListIterator.

Also add subclasses MCSubRegIterator, MCSuperRegIterator, and
MCRegAliasIterator.

These iterators provide an abstract interface to the MCRegisterInfo
register lists so the internal representation can be changed without
changing all clients.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2012-05-30 16:36:28 +00:00
parent 1afbd278d1
commit cd00ef033c
2 changed files with 58 additions and 6 deletions

View File

@@ -357,10 +357,10 @@ public:
/// isSuperRegister - Returns true if regB is a super-register of regA.
///
bool isSuperRegister(unsigned regA, unsigned regB) const {
for (const uint16_t *regList = getSuperRegisters(regA); *regList;++regList){
if (*regList == regB) return true;
}
bool isSuperRegister(unsigned RegA, unsigned RegB) const {
for (MCSuperRegIterator I(RegA, this); I.isValid(); ++I)
if (*I == RegB)
return true;
return false;
}