| 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; |
| 40 #ifdef USE_SET | 42 #ifdef USE_SET |
| 41 RangeElementType Element(Start, End); | 43 RangeElementType Element(Start, End); |
| 42 RangeType::iterator Next = Range.lower_bound(Element); | 44 RangeType::iterator Next = Range.lower_bound(Element); |
| 43 assert(Next == Range.upper_bound(Element)); // Element not already present | 45 assert(Next == Range.upper_bound(Element)); // Element not already present |
| 44 | 46 |
| 45 // Beginning of code that merges contiguous segments. TODO: change | 47 // Beginning of code that merges contiguous segments. TODO: change |
| 46 // "if(true)" to "if(false)" to see if this extra optimization code | 48 // "if(true)" to "if(false)" to see if this extra optimization code |
| 47 // gives any performance gain, or is just destabilizing. | 49 // gives any performance gain, or is just destabilizing. |
| 48 if (true) { | 50 if (true) { |
| 49 RangeType::iterator FirstDelete = Next; | 51 RangeType::iterator FirstDelete = Next; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (I2->second <= I1->first) { | 117 if (I2->second <= I1->first) { |
| 116 ++I2; | 118 ++I2; |
| 117 continue; | 119 continue; |
| 118 } | 120 } |
| 119 return true; | 121 return true; |
| 120 } | 122 } |
| 121 return false; | 123 return false; |
| 122 } | 124 } |
| 123 | 125 |
| 124 bool LiveRange::overlaps(InstNumberT OtherBegin) const { | 126 bool LiveRange::overlaps(InstNumberT OtherBegin) const { |
| 127 if (!IsNonpoints) |
| 128 return false; |
| 125 bool Result = false; | 129 bool Result = false; |
| 126 for (const RangeElementType &I : Range) { | 130 for (const RangeElementType &I : Range) { |
| 127 if (OtherBegin < I.first) { | 131 if (OtherBegin < I.first) { |
| 128 Result = false; | 132 Result = false; |
| 129 break; | 133 break; |
| 130 } | 134 } |
| 131 if (OtherBegin < I.second) { | 135 if (OtherBegin < I.second) { |
| 132 Result = true; | 136 Result = true; |
| 133 break; | 137 break; |
| 134 } | 138 } |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 452 |
| 449 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 453 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
| 450 if (W.getWeight() == RegWeight::Inf) | 454 if (W.getWeight() == RegWeight::Inf) |
| 451 Str << "Inf"; | 455 Str << "Inf"; |
| 452 else | 456 else |
| 453 Str << W.getWeight(); | 457 Str << W.getWeight(); |
| 454 return Str; | 458 return Str; |
| 455 } | 459 } |
| 456 | 460 |
| 457 } // end of namespace Ice | 461 } // end of namespace Ice |
| OLD | NEW |