Move getSubRegisterRegClass from ScheduleDagSDNodesEmit.cpp to a TargetRegisterClass method.

Also make the method non-asserting. It will return NULL when given an invalid subreg index.

The method is needed by an upcoming patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70296 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2009-04-28 16:34:09 +00:00
parent 30590f5023
commit fa4677b483
2 changed files with 13 additions and 14 deletions

View File

@@ -148,6 +148,16 @@ public:
return I;
}
/// getSubRegisterRegClass - Return the register class of subregisters with
/// index SubIdx, or NULL if no such class exists.
const TargetRegisterClass* getSubRegisterRegClass(unsigned SubIdx) const {
assert(SubIdx>0 && "Invalid subregister index");
for (unsigned s = 0; s != SubIdx-1; ++s)
if (!SubRegClasses[s])
return NULL;
return SubRegClasses[SubIdx-1];
}
/// superregclasses_begin / superregclasses_end - Loop over all of
/// the superreg register classes of this register class.
sc_iterator superregclasses_begin() const {