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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 InstX8632Movsx::InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source) | 234 InstX8632Movsx::InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source) |
235 : InstX8632(Func, InstX8632::Movsx, 1, Dest) { | 235 : InstX8632(Func, InstX8632::Movsx, 1, Dest) { |
236 addSource(Source); | 236 addSource(Source); |
237 } | 237 } |
238 | 238 |
239 InstX8632Movzx::InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source) | 239 InstX8632Movzx::InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source) |
240 : InstX8632(Func, InstX8632::Movzx, 1, Dest) { | 240 : InstX8632(Func, InstX8632::Movzx, 1, Dest) { |
241 addSource(Source); | 241 addSource(Source); |
242 } | 242 } |
243 | 243 |
| 244 InstX8632Nop::InstX8632Nop(Cfg *Func, InstX8632Nop::NopVariant Variant) |
| 245 : InstX8632(Func, InstX8632::Nop, 0, NULL), Variant(Variant) {} |
| 246 |
244 InstX8632Fld::InstX8632Fld(Cfg *Func, Operand *Src) | 247 InstX8632Fld::InstX8632Fld(Cfg *Func, Operand *Src) |
245 : InstX8632(Func, InstX8632::Fld, 1, NULL) { | 248 : InstX8632(Func, InstX8632::Fld, 1, NULL) { |
246 addSource(Src); | 249 addSource(Src); |
247 } | 250 } |
248 | 251 |
249 InstX8632Fstp::InstX8632Fstp(Cfg *Func, Variable *Dest) | 252 InstX8632Fstp::InstX8632Fstp(Cfg *Func, Variable *Dest) |
250 : InstX8632(Func, InstX8632::Fstp, 0, Dest) {} | 253 : InstX8632(Func, InstX8632::Fstp, 0, Dest) {} |
251 | 254 |
252 InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest) | 255 InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest) |
253 : InstX8632(Func, InstX8632::Pop, 0, Dest) {} | 256 : InstX8632(Func, InstX8632::Pop, 0, Dest) {} |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 | 1054 |
1052 void InstX8632Movzx::dump(const Cfg *Func) const { | 1055 void InstX8632Movzx::dump(const Cfg *Func) const { |
1053 Ostream &Str = Func->getContext()->getStrDump(); | 1056 Ostream &Str = Func->getContext()->getStrDump(); |
1054 Str << "movzx." << getDest()->getType() << "." << getSrc(0)->getType(); | 1057 Str << "movzx." << getDest()->getType() << "." << getSrc(0)->getType(); |
1055 Str << " "; | 1058 Str << " "; |
1056 dumpDest(Func); | 1059 dumpDest(Func); |
1057 Str << ", "; | 1060 Str << ", "; |
1058 dumpSources(Func); | 1061 dumpSources(Func); |
1059 } | 1062 } |
1060 | 1063 |
| 1064 void InstX8632Nop::emit(const Cfg *Func) const { |
| 1065 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1066 // TODO: Emit the right code for each variant. |
| 1067 Str << "\tnop\t# variant = " << Variant << "\n"; |
| 1068 } |
| 1069 |
| 1070 void InstX8632Nop::dump(const Cfg *Func) const { |
| 1071 Ostream &Str = Func->getContext()->getStrDump(); |
| 1072 Str << "nop (variant = " << Variant << ")"; |
| 1073 } |
| 1074 |
1061 void InstX8632Fld::emit(const Cfg *Func) const { | 1075 void InstX8632Fld::emit(const Cfg *Func) const { |
1062 Ostream &Str = Func->getContext()->getStrEmit(); | 1076 Ostream &Str = Func->getContext()->getStrEmit(); |
1063 assert(getSrcSize() == 1); | 1077 assert(getSrcSize() == 1); |
1064 Type Ty = getSrc(0)->getType(); | 1078 Type Ty = getSrc(0)->getType(); |
1065 Variable *Var = llvm::dyn_cast<Variable>(getSrc(0)); | 1079 Variable *Var = llvm::dyn_cast<Variable>(getSrc(0)); |
1066 if (Var && Var->hasReg()) { | 1080 if (Var && Var->hasReg()) { |
1067 // This is a physical xmm register, so we need to spill it to a | 1081 // This is a physical xmm register, so we need to spill it to a |
1068 // temporary stack slot. | 1082 // temporary stack slot. |
1069 SizeT Width = typeWidthInBytes(Ty); | 1083 SizeT Width = typeWidthInBytes(Ty); |
1070 Str << "\tsub\tesp, " << Width << "\n"; | 1084 Str << "\tsub\tesp, " << Width << "\n"; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 default: | 1459 default: |
1446 Str << "???"; | 1460 Str << "???"; |
1447 break; | 1461 break; |
1448 } | 1462 } |
1449 Str << "("; | 1463 Str << "("; |
1450 Var->dump(Func); | 1464 Var->dump(Func); |
1451 Str << ")"; | 1465 Str << ")"; |
1452 } | 1466 } |
1453 | 1467 |
1454 } // end of namespace Ice | 1468 } // end of namespace Ice |
OLD | NEW |