| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 bool operator<(const RegWeight &A, const RegWeight &B) { | 31 bool operator<(const RegWeight &A, const RegWeight &B) { |
| 32 return A.getWeight() < B.getWeight(); | 32 return A.getWeight() < B.getWeight(); |
| 33 } | 33 } |
| 34 bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); } | 34 bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); } |
| 35 bool operator==(const RegWeight &A, const RegWeight &B) { | 35 bool operator==(const RegWeight &A, const RegWeight &B) { |
| 36 return !(B < A) && !(A < B); | 36 return !(B < A) && !(A < B); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void LiveRange::addSegment(InstNumberT Start, InstNumberT End) { | 39 void LiveRange::addSegment(InstNumberT Start, InstNumberT End) { |
| 40 if (End > Start) | |
| 41 IsNonpoints = true; | |
| 42 #ifdef USE_SET | 40 #ifdef USE_SET |
| 43 RangeElementType Element(Start, End); | 41 RangeElementType Element(Start, End); |
| 44 RangeType::iterator Next = Range.lower_bound(Element); | 42 RangeType::iterator Next = Range.lower_bound(Element); |
| 45 assert(Next == Range.upper_bound(Element)); // Element not already present | 43 assert(Next == Range.upper_bound(Element)); // Element not already present |
| 46 | 44 |
| 47 // Beginning of code that merges contiguous segments. TODO: change | 45 // Beginning of code that merges contiguous segments. TODO: change |
| 48 // "if(true)" to "if(false)" to see if this extra optimization code | 46 // "if(true)" to "if(false)" to see if this extra optimization code |
| 49 // gives any performance gain, or is just destabilizing. | 47 // gives any performance gain, or is just destabilizing. |
| 50 if (true) { | 48 if (true) { |
| 51 RangeType::iterator FirstDelete = Next; | 49 RangeType::iterator FirstDelete = Next; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (I2->second <= I1->first) { | 116 if (I2->second <= I1->first) { |
| 119 ++I2; | 117 ++I2; |
| 120 continue; | 118 continue; |
| 121 } | 119 } |
| 122 return true; | 120 return true; |
| 123 } | 121 } |
| 124 return false; | 122 return false; |
| 125 } | 123 } |
| 126 | 124 |
| 127 bool LiveRange::overlapsInst(InstNumberT OtherBegin, bool UseTrimmed) const { | 125 bool LiveRange::overlapsInst(InstNumberT OtherBegin, bool UseTrimmed) const { |
| 128 if (!IsNonpoints) | |
| 129 return false; | |
| 130 bool Result = false; | 126 bool Result = false; |
| 131 for (auto I = (UseTrimmed ? TrimmedBegin : Range.begin()), E = Range.end(); | 127 for (auto I = (UseTrimmed ? TrimmedBegin : Range.begin()), E = Range.end(); |
| 132 I != E; ++I) { | 128 I != E; ++I) { |
| 133 if (OtherBegin < I->first) { | 129 if (OtherBegin < I->first) { |
| 134 Result = false; | 130 Result = false; |
| 135 break; | 131 break; |
| 136 } | 132 } |
| 137 if (OtherBegin < I->second) { | 133 if (OtherBegin < I->second) { |
| 138 Result = true; | 134 Result = true; |
| 139 break; | 135 break; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 505 |
| 510 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 506 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
| 511 if (W.getWeight() == RegWeight::Inf) | 507 if (W.getWeight() == RegWeight::Inf) |
| 512 Str << "Inf"; | 508 Str << "Inf"; |
| 513 else | 509 else |
| 514 Str << W.getWeight(); | 510 Str << W.getWeight(); |
| 515 return Str; | 511 return Str; |
| 516 } | 512 } |
| 517 | 513 |
| 518 } // end of namespace Ice | 514 } // end of namespace Ice |
| OLD | NEW |