Add a helper for constructing new live ranges that ended from an instruction to the end of its MBB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52012 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-06-05 17:15:43 +00:00
parent 4e16d4000b
commit c4dc132c8a
2 changed files with 20 additions and 0 deletions

View File

@ -220,6 +220,11 @@ namespace llvm {
I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg)));
return I->second;
}
/// addLiveRangeToEndOfBlock - Given a register and an instruction,
/// adds a live range from that instruction to the end of its MBB.
LiveRange addLiveRangeToEndOfBlock(unsigned reg,
MachineInstr* startInst);
// Interval removal

View File

@ -1830,3 +1830,18 @@ void LiveIntervals::spillPhysRegAroundRegDefsUses(const LiveInterval &li,
}
}
}
LiveRange LiveIntervals::addLiveRangeToEndOfBlock(unsigned reg,
MachineInstr* startInst) {
LiveInterval& Interval = getOrCreateInterval(reg);
VNInfo* VN = Interval.getNextValue(
getInstructionIndex(startInst) + InstrSlots::DEF,
startInst, getVNInfoAllocator());
VN->hasPHIKill = true;
VN->kills.push_back(getMBBEndIdx(startInst->getParent()));
LiveRange LR(getInstructionIndex(startInst) + InstrSlots::DEF,
getMBBEndIdx(startInst->getParent()) + 1, VN);
Interval.addRange(LR);
return LR;
}