OLD | NEW |
1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// | 1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the LinearScan class, which performs the | 10 // This file implements the LinearScan class, which performs the |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 Active.erase(I); | 338 Active.erase(I); |
339 Handled.push_back(Item); | 339 Handled.push_back(Item); |
340 } | 340 } |
341 } | 341 } |
342 // Do the same for Inactive. | 342 // Do the same for Inactive. |
343 for (UnorderedRanges::iterator I = Inactive.begin(), E = Inactive.end(); | 343 for (UnorderedRanges::iterator I = Inactive.begin(), E = Inactive.end(); |
344 I != E; I = Next) { | 344 I != E; I = Next) { |
345 Next = I; | 345 Next = I; |
346 ++Next; | 346 ++Next; |
347 LiveRangeWrapper Item = *I; | 347 LiveRangeWrapper Item = *I; |
348 if (Item.Var->getRegNumTmp() == MinWeightIndex) { | 348 // Note: The Item.overlaps(Cur) clause is not part of the |
| 349 // description of AssignMemLoc() in the original paper. But |
| 350 // there doesn't seem to be any need to evict an inactive |
| 351 // live range that doesn't overlap with the live range |
| 352 // currently being considered. It's especially bad if we |
| 353 // would end up evicting an infinite-weight but |
| 354 // currently-inactive live range. The most common situation |
| 355 // for this would be a scratch register kill set for call |
| 356 // instructions. |
| 357 if (Item.Var->getRegNumTmp() == MinWeightIndex && |
| 358 Item.overlaps(Cur)) { |
349 if (Func->getContext()->isVerbose(IceV_LinearScan)) { | 359 if (Func->getContext()->isVerbose(IceV_LinearScan)) { |
350 Str << "Evicting "; | 360 Str << "Evicting "; |
351 Item.dump(Func); | 361 Item.dump(Func); |
352 Str << "\n"; | 362 Str << "\n"; |
353 } | 363 } |
354 Item.Var->setRegNumTmp(Variable::NoRegister); | 364 Item.Var->setRegNumTmp(Variable::NoRegister); |
355 Inactive.erase(I); | 365 Inactive.erase(I); |
356 Handled.push_back(Item); | 366 Handled.push_back(Item); |
357 } | 367 } |
358 } | 368 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 468 } |
459 Str << "++++++ Inactive:\n"; | 469 Str << "++++++ Inactive:\n"; |
460 for (UnorderedRanges::const_iterator I = Inactive.begin(), E = Inactive.end(); | 470 for (UnorderedRanges::const_iterator I = Inactive.begin(), E = Inactive.end(); |
461 I != E; ++I) { | 471 I != E; ++I) { |
462 I->dump(Func); | 472 I->dump(Func); |
463 Str << "\n"; | 473 Str << "\n"; |
464 } | 474 } |
465 } | 475 } |
466 | 476 |
467 } // end of namespace Ice | 477 } // end of namespace Ice |
OLD | NEW |