Track reserved registers separately from RegsAvailable.

The bulk masking operations from register mask operands don't account
for reserved registers.

llvm-svn: 151222
This commit is contained in:
Jakob Stoklund Olesen 2012-02-23 01:13:32 +00:00
parent 93831264b3
commit e664abb837
2 changed files with 7 additions and 7 deletions

View File

@ -134,8 +134,9 @@ private:
/// isUsed / isUnused - Test if a register is currently being used.
///
bool isUsed(unsigned Reg) const { return !RegsAvailable.test(Reg); }
bool isUnused(unsigned Reg) const { return RegsAvailable.test(Reg); }
bool isUsed(unsigned Reg) const {
return !RegsAvailable.test(Reg) || ReservedRegs.test(Reg);
}
/// isAliasUsed - Is Reg or an alias currently in use?
bool isAliasUsed(unsigned Reg) const;

View File

@ -59,9 +59,6 @@ void RegScavenger::initRegState() {
// All registers started out unused.
RegsAvailable.set();
// Reserved registers are always used.
RegsAvailable ^= ReservedRegs;
if (!MBB)
return;
@ -225,9 +222,11 @@ void RegScavenger::forward() {
void RegScavenger::getRegsUsed(BitVector &used, bool includeReserved) {
used = RegsAvailable;
if (!includeReserved)
used |= ReservedRegs;
used.flip();
if (includeReserved)
used |= ReservedRegs;
else
used.reset(ReservedRegs);
}
unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RC) const {