Index: src/IceInstMIPS32.cpp |
diff --git a/src/IceInstMIPS32.cpp b/src/IceInstMIPS32.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..82f56bee5684df380b08efe63e0459e7a3a61e98 |
--- /dev/null |
+++ b/src/IceInstMIPS32.cpp |
@@ -0,0 +1,62 @@ |
+//===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation ----===// |
+// |
+// The Subzero Code Generator |
+// |
+// This file is distributed under the University of Illinois Open Source |
+// License. See LICENSE.TXT for details. |
+// |
+//===----------------------------------------------------------------------===// |
+// |
+/// \file |
+/// This file implements the InstMips32 and OperandMips32 classes, |
+/// primarily the constructors and the dump()/emit() methods. |
+/// |
+//===----------------------------------------------------------------------===// |
+ |
+#include "IceAssemblerMIPS32.h" |
+#include "IceCfg.h" |
+#include "IceCfgNode.h" |
+#include "IceInst.h" |
+#include "IceInstMIPS32.h" |
+#include "IceOperand.h" |
+#include "IceRegistersMIPS32.h" |
+#include "IceTargetLoweringMIPS32.h" |
+ |
+namespace Ice { |
+ |
+ |
+InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source) |
+ : InstMIPS32(Func, InstMIPS32::Ret, Source ? 2 : 1, nullptr) { |
+ addSource(RA); |
+ if (Source) |
+ addSource(Source); |
+} |
+ |
+void InstMIPS32Ret::emit(const Cfg *Func) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ assert(getSrcSize() > 0); |
+ Variable *RA = llvm::cast<Variable>(getSrc(0)); |
+ assert(RA->hasReg()); |
+ assert(RA->getRegNum() == RegMIPS32::Reg_RA); |
+ Ostream &Str = Func->getContext()->getStrEmit(); |
+ Str << "\t" |
+ << "jr $ra" |
+ << "\t"; |
+ RA->emit(Func); |
+} |
+ |
+void InstMIPS32Ret::emitIAS(const Cfg *Func) const { |
+ (void)Func; |
+ llvm_unreachable("Not yet implemented"); |
+} |
+ |
+void InstMIPS32Ret::dump(const Cfg *Func) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ Ostream &Str = Func->getContext()->getStrDump(); |
+ Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType()); |
+ Str << "ret." << Ty << " "; |
+ dumpSources(Func); |
+} |
+} |