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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) | 183 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) |
184 ++TrimmedBegin; | 184 ++TrimmedBegin; |
185 } | 185 } |
186 | 186 |
187 IceString Variable::getName(const Cfg *Func) const { | 187 IceString Variable::getName(const Cfg *Func) const { |
188 if (Func && NameIndex >= 0) | 188 if (Func && NameIndex >= 0) |
189 return Func->getIdentifierName(NameIndex); | 189 return Func->getIdentifierName(NameIndex); |
190 return "__" + std::to_string(getIndex()); | 190 return "__" + std::to_string(getIndex()); |
191 } | 191 } |
192 | 192 |
193 const Variable *Variable::asType(Type Ty, int32_t NewRegNum) const { | 193 const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const { |
194 // Note: This returns a Variable, even if the "this" object is a subclass of | 194 // Note: This returns a Variable, even if the "this" object is a subclass of |
195 // Variable. | 195 // Variable. |
196 if (!BuildDefs::dump() || getType() == Ty) | 196 if (!BuildDefs::dump() || getType() == Ty) |
197 return this; | 197 return this; |
198 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) | 198 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) |
199 Variable(kVariable, Ty, Number); | 199 Variable(kVariable, Ty, Number); |
200 V->NameIndex = NameIndex; | 200 V->NameIndex = NameIndex; |
201 V->RegNum = NewRegNum == NoRegister ? RegNum : NewRegNum; | 201 V->RegNum = NewRegNum == RegNumT::NoRegister ? RegNum : NewRegNum; |
202 V->StackOffset = StackOffset; | 202 V->StackOffset = StackOffset; |
203 return V; | 203 return V; |
204 } | 204 } |
205 | 205 |
206 RegWeight Variable::getWeight(const Cfg *Func) const { | 206 RegWeight Variable::getWeight(const Cfg *Func) const { |
207 VariablesMetadata *VMetadata = Func->getVMetadata(); | 207 VariablesMetadata *VMetadata = Func->getVMetadata(); |
208 return mustHaveReg() ? RegWeight(RegWeight::Inf) | 208 return mustHaveReg() ? RegWeight(RegWeight::Inf) |
209 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) | 209 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) |
210 : VMetadata->getUseWeight(this); | 210 : VMetadata->getUseWeight(this); |
211 } | 211 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 if (Func->isVerbose(IceV_RegOrigins) || | 504 if (Func->isVerbose(IceV_RegOrigins) || |
505 (!hasReg() && !Func->getTarget()->hasComputedFrame())) | 505 (!hasReg() && !Func->getTarget()->hasComputedFrame())) |
506 Str << "%" << getName(Func); | 506 Str << "%" << getName(Func); |
507 if (hasReg()) { | 507 if (hasReg()) { |
508 if (Func->isVerbose(IceV_RegOrigins)) | 508 if (Func->isVerbose(IceV_RegOrigins)) |
509 Str << ":"; | 509 Str << ":"; |
510 Str << Func->getTarget()->getRegName(RegNum, getType()); | 510 Str << Func->getTarget()->getRegName(RegNum, getType()); |
511 } else if (Func->getTarget()->hasComputedFrame()) { | 511 } else if (Func->getTarget()->hasComputedFrame()) { |
512 if (Func->isVerbose(IceV_RegOrigins)) | 512 if (Func->isVerbose(IceV_RegOrigins)) |
513 Str << ":"; | 513 Str << ":"; |
514 int32_t BaseRegisterNumber = getBaseRegNum(); | 514 RegNumT BaseRegisterNumber = getBaseRegNum(); |
515 if (BaseRegisterNumber == NoRegister) | 515 if (BaseRegisterNumber == RegNumT::NoRegister) |
516 BaseRegisterNumber = Func->getTarget()->getFrameOrStackReg(); | 516 BaseRegisterNumber = Func->getTarget()->getFrameOrStackReg(); |
517 Str << "[" | 517 Str << "[" |
518 << Func->getTarget()->getRegName(BaseRegisterNumber, IceType_i32); | 518 << Func->getTarget()->getRegName(BaseRegisterNumber, IceType_i32); |
519 int32_t Offset = getStackOffset(); | 519 int32_t Offset = getStackOffset(); |
520 if (Offset) { | 520 if (Offset) { |
521 if (Offset > 0) | 521 if (Offset > 0) |
522 Str << "+"; | 522 Str << "+"; |
523 Str << Offset; | 523 Str << Offset; |
524 } | 524 } |
525 Str << "]"; | 525 Str << "]"; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 if (getType() != IceType_i32 && getType() != IceType_i16 && | 611 if (getType() != IceType_i32 && getType() != IceType_i16 && |
612 getType() != IceType_i8) | 612 getType() != IceType_i8) |
613 return false; | 613 return false; |
614 // The Following checks if the signed representation of Value is between | 614 // The Following checks if the signed representation of Value is between |
615 // -Threshold/2 and +Threshold/2 | 615 // -Threshold/2 and +Threshold/2 |
616 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; | 616 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; |
617 return largerThanThreshold; | 617 return largerThanThreshold; |
618 } | 618 } |
619 | 619 |
620 } // end of namespace Ice | 620 } // end of namespace Ice |
OLD | NEW |