Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// | 1 //===- subzero/src/IceOperand.cpp - High-level operand 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 Operand class and its target-independent | 10 // This file implements the Operand class and its target-independent |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 I != E; ++I) { | 84 I != E; ++I) { |
| 85 if (OtherBegin < I->first) { | 85 if (OtherBegin < I->first) { |
| 86 Result = false; | 86 Result = false; |
| 87 break; | 87 break; |
| 88 } | 88 } |
| 89 if (OtherBegin < I->second) { | 89 if (OtherBegin < I->second) { |
| 90 Result = true; | 90 Result = true; |
| 91 break; | 91 break; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 #if 0 | 94 // This is an equivalent but less inefficient implementation. It's |
| 95 // An equivalent but less inefficient implementation: | 95 // expensive enough that we wouldn't want to run it under any build, |
| 96 LiveRange Temp; | 96 // but it could be enabled if e.g. the LiveRange implementation |
| 97 Temp.addSegment(OtherBegin, OtherBegin + 1); | 97 // changes and extra testing is needed. |
| 98 bool Validation = overlaps(Temp); | 98 if (false) { |
|
John
2015/06/22 17:13:46
Can this be a constexpr bool somewhere, perhaps mo
Jim Stichnoth
2015/06/23 21:42:07
Done.
| |
| 99 assert(Result == Validation); | 99 LiveRange Temp; |
| 100 #endif | 100 Temp.addSegment(OtherBegin, OtherBegin + 1); |
| 101 bool Validation = overlaps(Temp); | |
| 102 (void)Validation; | |
| 103 assert(Result == Validation); | |
| 104 } | |
| 101 return Result; | 105 return Result; |
| 102 } | 106 } |
| 103 | 107 |
| 104 // Returns true if the live range contains the given instruction | 108 // Returns true if the live range contains the given instruction |
| 105 // number. This is only used for validating the live range | 109 // number. This is only used for validating the live range |
| 106 // calculation. The IsDest argument indicates whether the Variable | 110 // calculation. The IsDest argument indicates whether the Variable |
| 107 // being tested is used in the Dest position (as opposed to a Src | 111 // being tested is used in the Dest position (as opposed to a Src |
| 108 // position). | 112 // position). |
| 109 bool LiveRange::containsValue(InstNumberT Value, bool IsDest) const { | 113 bool LiveRange::containsValue(InstNumberT Value, bool IsDest) const { |
| 110 for (const RangeElementType &I : Range) { | 114 for (const RangeElementType &I : Range) { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 if (!ALLOW_DUMP) | 489 if (!ALLOW_DUMP) |
| 486 return Str; | 490 return Str; |
| 487 if (W.getWeight() == RegWeight::Inf) | 491 if (W.getWeight() == RegWeight::Inf) |
| 488 Str << "Inf"; | 492 Str << "Inf"; |
| 489 else | 493 else |
| 490 Str << W.getWeight(); | 494 Str << W.getWeight(); |
| 491 return Str; | 495 return Str; |
| 492 } | 496 } |
| 493 | 497 |
| 494 } // end of namespace Ice | 498 } // end of namespace Ice |
| OLD | NEW |