llvm.org GIT mirror llvm / f30a49d
Special handling of zero-sized live intervals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49167 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
2 changed file(s) with 24 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
274274
275275 /// beginNumber - Return the lowest numbered slot covered by interval.
276276 unsigned beginNumber() const {
277 assert(!empty() && "empty interval for register");
277 if (empty())
278 return 0;
278279 return ranges.front().start;
279280 }
280281
281282 /// endNumber - return the maximum point of the interval of the whole,
282283 /// exclusive.
283284 unsigned endNumber() const {
284 assert(!empty() && "empty interval for register");
285 if (empty())
286 return 0;
285287 return ranges.back().end;
286288 }
287289
321321 ++NumIters;
322322 DOUT << "\n*** CURRENT ***: " << *cur << '\n';
323323
324 processActiveIntervals(cur->beginNumber());
325 processInactiveIntervals(cur->beginNumber());
326
327 assert(TargetRegisterInfo::isVirtualRegister(cur->reg) &&
328 "Can only allocate virtual registers!");
324 if (!cur->empty()) {
325 processActiveIntervals(cur->beginNumber());
326 processInactiveIntervals(cur->beginNumber());
327
328 assert(TargetRegisterInfo::isVirtualRegister(cur->reg) &&
329 "Can only allocate virtual registers!");
330 }
329331
330332 // Allocating a virtual register. try to find a free
331333 // physical register or spill an interval (possibly this one) in order to
507509 {
508510 DOUT << "\tallocating current interval: ";
509511
512 // This is an implicitly defined live interval, just assign any register.
513 const TargetRegisterClass *RC = reginfo_->getRegClass(cur->reg);
514 if (cur->empty()) {
515 unsigned physReg = cur->preference;
516 if (!physReg)
517 physReg = *RC->allocation_order_begin(*mf_);
518 DOUT << tri_->getName(physReg) << '\n';
519 // Note the register is not really in use.
520 vrm_->assignVirt2Phys(cur->reg, physReg);
521 handled_.push_back(cur);
522 return;
523 }
524
510525 PhysRegTracker backupPrt = *prt_;
511526
512527 std::vector > SpillWeightsToAdd;
513528 unsigned StartPosition = cur->beginNumber();
514 const TargetRegisterClass *RC = reginfo_->getRegClass(cur->reg);
515529 const TargetRegisterClass *RCLeader = RelatedRegClasses.getLeaderValue(RC);
516530
517531 // If this live interval is defined by a move instruction and its source is