Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/IceInstMIPS32.cpp

Issue 1176133004: implement the null function for the Mips32 subzero compiler (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixing patch per review comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}
+}

Powered by Google App Engine
This is Rietveld 408576698