| 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 |
| 11 /// \brief Implements the Inst class, primarily the various subclass | 11 /// \brief Implements the Inst class, primarily the various subclass |
| 12 /// constructors and dump routines. | 12 /// constructors and dump routines. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceInst.h" | 16 #include "IceInst.h" |
| 17 | 17 |
| 18 #include "IceCfg.h" | 18 #include "IceCfg.h" |
| 19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 20 #include "IceInstVarIter.h" | 20 #include "IceInstVarIter.h" |
| 21 #include "IceLiveness.h" | 21 #include "IceLiveness.h" |
| 22 #include "IceOperand.h" | 22 #include "IceOperand.h" |
| 23 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
| 24 | 24 |
| 25 #include "llvm/Support/Format.h" |
| 26 |
| 25 namespace Ice { | 27 namespace Ice { |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 // Using non-anonymous struct so that array_lengthof works. | 31 // Using non-anonymous struct so that array_lengthof works. |
| 30 const struct InstArithmeticAttributes_ { | 32 const struct InstArithmeticAttributes_ { |
| 31 const char *DisplayString; | 33 const char *DisplayString; |
| 32 bool IsCommutative; | 34 bool IsCommutative; |
| 33 } InstArithmeticAttributes[] = { | 35 } InstArithmeticAttributes[] = { |
| 34 #define X(tag, str, commutative) \ | 36 #define X(tag, str, commutative) \ |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 621 |
| 620 // ======================== Dump routines ======================== // | 622 // ======================== Dump routines ======================== // |
| 621 | 623 |
| 622 void Inst::dumpDecorated(const Cfg *Func) const { | 624 void Inst::dumpDecorated(const Cfg *Func) const { |
| 623 if (!BuildDefs::dump()) | 625 if (!BuildDefs::dump()) |
| 624 return; | 626 return; |
| 625 Ostream &Str = Func->getContext()->getStrDump(); | 627 Ostream &Str = Func->getContext()->getStrDump(); |
| 626 if (!Func->isVerbose(IceV_Deleted) && (isDeleted() || isRedundantAssign())) | 628 if (!Func->isVerbose(IceV_Deleted) && (isDeleted() || isRedundantAssign())) |
| 627 return; | 629 return; |
| 628 if (Func->isVerbose(IceV_InstNumbers)) { | 630 if (Func->isVerbose(IceV_InstNumbers)) { |
| 629 char buf[30]; | |
| 630 InstNumberT Number = getNumber(); | 631 InstNumberT Number = getNumber(); |
| 631 if (Number == NumberDeleted) | 632 if (Number == NumberDeleted) |
| 632 snprintf(buf, llvm::array_lengthof(buf), "[XXX]"); | 633 Str << "[XXX]"; |
| 633 else | 634 else |
| 634 snprintf(buf, llvm::array_lengthof(buf), "[%3d]", Number); | 635 Str << llvm::format("[%3d]", Number); |
| 635 Str << buf; | |
| 636 } | 636 } |
| 637 Str << " "; | 637 Str << " "; |
| 638 if (isDeleted()) | 638 if (isDeleted()) |
| 639 Str << " //"; | 639 Str << " //"; |
| 640 dump(Func); | 640 dump(Func); |
| 641 dumpExtras(Func); | 641 dumpExtras(Func); |
| 642 Str << "\n"; | 642 Str << "\n"; |
| 643 } | 643 } |
| 644 | 644 |
| 645 void Inst::dump(const Cfg *Func) const { | 645 void Inst::dump(const Cfg *Func) const { |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 // upper 32 bits of rax. We need to recognize and preserve these. | 1056 // upper 32 bits of rax. We need to recognize and preserve these. |
| 1057 return true; | 1057 return true; |
| 1058 } | 1058 } |
| 1059 if (!Dest->hasReg() && !SrcVar->hasReg() && | 1059 if (!Dest->hasReg() && !SrcVar->hasReg() && |
| 1060 Dest->getStackOffset() == SrcVar->getStackOffset()) | 1060 Dest->getStackOffset() == SrcVar->getStackOffset()) |
| 1061 return true; | 1061 return true; |
| 1062 return false; | 1062 return false; |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 } // end of namespace Ice | 1065 } // end of namespace Ice |
| OLD | NEW |