| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 InstX8632Movsx::InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source) | 249 InstX8632Movsx::InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source) |
| 250 : InstX8632(Func, InstX8632::Movsx, 1, Dest) { | 250 : InstX8632(Func, InstX8632::Movsx, 1, Dest) { |
| 251 addSource(Source); | 251 addSource(Source); |
| 252 } | 252 } |
| 253 | 253 |
| 254 InstX8632Movzx::InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source) | 254 InstX8632Movzx::InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source) |
| 255 : InstX8632(Func, InstX8632::Movzx, 1, Dest) { | 255 : InstX8632(Func, InstX8632::Movzx, 1, Dest) { |
| 256 addSource(Source); | 256 addSource(Source); |
| 257 } | 257 } |
| 258 | 258 |
| 259 InstX8632Nop::InstX8632Nop(Cfg *Func, SizeT Length) |
| 260 : InstX8632(Func, InstX8632::Nop, 0, NULL), Length(Length) {} |
| 261 |
| 259 InstX8632Fld::InstX8632Fld(Cfg *Func, Operand *Src) | 262 InstX8632Fld::InstX8632Fld(Cfg *Func, Operand *Src) |
| 260 : InstX8632(Func, InstX8632::Fld, 1, NULL) { | 263 : InstX8632(Func, InstX8632::Fld, 1, NULL) { |
| 261 addSource(Src); | 264 addSource(Src); |
| 262 } | 265 } |
| 263 | 266 |
| 264 InstX8632Fstp::InstX8632Fstp(Cfg *Func, Variable *Dest) | 267 InstX8632Fstp::InstX8632Fstp(Cfg *Func, Variable *Dest) |
| 265 : InstX8632(Func, InstX8632::Fstp, 0, Dest) {} | 268 : InstX8632(Func, InstX8632::Fstp, 0, Dest) {} |
| 266 | 269 |
| 267 InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest) | 270 InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest) |
| 268 : InstX8632(Func, InstX8632::Pop, 0, Dest) {} | 271 : InstX8632(Func, InstX8632::Pop, 0, Dest) {} |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 | 1119 |
| 1117 void InstX8632Movzx::dump(const Cfg *Func) const { | 1120 void InstX8632Movzx::dump(const Cfg *Func) const { |
| 1118 Ostream &Str = Func->getContext()->getStrDump(); | 1121 Ostream &Str = Func->getContext()->getStrDump(); |
| 1119 Str << "movzx." << getDest()->getType() << "." << getSrc(0)->getType(); | 1122 Str << "movzx." << getDest()->getType() << "." << getSrc(0)->getType(); |
| 1120 Str << " "; | 1123 Str << " "; |
| 1121 dumpDest(Func); | 1124 dumpDest(Func); |
| 1122 Str << ", "; | 1125 Str << ", "; |
| 1123 dumpSources(Func); | 1126 dumpSources(Func); |
| 1124 } | 1127 } |
| 1125 | 1128 |
| 1129 void InstX8632Nop::emit(const Cfg *Func) const { |
| 1130 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1131 assert(Length); |
| 1132 // TODO: When an assembler is used, use the recommended opcodes in the |
| 1133 // Intel manual to emit nop instructions based on the length. |
| 1134 Str << "\tnop\t# length = " << Length << (Length > 1 ? " bytes" : " byte") |
| 1135 << "\n"; |
| 1136 } |
| 1137 |
| 1138 void InstX8632Nop::dump(const Cfg *Func) const { |
| 1139 Ostream &Str = Func->getContext()->getStrDump(); |
| 1140 Str << "nop (length = " << Length << (Length > 1 ? " bytes)" : " byte)"); |
| 1141 } |
| 1142 |
| 1126 void InstX8632Fld::emit(const Cfg *Func) const { | 1143 void InstX8632Fld::emit(const Cfg *Func) const { |
| 1127 Ostream &Str = Func->getContext()->getStrEmit(); | 1144 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1128 assert(getSrcSize() == 1); | 1145 assert(getSrcSize() == 1); |
| 1129 Type Ty = getSrc(0)->getType(); | 1146 Type Ty = getSrc(0)->getType(); |
| 1130 Variable *Var = llvm::dyn_cast<Variable>(getSrc(0)); | 1147 Variable *Var = llvm::dyn_cast<Variable>(getSrc(0)); |
| 1131 if (Var && Var->hasReg()) { | 1148 if (Var && Var->hasReg()) { |
| 1132 // This is a physical xmm register, so we need to spill it to a | 1149 // This is a physical xmm register, so we need to spill it to a |
| 1133 // temporary stack slot. | 1150 // temporary stack slot. |
| 1134 SizeT Width = typeWidthInBytes(Ty); | 1151 SizeT Width = typeWidthInBytes(Ty); |
| 1135 Str << "\tsub\tesp, " << Width << "\n"; | 1152 Str << "\tsub\tesp, " << Width << "\n"; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 default: | 1527 default: |
| 1511 Str << "???"; | 1528 Str << "???"; |
| 1512 break; | 1529 break; |
| 1513 } | 1530 } |
| 1514 Str << "("; | 1531 Str << "("; |
| 1515 Var->dump(Func); | 1532 Var->dump(Func); |
| 1516 Str << ")"; | 1533 Str << ")"; |
| 1517 } | 1534 } |
| 1518 | 1535 |
| 1519 } // end of namespace Ice | 1536 } // end of namespace Ice |
| OLD | NEW |