OLD | NEW |
1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// | 1 //===- subzero/src/IceInst.cpp - High-level instruction 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 IceString InstArithmetic::getInstName() const { | 275 IceString InstArithmetic::getInstName() const { |
276 if (!BuildDefs::dump()) | 276 if (!BuildDefs::dump()) |
277 return "???"; | 277 return "???"; |
278 | 278 |
279 return InstArithmeticAttributes[getOp()].DisplayString; | 279 return InstArithmeticAttributes[getOp()].DisplayString; |
280 } | 280 } |
281 | 281 |
282 const char *InstArithmetic::getOpName(OpKind Op) { | 282 const char *InstArithmetic::getOpName(OpKind Op) { |
283 size_t OpIndex = static_cast<size_t>(Op); | 283 return Op < InstArithmetic::_num ? InstArithmeticAttributes[Op].DisplayString |
284 return OpIndex < InstArithmetic::_num | 284 : "???"; |
285 ? InstArithmeticAttributes[OpIndex].DisplayString | |
286 : "???"; | |
287 } | 285 } |
288 | 286 |
289 bool InstArithmetic::isCommutative() const { | 287 bool InstArithmetic::isCommutative() const { |
290 return InstArithmeticAttributes[getOp()].IsCommutative; | 288 return InstArithmeticAttributes[getOp()].IsCommutative; |
291 } | 289 } |
292 | 290 |
293 InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source) | 291 InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source) |
294 : InstHighLevel(Func, Inst::Assign, 1, Dest) { | 292 : InstHighLevel(Func, Inst::Assign, 1, Dest) { |
295 addSource(Source); | 293 addSource(Source); |
296 } | 294 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 for (SizeT I = 0; I < getNumArgs(); ++I) { | 720 for (SizeT I = 0; I < getNumArgs(); ++I) { |
723 if (I > 0) | 721 if (I > 0) |
724 Str << ", "; | 722 Str << ", "; |
725 Str << getArg(I)->getType() << " "; | 723 Str << getArg(I)->getType() << " "; |
726 getArg(I)->dump(Func); | 724 getArg(I)->dump(Func); |
727 } | 725 } |
728 Str << ")"; | 726 Str << ")"; |
729 } | 727 } |
730 | 728 |
731 const char *InstCast::getCastName(InstCast::OpKind Kind) { | 729 const char *InstCast::getCastName(InstCast::OpKind Kind) { |
732 size_t Index = static_cast<size_t>(Kind); | 730 if (Kind < InstCast::OpKind::_num) |
733 if (Index < InstCast::OpKind::_num) | 731 return InstCastAttributes[Kind].DisplayString; |
734 return InstCastAttributes[Index].DisplayString; | |
735 llvm_unreachable("Invalid InstCast::OpKind"); | 732 llvm_unreachable("Invalid InstCast::OpKind"); |
736 return "???"; | 733 return "???"; |
737 } | 734 } |
738 | 735 |
739 void InstCast::dump(const Cfg *Func) const { | 736 void InstCast::dump(const Cfg *Func) const { |
740 if (!BuildDefs::dump()) | 737 if (!BuildDefs::dump()) |
741 return; | 738 return; |
742 Ostream &Str = Func->getContext()->getStrDump(); | 739 Ostream &Str = Func->getContext()->getStrDump(); |
743 dumpDest(Func); | 740 dumpDest(Func); |
744 Str << " = " << getCastName(getCastKind()) << " " << getSrc(0)->getType() | 741 Str << " = " << getCastName(getCastKind()) << " " << getSrc(0)->getType() |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 // upper 32 bits of rax. We need to recognize and preserve these. | 1009 // upper 32 bits of rax. We need to recognize and preserve these. |
1013 return true; | 1010 return true; |
1014 } | 1011 } |
1015 if (!Dest->hasReg() && !SrcVar->hasReg() && | 1012 if (!Dest->hasReg() && !SrcVar->hasReg() && |
1016 Dest->getStackOffset() == SrcVar->getStackOffset()) | 1013 Dest->getStackOffset() == SrcVar->getStackOffset()) |
1017 return true; | 1014 return true; |
1018 return false; | 1015 return false; |
1019 } | 1016 } |
1020 | 1017 |
1021 } // end of namespace Ice | 1018 } // end of namespace Ice |
OLD | NEW |