OLD | NEW |
1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// | 1 //===- subzero/src/IceInstMips32.cpp - Mips32 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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 template <> const char *InstMIPS32Addiu::Opcode = "addiu"; | 52 template <> const char *InstMIPS32Addiu::Opcode = "addiu"; |
53 template <> const char *InstMIPS32Lui::Opcode = "lui"; | 53 template <> const char *InstMIPS32Lui::Opcode = "lui"; |
54 template <> const char *InstMIPS32La::Opcode = "la"; | 54 template <> const char *InstMIPS32La::Opcode = "la"; |
55 // Three-addr ops | 55 // Three-addr ops |
56 template <> const char *InstMIPS32Add::Opcode = "add"; | 56 template <> const char *InstMIPS32Add::Opcode = "add"; |
57 template <> const char *InstMIPS32Addu::Opcode = "addu"; | 57 template <> const char *InstMIPS32Addu::Opcode = "addu"; |
58 template <> const char *InstMIPS32And::Opcode = "and"; | 58 template <> const char *InstMIPS32And::Opcode = "and"; |
59 template <> const char *InstMIPS32Andi::Opcode = "andi"; | 59 template <> const char *InstMIPS32Andi::Opcode = "andi"; |
| 60 template <> const char *InstMIPS32Mfc1::Opcode = "mfc1"; |
60 template <> const char *InstMIPS32Mfhi::Opcode = "mfhi"; | 61 template <> const char *InstMIPS32Mfhi::Opcode = "mfhi"; |
61 template <> const char *InstMIPS32Mflo::Opcode = "mflo"; | 62 template <> const char *InstMIPS32Mflo::Opcode = "mflo"; |
| 63 template <> const char *InstMIPS32Mtc1::Opcode = "mtc1"; |
62 template <> const char *InstMIPS32Mthi::Opcode = "mthi"; | 64 template <> const char *InstMIPS32Mthi::Opcode = "mthi"; |
63 template <> const char *InstMIPS32Mtlo::Opcode = "mtlo"; | 65 template <> const char *InstMIPS32Mtlo::Opcode = "mtlo"; |
64 template <> const char *InstMIPS32Mul::Opcode = "mul"; | 66 template <> const char *InstMIPS32Mul::Opcode = "mul"; |
65 template <> const char *InstMIPS32Mult::Opcode = "mult"; | 67 template <> const char *InstMIPS32Mult::Opcode = "mult"; |
66 template <> const char *InstMIPS32Multu::Opcode = "multu"; | 68 template <> const char *InstMIPS32Multu::Opcode = "multu"; |
67 template <> const char *InstMIPS32Or::Opcode = "or"; | 69 template <> const char *InstMIPS32Or::Opcode = "or"; |
68 template <> const char *InstMIPS32Ori::Opcode = "ori"; | 70 template <> const char *InstMIPS32Ori::Opcode = "ori"; |
69 template <> const char *InstMIPS32Sll::Opcode = "sll"; | 71 template <> const char *InstMIPS32Sll::Opcode = "sll"; |
70 template <> const char *InstMIPS32Sllv::Opcode = "sllv"; | 72 template <> const char *InstMIPS32Sllv::Opcode = "sllv"; |
71 template <> const char *InstMIPS32Slt::Opcode = "slt"; | 73 template <> const char *InstMIPS32Slt::Opcode = "slt"; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 Ostream &Str = Func->getContext()->getStrEmit(); | 242 Ostream &Str = Func->getContext()->getStrEmit(); |
241 assert(Inst->getSrcSize() == 2); | 243 assert(Inst->getSrcSize() == 2); |
242 Str << "\t" << Opcode << "\t"; | 244 Str << "\t" << Opcode << "\t"; |
243 Inst->getDest()->emit(Func); | 245 Inst->getDest()->emit(Func); |
244 Str << ", "; | 246 Str << ", "; |
245 Inst->getSrc(0)->emit(Func); | 247 Inst->getSrc(0)->emit(Func); |
246 Str << ", "; | 248 Str << ", "; |
247 Inst->getSrc(1)->emit(Func); | 249 Inst->getSrc(1)->emit(Func); |
248 } | 250 } |
249 | 251 |
| 252 void InstMIPS32::emitTwoAddr(const char *Opcode, const InstMIPS32 *Inst, |
| 253 const Cfg *Func) { |
| 254 if (!BuildDefs::dump()) |
| 255 return; |
| 256 Ostream &Str = Func->getContext()->getStrEmit(); |
| 257 assert(Inst->getSrcSize() == 1); |
| 258 Str << "\t" << Opcode << "\t"; |
| 259 Inst->getDest()->emit(Func); |
| 260 Str << ", "; |
| 261 Inst->getSrc(0)->emit(Func); |
| 262 } |
| 263 |
250 void InstMIPS32::emitThreeAddrLoHi(const char *Opcode, const InstMIPS32 *Inst, | 264 void InstMIPS32::emitThreeAddrLoHi(const char *Opcode, const InstMIPS32 *Inst, |
251 const Cfg *Func) { | 265 const Cfg *Func) { |
252 if (!BuildDefs::dump()) | 266 if (!BuildDefs::dump()) |
253 return; | 267 return; |
254 Ostream &Str = Func->getContext()->getStrEmit(); | 268 Ostream &Str = Func->getContext()->getStrEmit(); |
255 assert(Inst->getSrcSize() == 2); | 269 assert(Inst->getSrcSize() == 2); |
256 Str << "\t" << Opcode << "\t"; | 270 Str << "\t" << Opcode << "\t"; |
257 Inst->getSrc(0)->emit(Func); | 271 Inst->getSrc(0)->emit(Func); |
258 Str << ", "; | 272 Str << ", "; |
259 Inst->getSrc(1)->emit(Func); | 273 Inst->getSrc(1)->emit(Func); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 472 } |
459 | 473 |
460 Str << "\t"; | 474 Str << "\t"; |
461 getDest()->emit(Func); | 475 getDest()->emit(Func); |
462 Str << ", "; | 476 Str << ", "; |
463 getSrc(0)->emit(Func); | 477 getSrc(0)->emit(Func); |
464 } | 478 } |
465 | 479 |
466 } // end of namespace MIPS32 | 480 } // end of namespace MIPS32 |
467 } // end of namespace Ice | 481 } // end of namespace Ice |
OLD | NEW |