diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-04-03 16:40:27 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-04-03 16:40:27 +0000 |
commit | 6d07b625aabbd83fe1baad4229db0c6ddaee8849 (patch) | |
tree | 852ff7d263bbd3810d4dd90fa2d955e658644762 /llvm/lib/CodeGen/RegAllocLinearScan.cpp | |
parent | 20aed56504ef5a8a816ce1a2cf0773fe9f79bb44 (diff) | |
download | bcm5719-llvm-6d07b625aabbd83fe1baad4229db0c6ddaee8849.tar.gz bcm5719-llvm-6d07b625aabbd83fe1baad4229db0c6ddaee8849.zip |
Special handling of zero-sized live intervals.
llvm-svn: 49167
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocLinearScan.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp index 6925de3abf1..19c7da1d525 100644 --- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp +++ b/llvm/lib/CodeGen/RegAllocLinearScan.cpp @@ -322,11 +322,13 @@ void RALinScan::linearScan() ++NumIters; DOUT << "\n*** CURRENT ***: " << *cur << '\n'; - processActiveIntervals(cur->beginNumber()); - processInactiveIntervals(cur->beginNumber()); + if (!cur->empty()) { + processActiveIntervals(cur->beginNumber()); + processInactiveIntervals(cur->beginNumber()); - assert(TargetRegisterInfo::isVirtualRegister(cur->reg) && - "Can only allocate virtual registers!"); + assert(TargetRegisterInfo::isVirtualRegister(cur->reg) && + "Can only allocate virtual registers!"); + } // Allocating a virtual register. try to find a free // physical register or spill an interval (possibly this one) in order to @@ -508,11 +510,23 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur) { DOUT << "\tallocating current interval: "; + // This is an implicitly defined live interval, just assign any register. + const TargetRegisterClass *RC = reginfo_->getRegClass(cur->reg); + if (cur->empty()) { + unsigned physReg = cur->preference; + if (!physReg) + physReg = *RC->allocation_order_begin(*mf_); + DOUT << tri_->getName(physReg) << '\n'; + // Note the register is not really in use. + vrm_->assignVirt2Phys(cur->reg, physReg); + handled_.push_back(cur); + return; + } + PhysRegTracker backupPrt = *prt_; std::vector<std::pair<unsigned, float> > SpillWeightsToAdd; unsigned StartPosition = cur->beginNumber(); - const TargetRegisterClass *RC = reginfo_->getRegClass(cur->reg); const TargetRegisterClass *RCLeader = RelatedRegClasses.getLeaderValue(RC); // If this live interval is defined by a move instruction and its source is |