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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 template <> const char *InstMIPS32Slt::Opcode = "slt"; | 73 template <> const char *InstMIPS32Slt::Opcode = "slt"; |
74 template <> const char *InstMIPS32Slti::Opcode = "slti"; | 74 template <> const char *InstMIPS32Slti::Opcode = "slti"; |
75 template <> const char *InstMIPS32Sltiu::Opcode = "sltiu"; | 75 template <> const char *InstMIPS32Sltiu::Opcode = "sltiu"; |
76 template <> const char *InstMIPS32Sltu::Opcode = "sltu"; | 76 template <> const char *InstMIPS32Sltu::Opcode = "sltu"; |
77 template <> const char *InstMIPS32Sra::Opcode = "sra"; | 77 template <> const char *InstMIPS32Sra::Opcode = "sra"; |
78 template <> const char *InstMIPS32Srav::Opcode = "srav"; | 78 template <> const char *InstMIPS32Srav::Opcode = "srav"; |
79 template <> const char *InstMIPS32Srl::Opcode = "srl"; | 79 template <> const char *InstMIPS32Srl::Opcode = "srl"; |
80 template <> const char *InstMIPS32Srlv::Opcode = "srlv"; | 80 template <> const char *InstMIPS32Srlv::Opcode = "srlv"; |
81 template <> const char *InstMIPS32Sub::Opcode = "sub"; | 81 template <> const char *InstMIPS32Sub::Opcode = "sub"; |
82 template <> const char *InstMIPS32Subu::Opcode = "subu"; | 82 template <> const char *InstMIPS32Subu::Opcode = "subu"; |
| 83 template <> const char *InstMIPS32Sw::Opcode = "sw"; |
83 template <> const char *InstMIPS32Xor::Opcode = "xor"; | 84 template <> const char *InstMIPS32Xor::Opcode = "xor"; |
84 template <> const char *InstMIPS32Xori::Opcode = "xori"; | 85 template <> const char *InstMIPS32Xori::Opcode = "xori"; |
85 | 86 |
86 template <> void InstMIPS32Mflo::emit(const Cfg *Func) const { | 87 template <> void InstMIPS32Mflo::emit(const Cfg *Func) const { |
87 if (!BuildDefs::dump()) | 88 if (!BuildDefs::dump()) |
88 return; | 89 return; |
89 emitUnaryopGPRFLoHi(Opcode, this, Func); | 90 emitUnaryopGPRFLoHi(Opcode, this, Func); |
90 } | 91 } |
91 | 92 |
92 template <> void InstMIPS32Mfhi::emit(const Cfg *Func) const { | 93 template <> void InstMIPS32Mfhi::emit(const Cfg *Func) const { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (!BuildDefs::dump()) | 197 if (!BuildDefs::dump()) |
197 return; | 198 return; |
198 Ostream &Str = Func->getContext()->getStrDump(); | 199 Ostream &Str = Func->getContext()->getStrDump(); |
199 Str << "[MIPS32] "; | 200 Str << "[MIPS32] "; |
200 Inst::dump(Func); | 201 Inst::dump(Func); |
201 } | 202 } |
202 | 203 |
203 void OperandMIPS32Mem::emit(const Cfg *Func) const { | 204 void OperandMIPS32Mem::emit(const Cfg *Func) const { |
204 if (!BuildDefs::dump()) | 205 if (!BuildDefs::dump()) |
205 return; | 206 return; |
206 llvm_unreachable("Not yet implemented"); | 207 Ostream &Str = Func->getContext()->getStrEmit(); |
207 (void)Func; | 208 ConstantInteger32 *Offset = getOffset(); |
| 209 Offset->emit(Func); |
| 210 Str << "("; |
| 211 getBase()->emit(Func); |
| 212 Str << ")"; |
208 } | 213 } |
209 | 214 |
210 void InstMIPS32::emitUnaryopGPR(const char *Opcode, const InstMIPS32 *Inst, | 215 void InstMIPS32::emitUnaryopGPR(const char *Opcode, const InstMIPS32 *Inst, |
211 const Cfg *Func) { | 216 const Cfg *Func) { |
212 if (!BuildDefs::dump()) | 217 if (!BuildDefs::dump()) |
213 return; | 218 return; |
214 Ostream &Str = Func->getContext()->getStrEmit(); | 219 Ostream &Str = Func->getContext()->getStrEmit(); |
215 Str << "\t" << Opcode << "\t"; | 220 Str << "\t" << Opcode << "\t"; |
216 Inst->getDest()->emit(Func); | 221 Inst->getDest()->emit(Func); |
217 Str << ", "; | 222 Str << ", "; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 465 } |
461 | 466 |
462 Str << "\t"; | 467 Str << "\t"; |
463 getDest()->emit(Func); | 468 getDest()->emit(Func); |
464 Str << ", "; | 469 Str << ", "; |
465 getSrc(0)->emit(Func); | 470 getSrc(0)->emit(Func); |
466 } | 471 } |
467 | 472 |
468 } // end of namespace MIPS32 | 473 } // end of namespace MIPS32 |
469 } // end of namespace Ice | 474 } // end of namespace Ice |
OLD | NEW |