We don't need to scan the blocks that we are live-in on every

access. Rather we only have to do it on the creation of the interval.

llvm-svn: 11135
This commit is contained in:
Alkis Evlogimenos 2004-02-05 20:45:40 +00:00
parent 03564f5bae
commit 3dd0f57349

View File

@ -162,23 +162,24 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb,
// update interval index for this register
r2iMap_.insert(r2iit, std::make_pair(reg, --intervals_.end()));
interval = &intervals_.back();
// iterate over all of the blocks that the variable is
// completely live in, adding them to the live
// interval. obviously we only need to do this once.
for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
if (vi.AliveBlocks[i]) {
MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i);
if (!mbb->empty()) {
interval->addRange(getInstructionIndex(mbb->front()),
getInstructionIndex(mbb->back()) + 1);
}
}
}
}
else {
interval = &*r2iit->second;
}
// iterate over all of the blocks that the variable is completely
// live in, adding them to the live interval
for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
if (vi.AliveBlocks[i]) {
MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i);
if (!mbb->empty()) {
interval->addRange(getInstructionIndex(mbb->front()),
getInstructionIndex(mbb->back()) + 1);
}
}
}
bool killedInDefiningBasicBlock = false;
for (int i = 0, e = vi.Kills.size(); i != e; ++i) {
MachineBasicBlock* killerBlock = vi.Kills[i].first;