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 /// \file | 10 /// \file |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 } else if (RelocOffsetA != RelocOffsetB) { | 80 } else if (RelocOffsetA != RelocOffsetB) { |
81 // or, if they are undefined, then the RelocOffsets must be the same. | 81 // or, if they are undefined, then the RelocOffsets must be the same. |
82 return false; | 82 return false; |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 const RegNumT RegNumT::NoRegister(RegNumT::NoRegisterValue); | |
90 RegNumT::BaseType RegNumT::Limit = 0; | 89 RegNumT::BaseType RegNumT::Limit = 0; |
91 | 90 |
92 bool operator<(const RegWeight &A, const RegWeight &B) { | 91 bool operator<(const RegWeight &A, const RegWeight &B) { |
93 return A.getWeight() < B.getWeight(); | 92 return A.getWeight() < B.getWeight(); |
94 } | 93 } |
95 bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); } | 94 bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); } |
96 bool operator==(const RegWeight &A, const RegWeight &B) { | 95 bool operator==(const RegWeight &A, const RegWeight &B) { |
97 return !(B < A) && !(A < B); | 96 return !(B < A) && !(A < B); |
98 } | 97 } |
99 | 98 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 193 } |
195 | 194 |
196 const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const { | 195 const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const { |
197 // Note: This returns a Variable, even if the "this" object is a subclass of | 196 // Note: This returns a Variable, even if the "this" object is a subclass of |
198 // Variable. | 197 // Variable. |
199 if (!BuildDefs::dump() || getType() == Ty) | 198 if (!BuildDefs::dump() || getType() == Ty) |
200 return this; | 199 return this; |
201 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) | 200 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) |
202 Variable(kVariable, Ty, Number); | 201 Variable(kVariable, Ty, Number); |
203 V->NameIndex = NameIndex; | 202 V->NameIndex = NameIndex; |
204 V->RegNum = NewRegNum == RegNumT::NoRegister ? RegNum : NewRegNum; | 203 V->RegNum = NewRegNum.hasValue() ? NewRegNum : RegNum; |
205 V->StackOffset = StackOffset; | 204 V->StackOffset = StackOffset; |
206 return V; | 205 return V; |
207 } | 206 } |
208 | 207 |
209 RegWeight Variable::getWeight(const Cfg *Func) const { | 208 RegWeight Variable::getWeight(const Cfg *Func) const { |
210 VariablesMetadata *VMetadata = Func->getVMetadata(); | 209 VariablesMetadata *VMetadata = Func->getVMetadata(); |
211 return mustHaveReg() ? RegWeight(RegWeight::Inf) | 210 return mustHaveReg() ? RegWeight(RegWeight::Inf) |
212 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) | 211 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) |
213 : VMetadata->getUseWeight(this); | 212 : VMetadata->getUseWeight(this); |
214 } | 213 } |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 if (getType() != IceType_i32 && getType() != IceType_i16 && | 616 if (getType() != IceType_i32 && getType() != IceType_i16 && |
618 getType() != IceType_i8) | 617 getType() != IceType_i8) |
619 return false; | 618 return false; |
620 // The Following checks if the signed representation of Value is between | 619 // The Following checks if the signed representation of Value is between |
621 // -Threshold/2 and +Threshold/2 | 620 // -Threshold/2 and +Threshold/2 |
622 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; | 621 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; |
623 return largerThanThreshold; | 622 return largerThanThreshold; |
624 } | 623 } |
625 | 624 |
626 } // end of namespace Ice | 625 } // end of namespace Ice |
OLD | NEW |