| OLD | NEW |
| 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===// | 1 //===- subzero/src/IceInstX8632.cpp - X86-32 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 InstX8632 and OperandX8632 classes, | 10 // This file implements the InstX8632 and OperandX8632 classes, |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 X8632::Address StackAddr(static_cast<TargetX8632 *>(Func->getTarget()) | 882 X8632::Address StackAddr(static_cast<TargetX8632 *>(Func->getTarget()) |
| 883 ->stackVarToAsmOperand(Dest)); | 883 ->stackVarToAsmOperand(Dest)); |
| 884 // Src must be a register in this case. | 884 // Src must be a register in this case. |
| 885 const auto SrcVar = llvm::cast<Variable>(Src); | 885 const auto SrcVar = llvm::cast<Variable>(Src); |
| 886 assert(SrcVar->hasReg()); | 886 assert(SrcVar->hasReg()); |
| 887 (Asm->*(Emitter.AddrXmm))(StackAddr, | 887 (Asm->*(Emitter.AddrXmm))(StackAddr, |
| 888 RegX8632::getEncodedXmm(SrcVar->getRegNum())); | 888 RegX8632::getEncodedXmm(SrcVar->getRegNum())); |
| 889 } | 889 } |
| 890 } | 890 } |
| 891 | 891 |
| 892 bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) { | |
| 893 const auto SrcVar = llvm::dyn_cast<const Variable>(Source); | |
| 894 if (!SrcVar) | |
| 895 return false; | |
| 896 if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) { | |
| 897 // TODO: On x86-64, instructions like "mov eax, eax" are used to | |
| 898 // clear the upper 32 bits of rax. We need to recognize and | |
| 899 // preserve these. | |
| 900 return true; | |
| 901 } | |
| 902 if (!Dest->hasReg() && !SrcVar->hasReg() && | |
| 903 Dest->getStackOffset() == SrcVar->getStackOffset()) | |
| 904 return true; | |
| 905 return false; | |
| 906 } | |
| 907 | |
| 908 // In-place ops | 892 // In-place ops |
| 909 template <> const char *InstX8632Bswap::Opcode = "bswap"; | 893 template <> const char *InstX8632Bswap::Opcode = "bswap"; |
| 910 template <> const char *InstX8632Neg::Opcode = "neg"; | 894 template <> const char *InstX8632Neg::Opcode = "neg"; |
| 911 // Unary ops | 895 // Unary ops |
| 912 template <> const char *InstX8632Bsf::Opcode = "bsf"; | 896 template <> const char *InstX8632Bsf::Opcode = "bsf"; |
| 913 template <> const char *InstX8632Bsr::Opcode = "bsr"; | 897 template <> const char *InstX8632Bsr::Opcode = "bsr"; |
| 914 template <> const char *InstX8632Lea::Opcode = "lea"; | 898 template <> const char *InstX8632Lea::Opcode = "lea"; |
| 915 template <> const char *InstX8632Movd::Opcode = "movd"; | 899 template <> const char *InstX8632Movd::Opcode = "movd"; |
| 916 template <> const char *InstX8632Movsx::Opcode = "movs"; | 900 template <> const char *InstX8632Movsx::Opcode = "movs"; |
| 917 template <> const char *InstX8632Movzx::Opcode = "movz"; | 901 template <> const char *InstX8632Movzx::Opcode = "movz"; |
| (...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2999 } | 2983 } |
| 3000 Str << "("; | 2984 Str << "("; |
| 3001 if (Func) | 2985 if (Func) |
| 3002 Var->dump(Func); | 2986 Var->dump(Func); |
| 3003 else | 2987 else |
| 3004 Var->dump(Str); | 2988 Var->dump(Str); |
| 3005 Str << ")"; | 2989 Str << ")"; |
| 3006 } | 2990 } |
| 3007 | 2991 |
| 3008 } // end of namespace Ice | 2992 } // end of namespace Ice |
| OLD | NEW |