Index: src/IceInstMIPS32.h |
diff --git a/src/IceInstMIPS32.h b/src/IceInstMIPS32.h |
index 0c7c2d8cae99afebda8c6b108463073894eeda6d..310c80a5c483b6e5df117578aec09da73bf18d87 100644 |
--- a/src/IceInstMIPS32.h |
+++ b/src/IceInstMIPS32.h |
@@ -17,11 +17,63 @@ |
#define SUBZERO_SRC_ICEINSTMIPS32_H |
#include "IceDefs.h" |
+#include "IceInst.h" |
+#include "IceInstMIPS32.def" |
+#include "IceOperand.h" |
namespace Ice { |
class TargetMIPS32; |
-// Fill this in. |
+// Base class for Mips instructions. |
+class InstMIPS32 : public InstTarget { |
+ InstMIPS32() = delete; |
+ InstMIPS32(const InstMIPS32 &) = delete; |
+ InstMIPS32 &operator=(const InstMIPS32 &) = delete; |
+ |
+public: |
+ enum InstKindMIPS32 { k__Start = Inst::Target, Ret }; |
+ |
+ static const char *getWidthString(Type Ty); |
+ |
+ void dump(const Cfg *Func) const override; |
+ |
+protected: |
+ InstMIPS32(Cfg *Func, InstKindMIPS32 Kind, SizeT Maxsrcs, Variable *Dest) |
+ : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} |
+ ~InstMIPS32() override {} |
+ static bool isClassof(const Inst *Inst, InstKindMIPS32 MyKind) { |
+ return Inst->getKind() == static_cast<InstKind>(MyKind); |
+ } |
+}; |
+ |
+// Ret pseudo-instruction. This is actually a "jr" instruction with |
+// an "ra" register operand, but epilogue lowering will search for a Ret |
+// instead of a generic "jr". This instruction also takes a Source |
+// operand (for non-void returning functions) for liveness analysis, though |
+// a FakeUse before the ret would do just as well. |
+// This needs was take from the ARM port and needs to be scrubbed in the future |
+// (TODO Reed Kotler) |
jvoung (off chromium)
2015/06/12 19:39:12
TODO(reed kotler)
|
+// |
+class InstMIPS32Ret : public InstMIPS32 { |
+ InstMIPS32Ret() = delete; |
+ InstMIPS32Ret(const InstMIPS32Ret &) = delete; |
+ InstMIPS32Ret &operator=(const InstMIPS32Ret &) = delete; |
+ |
+public: |
+ static InstMIPS32Ret *create(Cfg *Func, Variable *LR, |
jvoung (off chromium)
2015/06/12 19:39:13
s/LR/RA/
|
+ Variable *Source = nullptr) { |
+ return new (Func->allocate<InstMIPS32Ret>()) |
+ InstMIPS32Ret(Func, LR, Source); |
+ } |
+ void emit(const Cfg *Func) const override; |
+ void emitIAS(const Cfg *Func) const override; |
+ void dump(const Cfg *Func) const override; |
+ static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } |
+ |
+private: |
+ InstMIPS32Ret(Cfg *Func, Variable *LR, Variable *Source); |
+ ~InstMIPS32Ret() override {} |
+}; |
} // end of namespace Ice |