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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return true; | 184 return true; |
185 } | 185 } |
186 return false; | 186 return false; |
187 } | 187 } |
188 | 188 |
189 void LiveRange::trim(InstNumberT Lower) { | 189 void LiveRange::trim(InstNumberT Lower) { |
190 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) | 190 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) |
191 ++TrimmedBegin; | 191 ++TrimmedBegin; |
192 } | 192 } |
193 | 193 |
194 std::string Variable::getName(const Cfg *Func) const { | |
195 if (Func == nullptr) | |
196 return "__" + std::to_string(getIndex()); | |
197 return Name.toString(); | |
198 } | |
199 | |
200 const Variable *Variable::asType(const Cfg *Func, Type Ty, | 194 const Variable *Variable::asType(const Cfg *Func, Type Ty, |
201 RegNumT NewRegNum) const { | 195 RegNumT NewRegNum) const { |
202 // 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 |
203 // Variable. | 197 // Variable. |
204 if (!BuildDefs::dump() || getType() == Ty) | 198 if (!BuildDefs::dump() || getType() == Ty) |
205 return this; | 199 return this; |
206 static constexpr SizeT One = 1; | 200 static constexpr SizeT One = 1; |
207 Variable *V = new (CfgLocalAllocator<Variable>().allocate(One)) | 201 Variable *V = new (CfgLocalAllocator<Variable>().allocate(One)) |
208 Variable(Func, kVariable, Ty, Number); | 202 Variable(Func, kVariable, Ty, Number); |
209 V->Name = Name; | 203 V->Name = Name; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 526 |
533 void Variable::emit(const Cfg *Func) const { | 527 void Variable::emit(const Cfg *Func) const { |
534 if (BuildDefs::dump()) | 528 if (BuildDefs::dump()) |
535 Func->getTarget()->emitVariable(this); | 529 Func->getTarget()->emitVariable(this); |
536 } | 530 } |
537 | 531 |
538 void Variable::dump(const Cfg *Func, Ostream &Str) const { | 532 void Variable::dump(const Cfg *Func, Ostream &Str) const { |
539 if (!BuildDefs::dump()) | 533 if (!BuildDefs::dump()) |
540 return; | 534 return; |
541 if (Func == nullptr) { | 535 if (Func == nullptr) { |
542 Str << "%" << getName(Func); | 536 Str << "%" << getName(); |
543 return; | 537 return; |
544 } | 538 } |
545 if (Func->isVerbose(IceV_RegOrigins) || | 539 if (Func->isVerbose(IceV_RegOrigins) || |
546 (!hasReg() && !Func->getTarget()->hasComputedFrame())) | 540 (!hasReg() && !Func->getTarget()->hasComputedFrame())) |
547 Str << "%" << getName(Func); | 541 Str << "%" << getName(); |
548 if (hasReg()) { | 542 if (hasReg()) { |
549 if (Func->isVerbose(IceV_RegOrigins)) | 543 if (Func->isVerbose(IceV_RegOrigins)) |
550 Str << ":"; | 544 Str << ":"; |
551 Str << Func->getTarget()->getRegName(RegNum, getType()); | 545 Str << Func->getTarget()->getRegName(RegNum, getType()); |
552 } else if (Func->getTarget()->hasComputedFrame()) { | 546 } else if (Func->getTarget()->hasComputedFrame()) { |
553 if (Func->isVerbose(IceV_RegOrigins)) | 547 if (Func->isVerbose(IceV_RegOrigins)) |
554 Str << ":"; | 548 Str << ":"; |
555 const auto BaseRegisterNumber = | 549 const auto BaseRegisterNumber = |
556 hasReg() ? getBaseRegNum() : Func->getTarget()->getFrameOrStackReg(); | 550 hasReg() ? getBaseRegNum() : Func->getTarget()->getFrameOrStackReg(); |
557 Str << "[" | 551 Str << "[" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 if (getType() != IceType_i32 && getType() != IceType_i16 && | 643 if (getType() != IceType_i32 && getType() != IceType_i16 && |
650 getType() != IceType_i8) | 644 getType() != IceType_i8) |
651 return false; | 645 return false; |
652 // The Following checks if the signed representation of Value is between | 646 // The Following checks if the signed representation of Value is between |
653 // -Threshold/2 and +Threshold/2 | 647 // -Threshold/2 and +Threshold/2 |
654 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; | 648 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; |
655 return largerThanThreshold; | 649 return largerThanThreshold; |
656 } | 650 } |
657 | 651 |
658 } // end of namespace Ice | 652 } // end of namespace Ice |
OLD | NEW |