Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceInstMIPS32.h - MIPS32 machine instrs --*- C++ -*-=== // | 1 //===- subzero/src/IceInstMIPS32.h - MIPS32 machine instrs --*- C++ -*-=== // |
| 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 // This file declares the InstMIPS32 and OperandMIPS32 classes and | 10 // This file declares the InstMIPS32 and OperandMIPS32 classes and |
| 11 // their subclasses. This represents the machine instructions and | 11 // their subclasses. This represents the machine instructions and |
| 12 // operands used for MIPS32 code selection. | 12 // operands used for MIPS32 code selection. |
| 13 // | 13 // |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #ifndef SUBZERO_SRC_ICEINSTMIPS32_H | 16 #ifndef SUBZERO_SRC_ICEINSTMIPS32_H |
| 17 #define SUBZERO_SRC_ICEINSTMIPS32_H | 17 #define SUBZERO_SRC_ICEINSTMIPS32_H |
| 18 | 18 |
| 19 #include "IceDefs.h" | 19 #include "IceDefs.h" |
| 20 #include "IceInst.h" | |
| 21 #include "IceInstMIPS32.def" | |
| 22 #include "IceOperand.h" | |
| 20 | 23 |
| 21 namespace Ice { | 24 namespace Ice { |
| 22 | 25 |
| 23 class TargetMIPS32; | 26 class TargetMIPS32; |
| 24 // Fill this in. | 27 // Base class for Mips instructions. |
| 28 class InstMIPS32 : public InstTarget { | |
| 29 InstMIPS32() = delete; | |
| 30 InstMIPS32(const InstMIPS32 &) = delete; | |
| 31 InstMIPS32 &operator=(const InstMIPS32 &) = delete; | |
| 32 | |
| 33 public: | |
| 34 enum InstKindMIPS32 { k__Start = Inst::Target, Ret }; | |
| 35 | |
| 36 static const char *getWidthString(Type Ty); | |
| 37 | |
| 38 void dump(const Cfg *Func) const override; | |
| 39 | |
| 40 protected: | |
| 41 InstMIPS32(Cfg *Func, InstKindMIPS32 Kind, SizeT Maxsrcs, Variable *Dest) | |
| 42 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} | |
| 43 ~InstMIPS32() override {} | |
| 44 static bool isClassof(const Inst *Inst, InstKindMIPS32 MyKind) { | |
| 45 return Inst->getKind() == static_cast<InstKind>(MyKind); | |
| 46 } | |
| 47 }; | |
| 48 | |
| 49 // Ret pseudo-instruction. This is actually a "jr" instruction with | |
| 50 // an "ra" register operand, but epilogue lowering will search for a Ret | |
| 51 // instead of a generic "jr". This instruction also takes a Source | |
| 52 // operand (for non-void returning functions) for liveness analysis, though | |
| 53 // a FakeUse before the ret would do just as well. | |
| 54 // This needs was take from the ARM port and needs to be scrubbed in the future | |
| 55 // (TODO Reed Kotler) | |
|
jvoung (off chromium)
2015/06/12 19:39:12
TODO(reed kotler)
| |
| 56 // | |
| 57 class InstMIPS32Ret : public InstMIPS32 { | |
| 58 InstMIPS32Ret() = delete; | |
| 59 InstMIPS32Ret(const InstMIPS32Ret &) = delete; | |
| 60 InstMIPS32Ret &operator=(const InstMIPS32Ret &) = delete; | |
| 61 | |
| 62 public: | |
| 63 static InstMIPS32Ret *create(Cfg *Func, Variable *LR, | |
|
jvoung (off chromium)
2015/06/12 19:39:13
s/LR/RA/
| |
| 64 Variable *Source = nullptr) { | |
| 65 return new (Func->allocate<InstMIPS32Ret>()) | |
| 66 InstMIPS32Ret(Func, LR, Source); | |
| 67 } | |
| 68 void emit(const Cfg *Func) const override; | |
| 69 void emitIAS(const Cfg *Func) const override; | |
| 70 void dump(const Cfg *Func) const override; | |
| 71 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } | |
| 72 | |
| 73 private: | |
| 74 InstMIPS32Ret(Cfg *Func, Variable *LR, Variable *Source); | |
| 75 ~InstMIPS32Ret() override {} | |
| 76 }; | |
| 25 | 77 |
| 26 } // end of namespace Ice | 78 } // end of namespace Ice |
| 27 | 79 |
| 28 #endif // SUBZERO_SRC_ICEINSTMIPS32_H | 80 #endif // SUBZERO_SRC_ICEINSTMIPS32_H |
| OLD | NEW |