Changed slot index ranges for MachineBasicBlocks to be exclusive of endpoint.

This fixes an in-place update bug where code inserted at the end of basic blocks may not be covered by existing intervals which were live across the entire block. It is also consistent with the way ranges are specified for live intervals.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91859 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames
2009-12-22 00:11:50 +00:00
parent 87710f04e5
commit 74ab5eeffb
7 changed files with 29 additions and 34 deletions

View File

@@ -92,13 +92,14 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
functionSize = 0;
unsigned index = 0;
push_back(createEntry(0, index));
// Iterate over the the function.
for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end();
mbbItr != mbbEnd; ++mbbItr) {
MachineBasicBlock *mbb = &*mbbItr;
// Insert an index for the MBB start.
push_back(createEntry(0, index));
SlotIndex blockStartIndex(back(), SlotIndex::LOAD);
index += SlotIndex::NUM;
@@ -137,16 +138,16 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
index += SlotIndex::NUM;
}
SlotIndex blockEndIndex(back(), SlotIndex::STORE);
// One blank instruction at the end.
push_back(createEntry(0, index));
SlotIndex blockEndIndex(back(), SlotIndex::LOAD);
mbb2IdxMap.insert(
std::make_pair(mbb, std::make_pair(blockStartIndex, blockEndIndex)));
idx2MBBMap.push_back(IdxMBBPair(blockStartIndex, mbb));
}
// One blank instruction at the end.
push_back(createEntry(0, index));
// Sort the Idx2MBBMap
std::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare());