/// available, unset means the register is currently being used.
BitVector RegsAvailable;
+ // These BitVectors are only used internally to forward(). They are members
+ // to avoid frequent reallocations.
+ BitVector KillRegs, DefRegs;
+
public:
RegScavenger()
: MBB(NULL), NumPhysRegs(0), Tracking(false),
/// 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;
/// setUsed / setUnused - Mark the state of one or a number of registers.
///
void setUsed(BitVector &Regs) {
- RegsAvailable &= ~Regs;
+ RegsAvailable.reset(Regs);
}
void setUnused(BitVector &Regs) {
RegsAvailable |= Regs;
/// Add Reg and all its sub-registers to BV.
void addRegWithSubRegs(BitVector &BV, unsigned Reg);
- /// Add Reg and its aliases to BV.
- void addRegWithAliases(BitVector &BV, unsigned Reg);
-
/// findSurvivorReg - Return the candidate register that is unused for the
/// longest after StartMI. UseMI is set to the instruction where the search
/// stopped.