| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) | 124 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) |
| 125 ++TrimmedBegin; | 125 ++TrimmedBegin; |
| 126 } | 126 } |
| 127 | 127 |
| 128 IceString Variable::getName(const Cfg *Func) const { | 128 IceString Variable::getName(const Cfg *Func) const { |
| 129 if (Func && NameIndex >= 0) | 129 if (Func && NameIndex >= 0) |
| 130 return Func->getIdentifierName(NameIndex); | 130 return Func->getIdentifierName(NameIndex); |
| 131 return "__" + std::to_string(getIndex()); | 131 return "__" + std::to_string(getIndex()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 Variable *Variable::asType(Type Ty) { | 134 const Variable *Variable::asType(Type Ty, int32_t NewRegNum) const { |
| 135 // Note: This returns a Variable, even if the "this" object is a subclass of | 135 // Note: This returns a Variable, even if the "this" object is a subclass of |
| 136 // Variable. | 136 // Variable. |
| 137 if (!BuildDefs::dump() || getType() == Ty) | 137 if (!BuildDefs::dump() || getType() == Ty) |
| 138 return this; | 138 return this; |
| 139 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) | 139 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) |
| 140 Variable(kVariable, Ty, Number); | 140 Variable(kVariable, Ty, Number); |
| 141 V->NameIndex = NameIndex; | 141 V->NameIndex = NameIndex; |
| 142 V->RegNum = RegNum; | 142 V->RegNum = NewRegNum == NoRegister ? RegNum : NewRegNum; |
| 143 V->StackOffset = StackOffset; | 143 V->StackOffset = StackOffset; |
| 144 return V; | 144 return V; |
| 145 } | 145 } |
| 146 | 146 |
| 147 RegWeight Variable::getWeight(const Cfg *Func) const { | 147 RegWeight Variable::getWeight(const Cfg *Func) const { |
| 148 VariablesMetadata *VMetadata = Func->getVMetadata(); | 148 VariablesMetadata *VMetadata = Func->getVMetadata(); |
| 149 return mustHaveReg() ? RegWeight(RegWeight::Inf) | 149 return mustHaveReg() ? RegWeight(RegWeight::Inf) |
| 150 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) | 150 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) |
| 151 : VMetadata->getUseWeight(this); | 151 : VMetadata->getUseWeight(this); |
| 152 } | 152 } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (getType() != IceType_i32 && getType() != IceType_i16 && | 546 if (getType() != IceType_i32 && getType() != IceType_i16 && |
| 547 getType() != IceType_i8) | 547 getType() != IceType_i8) |
| 548 return false; | 548 return false; |
| 549 // The Following checks if the signed representation of Value is between | 549 // The Following checks if the signed representation of Value is between |
| 550 // -Threshold/2 and +Threshold/2 | 550 // -Threshold/2 and +Threshold/2 |
| 551 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; | 551 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; |
| 552 return largerThanThreshold; | 552 return largerThanThreshold; |
| 553 } | 553 } |
| 554 | 554 |
| 555 } // end of namespace Ice | 555 } // end of namespace Ice |
| OLD | NEW |