Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: src/IceRegAlloc.cpp

Issue 1353923004: Subzero: Fix a couple of debugging tools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Prepare test for enabling other targets Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLoweringARM32.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// \file 10 /// \file
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 333
334 void LinearScan::handleActiveRangeExpiredOrInactive(const Variable *Cur) { 334 void LinearScan::handleActiveRangeExpiredOrInactive(const Variable *Cur) {
335 for (SizeT I = Active.size(); I > 0; --I) { 335 for (SizeT I = Active.size(); I > 0; --I) {
336 const SizeT Index = I - 1; 336 const SizeT Index = I - 1;
337 Variable *Item = Active[Index]; 337 Variable *Item = Active[Index];
338 Item->trimLiveRange(Cur->getLiveRange().getStart()); 338 Item->trimLiveRange(Cur->getLiveRange().getStart());
339 bool Moved = false; 339 bool Moved = false;
340 if (Item->rangeEndsBefore(Cur)) { 340 if (Item->rangeEndsBefore(Cur)) {
341 // Move Item from Active to Handled list. 341 // Move Item from Active to Handled list.
342 dumpLiveRangeTrace("Expiring ", Cur); 342 dumpLiveRangeTrace("Expiring ", Item);
343 moveItem(Active, Index, Handled); 343 moveItem(Active, Index, Handled);
344 Moved = true; 344 Moved = true;
345 } else if (!Item->rangeOverlapsStart(Cur)) { 345 } else if (!Item->rangeOverlapsStart(Cur)) {
346 // Move Item from Active to Inactive list. 346 // Move Item from Active to Inactive list.
347 dumpLiveRangeTrace("Inactivating ", Cur); 347 dumpLiveRangeTrace("Inactivating ", Item);
348 moveItem(Active, Index, Inactive); 348 moveItem(Active, Index, Inactive);
349 Moved = true; 349 Moved = true;
350 } 350 }
351 if (Moved) { 351 if (Moved) {
352 // Decrement Item from RegUses[]. 352 // Decrement Item from RegUses[].
353 assert(Item->hasRegTmp()); 353 assert(Item->hasRegTmp());
354 const llvm::SmallBitVector &Aliases = *RegAliases[Item->getRegNumTmp()]; 354 const llvm::SmallBitVector &Aliases = *RegAliases[Item->getRegNumTmp()];
355 for (int32_t RegAlias = Aliases.find_first(); RegAlias >= 0; 355 for (int32_t RegAlias = Aliases.find_first(); RegAlias >= 0;
356 RegAlias = Aliases.find_next(RegAlias)) { 356 RegAlias = Aliases.find_next(RegAlias)) {
357 --RegUses[RegAlias]; 357 --RegUses[RegAlias];
358 assert(RegUses[RegAlias] >= 0); 358 assert(RegUses[RegAlias] >= 0);
359 } 359 }
360 } 360 }
361 } 361 }
362 } 362 }
363 363
364 void LinearScan::handleInactiveRangeExpiredOrReactivated(const Variable *Cur) { 364 void LinearScan::handleInactiveRangeExpiredOrReactivated(const Variable *Cur) {
365 for (SizeT I = Inactive.size(); I > 0; --I) { 365 for (SizeT I = Inactive.size(); I > 0; --I) {
366 const SizeT Index = I - 1; 366 const SizeT Index = I - 1;
367 Variable *Item = Inactive[Index]; 367 Variable *Item = Inactive[Index];
368 Item->trimLiveRange(Cur->getLiveRange().getStart()); 368 Item->trimLiveRange(Cur->getLiveRange().getStart());
369 if (Item->rangeEndsBefore(Cur)) { 369 if (Item->rangeEndsBefore(Cur)) {
370 // Move Item from Inactive to Handled list. 370 // Move Item from Inactive to Handled list.
371 dumpLiveRangeTrace("Expiring ", Cur); 371 dumpLiveRangeTrace("Expiring ", Item);
372 moveItem(Inactive, Index, Handled); 372 moveItem(Inactive, Index, Handled);
373 } else if (Item->rangeOverlapsStart(Cur)) { 373 } else if (Item->rangeOverlapsStart(Cur)) {
374 // Move Item from Inactive to Active list. 374 // Move Item from Inactive to Active list.
375 dumpLiveRangeTrace("Reactivating ", Cur); 375 dumpLiveRangeTrace("Reactivating ", Item);
376 moveItem(Inactive, Index, Active); 376 moveItem(Inactive, Index, Active);
377 // Increment Item in RegUses[]. 377 // Increment Item in RegUses[].
378 assert(Item->hasRegTmp()); 378 assert(Item->hasRegTmp());
379 const llvm::SmallBitVector &Aliases = *RegAliases[Item->getRegNumTmp()]; 379 const llvm::SmallBitVector &Aliases = *RegAliases[Item->getRegNumTmp()];
380 for (int32_t RegAlias = Aliases.find_first(); RegAlias >= 0; 380 for (int32_t RegAlias = Aliases.find_first(); RegAlias >= 0;
381 RegAlias = Aliases.find_next(RegAlias)) { 381 RegAlias = Aliases.find_next(RegAlias)) {
382 assert(RegUses[RegAlias] >= 0); 382 assert(RegUses[RegAlias] >= 0);
383 ++RegUses[RegAlias]; 383 ++RegUses[RegAlias];
384 } 384 }
385 } 385 }
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 Str << "\n"; 883 Str << "\n";
884 } 884 }
885 Str << "++++++ Inactive:\n"; 885 Str << "++++++ Inactive:\n";
886 for (const Variable *Item : Inactive) { 886 for (const Variable *Item : Inactive) {
887 dumpLiveRange(Item, Func); 887 dumpLiveRange(Item, Func);
888 Str << "\n"; 888 Str << "\n";
889 } 889 }
890 } 890 }
891 891
892 } // end of namespace Ice 892 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLoweringARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698