| 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 |
| 11 /// This file implements the InstMips32 and OperandMips32 classes, | 11 /// This file implements the InstMips32 and OperandMips32 classes, |
| 12 /// primarily the constructors and the dump()/emit() methods. | 12 /// primarily the constructors and the dump()/emit() methods. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceAssemblerMIPS32.h" | 16 #include "IceAssemblerMIPS32.h" |
| 17 #include "IceCfg.h" | 17 #include "IceCfg.h" |
| 18 #include "IceCfgNode.h" | 18 #include "IceCfgNode.h" |
| 19 #include "IceInst.h" | 19 #include "IceInst.h" |
| 20 #include "IceInstMIPS32.h" | 20 #include "IceInstMIPS32.h" |
| 21 #include "IceOperand.h" | 21 #include "IceOperand.h" |
| 22 #include "IceRegistersMIPS32.h" | 22 #include "IceRegistersMIPS32.h" |
| 23 #include "IceTargetLoweringMIPS32.h" | 23 #include "IceTargetLoweringMIPS32.h" |
| 24 | 24 |
| 25 namespace Ice { | 25 namespace Ice { |
| 26 | 26 |
| 27 const char *InstMIPS32::getWidthString(Type Ty) { |
| 28 (void)Ty; |
| 29 return "TBD"; |
| 30 } |
| 27 | 31 |
| 28 InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source) | 32 InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source) |
| 29 : InstMIPS32(Func, InstMIPS32::Ret, Source ? 2 : 1, nullptr) { | 33 : InstMIPS32(Func, InstMIPS32::Ret, Source ? 2 : 1, nullptr) { |
| 30 addSource(RA); | 34 addSource(RA); |
| 31 if (Source) | 35 if (Source) |
| 32 addSource(Source); | 36 addSource(Source); |
| 33 } | 37 } |
| 34 | 38 |
| 39 // ======================== Dump routines ======================== // |
| 40 |
| 41 void InstMIPS32::dump(const Cfg *Func) const { |
| 42 if (!BuildDefs::dump()) |
| 43 return; |
| 44 Ostream &Str = Func->getContext()->getStrDump(); |
| 45 Str << "[MIPS32] "; |
| 46 Inst::dump(Func); |
| 47 } |
| 48 |
| 35 void InstMIPS32Ret::emit(const Cfg *Func) const { | 49 void InstMIPS32Ret::emit(const Cfg *Func) const { |
| 36 if (!ALLOW_DUMP) | 50 if (!BuildDefs::dump()) |
| 37 return; | 51 return; |
| 38 assert(getSrcSize() > 0); | 52 assert(getSrcSize() > 0); |
| 39 Variable *RA = llvm::cast<Variable>(getSrc(0)); | 53 Variable *RA = llvm::cast<Variable>(getSrc(0)); |
| 40 assert(RA->hasReg()); | 54 assert(RA->hasReg()); |
| 41 assert(RA->getRegNum() == RegMIPS32::Reg_RA); | 55 assert(RA->getRegNum() == RegMIPS32::Reg_RA); |
| 42 Ostream &Str = Func->getContext()->getStrEmit(); | 56 Ostream &Str = Func->getContext()->getStrEmit(); |
| 43 Str << "\t" | 57 Str << "\t" |
| 44 << "jr $ra" | 58 << "jr $ra" |
| 45 << "\t"; | 59 << "\t"; |
| 46 RA->emit(Func); | 60 RA->emit(Func); |
| 47 } | 61 } |
| 48 | 62 |
| 49 void InstMIPS32Ret::emitIAS(const Cfg *Func) const { | 63 void InstMIPS32Ret::emitIAS(const Cfg *Func) const { |
| 50 (void)Func; | 64 (void)Func; |
| 51 llvm_unreachable("Not yet implemented"); | 65 llvm_unreachable("Not yet implemented"); |
| 52 } | 66 } |
| 53 | 67 |
| 54 void InstMIPS32Ret::dump(const Cfg *Func) const { | 68 void InstMIPS32Ret::dump(const Cfg *Func) const { |
| 55 if (!ALLOW_DUMP) | 69 if (!BuildDefs::dump()) |
| 56 return; | 70 return; |
| 57 Ostream &Str = Func->getContext()->getStrDump(); | 71 Ostream &Str = Func->getContext()->getStrDump(); |
| 58 Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType()); | 72 Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType()); |
| 59 Str << "ret." << Ty << " "; | 73 Str << "ret." << Ty << " "; |
| 60 dumpSources(Func); | 74 dumpSources(Func); |
| 61 } | 75 } |
| 62 } | 76 } |
| OLD | NEW |