LiveInterval: Use range based for loops for subregister ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223991 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun
2014-12-11 00:59:06 +00:00
parent d1db29860c
commit 1bfcc2d56f
9 changed files with 110 additions and 126 deletions

View File

@ -66,22 +66,21 @@ void LiveRangeCalc::createDeadDefs(LiveInterval &LI) {
LI.createSubRangeFrom(*Alloc, ClassMask, LI);
}
for (LiveInterval::subrange_iterator S = LI.subrange_begin(),
SE = LI.subrange_end(); S != SE; ++S) {
for (LiveInterval::SubRange &S : LI.subranges()) {
// A Mask for subregs common to the existing subrange and current def.
unsigned Common = S->LaneMask & Mask;
unsigned Common = S.LaneMask & Mask;
if (Common == 0)
continue;
// A Mask for subregs covered by the subrange but not the current def.
unsigned LRest = S->LaneMask & ~Mask;
unsigned LRest = S.LaneMask & ~Mask;
LiveInterval::SubRange *CommonRange;
if (LRest != 0) {
// Split current subrange into Common and LRest ranges.
S->LaneMask = LRest;
CommonRange = LI.createSubRangeFrom(*Alloc, Common, *S);
S.LaneMask = LRest;
CommonRange = LI.createSubRangeFrom(*Alloc, Common, S);
} else {
assert(Common == S->LaneMask);
CommonRange = &*S;
assert(Common == S.LaneMask);
CommonRange = &S;
}
CommonRange->createDeadDef(Idx, *Alloc);
Mask &= ~Common;
@ -162,8 +161,9 @@ void LiveRangeCalc::extendToUses(LiveInterval &LI) {
const TargetRegisterInfo &TRI = *MRI->getTargetRegisterInfo();
SmallVector<LiveOutData,2> LiveOuts;
unsigned NumSubRanges = 0;
for (LiveInterval::subrange_iterator S = LI.subrange_begin(),
SE = LI.subrange_end(); S != SE; ++S, ++NumSubRanges) {
for (const auto &S : LI.subranges()) {
(void)S;
++NumSubRanges;
LiveOuts.push_back(LiveOutData());
LiveOuts.back().reset(MF->getNumBlockIDs());
}