comparison lib/CodeGen/StackSlotColoring.cpp @ 95:afa8332a0e37 LLVM3.8

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 60c9769439b8
children 1172e4bd9c6f
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
182 OrigSizes.resize(LastFI); 182 OrigSizes.resize(LastFI);
183 AllColors.resize(LastFI); 183 AllColors.resize(LastFI);
184 UsedColors.resize(LastFI); 184 UsedColors.resize(LastFI);
185 Assignments.resize(LastFI); 185 Assignments.resize(LastFI);
186 186
187 typedef std::iterator_traits<LiveStacks::iterator>::value_type Pair;
188 SmallVector<Pair *, 16> Intervals;
189 Intervals.reserve(LS->getNumIntervals());
190 for (auto &I : *LS)
191 Intervals.push_back(&I);
192 std::sort(Intervals.begin(), Intervals.end(),
193 [](Pair *LHS, Pair *RHS) { return LHS->first < RHS->first; });
194
187 // Gather all spill slots into a list. 195 // Gather all spill slots into a list.
188 DEBUG(dbgs() << "Spill slot intervals:\n"); 196 DEBUG(dbgs() << "Spill slot intervals:\n");
189 for (LiveStacks::iterator i = LS->begin(), e = LS->end(); i != e; ++i) { 197 for (auto *I : Intervals) {
190 LiveInterval &li = i->second; 198 LiveInterval &li = I->second;
191 DEBUG(li.dump()); 199 DEBUG(li.dump());
192 int FI = TargetRegisterInfo::stackSlot2Index(li.reg); 200 int FI = TargetRegisterInfo::stackSlot2Index(li.reg);
193 if (MFI->isDeadObjectIndex(FI)) 201 if (MFI->isDeadObjectIndex(FI))
194 continue; 202 continue;
195 SSIntervals.push_back(&li); 203 SSIntervals.push_back(&li);
308 for (unsigned SS = 0, SE = SSRefs.size(); SS != SE; ++SS) { 316 for (unsigned SS = 0, SE = SSRefs.size(); SS != SE; ++SS) {
309 int NewFI = SlotMapping[SS]; 317 int NewFI = SlotMapping[SS];
310 if (NewFI == -1 || (NewFI == (int)SS)) 318 if (NewFI == -1 || (NewFI == (int)SS))
311 continue; 319 continue;
312 320
313 const PseudoSourceValue *NewSV = PseudoSourceValue::getFixedStack(NewFI); 321 const PseudoSourceValue *NewSV = MF.getPSVManager().getFixedStack(NewFI);
314 SmallVectorImpl<MachineMemOperand *> &RefMMOs = SSRefs[SS]; 322 SmallVectorImpl<MachineMemOperand *> &RefMMOs = SSRefs[SS];
315 for (unsigned i = 0, e = RefMMOs.size(); i != e; ++i) 323 for (unsigned i = 0, e = RefMMOs.size(); i != e; ++i)
316 RefMMOs[i]->setValue(NewSV); 324 RefMMOs[i]->setValue(NewSV);
317 } 325 }
318 326