| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 ++TrimmedBegin; | 191 ++TrimmedBegin; |
| 192 } | 192 } |
| 193 | 193 |
| 194 const Variable *Variable::asType(const Cfg *Func, Type Ty, | 194 const Variable *Variable::asType(const Cfg *Func, Type Ty, |
| 195 RegNumT NewRegNum) const { | 195 RegNumT NewRegNum) const { |
| 196 // 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 |
| 197 // Variable. | 197 // Variable. |
| 198 if (!BuildDefs::dump() || getType() == Ty) | 198 if (!BuildDefs::dump() || getType() == Ty) |
| 199 return this; | 199 return this; |
| 200 static constexpr SizeT One = 1; | 200 static constexpr SizeT One = 1; |
| 201 Variable *V = new (CfgLocalAllocator<Variable>().allocate(One)) | 201 auto *V = new (CfgLocalAllocator<Variable>().allocate(One)) |
| 202 Variable(Func, kVariable, Ty, Number); | 202 Variable(Func, kVariable, Ty, Number); |
| 203 V->Name = Name; | 203 V->Name = Name; |
| 204 V->RegNum = NewRegNum.hasValue() ? NewRegNum : RegNum; | 204 V->RegNum = NewRegNum.hasValue() ? NewRegNum : RegNum; |
| 205 V->StackOffset = StackOffset; | 205 V->StackOffset = StackOffset; |
| 206 V->LinkedTo = LinkedTo; |
| 206 return V; | 207 return V; |
| 207 } | 208 } |
| 208 | 209 |
| 209 RegWeight Variable::getWeight(const Cfg *Func) const { | 210 RegWeight Variable::getWeight(const Cfg *Func) const { |
| 210 VariablesMetadata *VMetadata = Func->getVMetadata(); | 211 VariablesMetadata *VMetadata = Func->getVMetadata(); |
| 211 return mustHaveReg() ? RegWeight(RegWeight::Inf) | 212 return mustHaveReg() ? RegWeight(RegWeight::Inf) |
| 212 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) | 213 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) |
| 213 : VMetadata->getUseWeight(this); | 214 : VMetadata->getUseWeight(this); |
| 214 } | 215 } |
| 215 | 216 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 531 } |
| 531 | 532 |
| 532 void Variable::dump(const Cfg *Func, Ostream &Str) const { | 533 void Variable::dump(const Cfg *Func, Ostream &Str) const { |
| 533 if (!BuildDefs::dump()) | 534 if (!BuildDefs::dump()) |
| 534 return; | 535 return; |
| 535 if (Func == nullptr) { | 536 if (Func == nullptr) { |
| 536 Str << "%" << getName(); | 537 Str << "%" << getName(); |
| 537 return; | 538 return; |
| 538 } | 539 } |
| 539 if (Func->isVerbose(IceV_RegOrigins) || | 540 if (Func->isVerbose(IceV_RegOrigins) || |
| 540 (!hasReg() && !Func->getTarget()->hasComputedFrame())) | 541 (!hasReg() && !Func->getTarget()->hasComputedFrame())) { |
| 541 Str << "%" << getName(); | 542 Str << "%" << getName(); |
| 543 if (getLinkedTo() != nullptr) |
| 544 Str << ":%" << getLinkedTo()->getName(); |
| 545 } |
| 542 if (hasReg()) { | 546 if (hasReg()) { |
| 543 if (Func->isVerbose(IceV_RegOrigins)) | 547 if (Func->isVerbose(IceV_RegOrigins)) |
| 544 Str << ":"; | 548 Str << ":"; |
| 545 Str << Func->getTarget()->getRegName(RegNum, getType()); | 549 Str << Func->getTarget()->getRegName(RegNum, getType()); |
| 546 } else if (Func->getTarget()->hasComputedFrame()) { | 550 } else if (Func->getTarget()->hasComputedFrame()) { |
| 547 if (Func->isVerbose(IceV_RegOrigins)) | 551 if (Func->isVerbose(IceV_RegOrigins)) |
| 548 Str << ":"; | 552 Str << ":"; |
| 549 const auto BaseRegisterNumber = | 553 const auto BaseRegisterNumber = |
| 550 hasReg() ? getBaseRegNum() : Func->getTarget()->getFrameOrStackReg(); | 554 hasReg() ? getBaseRegNum() : Func->getTarget()->getFrameOrStackReg(); |
| 551 Str << "[" | 555 Str << "[" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 if (getType() != IceType_i32 && getType() != IceType_i16 && | 647 if (getType() != IceType_i32 && getType() != IceType_i16 && |
| 644 getType() != IceType_i8) | 648 getType() != IceType_i8) |
| 645 return false; | 649 return false; |
| 646 // The Following checks if the signed representation of Value is between | 650 // The Following checks if the signed representation of Value is between |
| 647 // -Threshold/2 and +Threshold/2 | 651 // -Threshold/2 and +Threshold/2 |
| 648 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; | 652 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; |
| 649 return largerThanThreshold; | 653 return largerThanThreshold; |
| 650 } | 654 } |
| 651 | 655 |
| 652 } // end of namespace Ice | 656 } // end of namespace Ice |
| OLD | NEW |