Get rid of RegScavenger::backwards() before the bitrot spreads.

If we need it one day, there is nothing wrong with putting it back in.

llvm-svn: 78337
This commit is contained in:
Jakob Stoklund Olesen 2009-08-06 21:19:03 +00:00
parent 86c0c7abf1
commit 83399fc5d2
2 changed files with 3 additions and 72 deletions

View File

@ -90,20 +90,15 @@ public:
/// passes over/within the same function.
void initRegState();
/// forward / backward - Move the internal MBB iterator and update register
/// states.
/// forward - Move the internal MBB iterator and update register states.
void forward();
void backward();
/// forward / backward - Move the internal MBB iterator and update register
/// states until it has processed the specific iterator.
/// forward - Move the internal MBB iterator and update register states until
/// it has processed the specific iterator.
void forward(MachineBasicBlock::iterator I) {
if (!Tracking && MBB->begin() != I) forward();
while (MBBI != I) forward();
}
void backward(MachineBasicBlock::iterator I) {
while (MBBI != I) backward();
}
/// skipTo - Move the internal MBB iterator but do not update register states.
///

View File

@ -294,70 +294,6 @@ void RegScavenger::forward() {
}
}
void RegScavenger::backward() {
assert(Tracking && "Not tracking states!");
assert(MBBI != MBB->begin() && "Already at start of basic block!");
// Move ptr backward.
MBBI = prior(MBBI);
MachineInstr *MI = MBBI;
DistanceMap.erase(MI);
--CurrDist;
// Separate register operands into 3 classes: uses, defs, earlyclobbers.
SmallVector<std::pair<const MachineOperand*,unsigned>, 4> UseMOs;
SmallVector<std::pair<const MachineOperand*,unsigned>, 4> DefMOs;
SmallVector<std::pair<const MachineOperand*,unsigned>, 4> EarlyClobberMOs;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
const MachineOperand &MO = MI->getOperand(i);
if (!MO.isReg() || MO.getReg() == 0 || MO.isUndef())
continue;
if (MO.isUse())
UseMOs.push_back(std::make_pair(&MO,i));
else if (MO.isEarlyClobber())
EarlyClobberMOs.push_back(std::make_pair(&MO,i));
else
DefMOs.push_back(std::make_pair(&MO,i));
}
// Process defs first.
unsigned NumECs = EarlyClobberMOs.size();
unsigned NumDefs = DefMOs.size();
for (unsigned i = 0, e = NumECs + NumDefs; i != e; ++i) {
const MachineOperand &MO = (i < NumDefs)
? *DefMOs[i].first : *EarlyClobberMOs[i-NumDefs].first;
unsigned Idx = (i < NumECs)
? DefMOs[i].second : EarlyClobberMOs[i-NumDefs].second;
if (MO.isUndef())
continue;
// Skip two-address destination operand.
if (MI->isRegTiedToUseOperand(Idx))
continue;
unsigned Reg = MO.getReg();
assert(isUsed(Reg));
if (!isReserved(Reg))
setUnused(Reg, MI);
}
// Process uses.
BitVector UseRegs(NumPhysRegs);
for (unsigned i = 0, e = UseMOs.size(); i != e; ++i) {
const MachineOperand MO = *UseMOs[i].first;
unsigned Reg = MO.getReg();
assert(isUnused(Reg) || isReserved(Reg));
UseRegs.set(Reg);
// Set the sub-registers as "used".
for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
unsigned SubReg = *SubRegs; ++SubRegs)
UseRegs.set(SubReg);
}
setUsed(UseRegs);
}
void RegScavenger::getRegsUsed(BitVector &used, bool includeReserved) {
if (includeReserved)
used = ~RegsAvailable;