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 // This file implements the Inst class, primarily the various | 10 // This file implements the Inst class, primarily the various |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 866 } |
867 | 867 |
868 void InstTarget::dump(const Cfg *Func) const { | 868 void InstTarget::dump(const Cfg *Func) const { |
869 if (!ALLOW_DUMP) | 869 if (!ALLOW_DUMP) |
870 return; | 870 return; |
871 Ostream &Str = Func->getContext()->getStrDump(); | 871 Ostream &Str = Func->getContext()->getStrDump(); |
872 Str << "[TARGET] "; | 872 Str << "[TARGET] "; |
873 Inst::dump(Func); | 873 Inst::dump(Func); |
874 } | 874 } |
875 | 875 |
| 876 bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) { |
| 877 const auto SrcVar = llvm::dyn_cast<const Variable>(Source); |
| 878 if (!SrcVar) |
| 879 return false; |
| 880 if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) { |
| 881 // TODO: On x86-64, instructions like "mov eax, eax" are used to |
| 882 // clear the upper 32 bits of rax. We need to recognize and |
| 883 // preserve these. |
| 884 return true; |
| 885 } |
| 886 if (!Dest->hasReg() && !SrcVar->hasReg() && |
| 887 Dest->getStackOffset() == SrcVar->getStackOffset()) |
| 888 return true; |
| 889 return false; |
| 890 } |
| 891 |
876 } // end of namespace Ice | 892 } // end of namespace Ice |
OLD | NEW |