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 /// \file | 10 /// \file |
11 /// \brief Declares the InstMIPS32 and OperandMIPS32 classes and their | 11 /// \brief Declares the InstMIPS32 and OperandMIPS32 classes and their |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 Sw, | 192 Sw, |
193 Swc1, | 193 Swc1, |
194 Trunc_l_d, | 194 Trunc_l_d, |
195 Trunc_l_s, | 195 Trunc_l_s, |
196 Trunc_w_d, | 196 Trunc_w_d, |
197 Trunc_w_s, | 197 Trunc_w_s, |
198 Xor, | 198 Xor, |
199 Xori | 199 Xori |
200 }; | 200 }; |
201 | 201 |
| 202 static constexpr size_t InstSize = sizeof(uint32_t); |
| 203 |
202 static const char *getWidthString(Type Ty); | 204 static const char *getWidthString(Type Ty); |
203 | 205 |
204 void dump(const Cfg *Func) const override; | 206 void dump(const Cfg *Func) const override; |
205 | 207 |
206 void dumpOpcode(Ostream &Str, const char *Opcode, Type Ty) const { | 208 void dumpOpcode(Ostream &Str, const char *Opcode, Type Ty) const { |
207 Str << Opcode << "." << Ty; | 209 Str << Opcode << "." << Ty; |
208 } | 210 } |
209 | 211 |
210 // TODO(rkotler): while branching is not implemented | 212 // TODO(rkotler): while branching is not implemented |
211 bool repointEdges(CfgNode *, CfgNode *) override { return true; } | 213 bool repointEdges(CfgNode *, CfgNode *) override { return true; } |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 } | 670 } |
669 | 671 |
670 const CfgNode *getTargetTrue() const { return TargetTrue; } | 672 const CfgNode *getTargetTrue() const { return TargetTrue; } |
671 const CfgNode *getTargetFalse() const { return TargetFalse; } | 673 const CfgNode *getTargetFalse() const { return TargetFalse; } |
672 | 674 |
673 bool isUnconditionalBranch() const override { | 675 bool isUnconditionalBranch() const override { |
674 return Predicate == CondMIPS32::AL; | 676 return Predicate == CondMIPS32::AL; |
675 } | 677 } |
676 bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override; | 678 bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override; |
677 void emit(const Cfg *Func) const override; | 679 void emit(const Cfg *Func) const override; |
678 void emitIAS(const Cfg *Func) const override { (void)Func; }; | 680 void emitIAS(const Cfg *Func) const override; |
679 void dump(const Cfg *Func) const override; | 681 void dump(const Cfg *Func) const override; |
680 static bool classof(const Inst *Instr) { return isClassof(Instr, Br); } | 682 static bool classof(const Inst *Instr) { return isClassof(Instr, Br); } |
681 | 683 |
682 private: | 684 private: |
683 InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, | 685 InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, |
684 const InstMIPS32Label *Label, const CondMIPS32::Cond Cond); | 686 const InstMIPS32Label *Label, const CondMIPS32::Cond Cond); |
685 | 687 |
686 InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, | 688 InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, |
687 Operand *Src0, const InstMIPS32Label *Label, | 689 Operand *Src0, const InstMIPS32Label *Label, |
688 const CondMIPS32::Cond Cond); | 690 const CondMIPS32::Cond Cond); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 getDest()->emit(Func); | 746 getDest()->emit(Func); |
745 if (getSrcSize() > 0) { | 747 if (getSrcSize() > 0) { |
746 Str << ", "; | 748 Str << ", "; |
747 getSrc(0)->emit(Func); | 749 getSrc(0)->emit(Func); |
748 } | 750 } |
749 Str << ", "; | 751 Str << ", "; |
750 if (Signed) | 752 if (Signed) |
751 Str << (int32_t)Imm; | 753 Str << (int32_t)Imm; |
752 else | 754 else |
753 Str << Imm; | 755 Str << Imm; |
754 Str << "\n"; | |
755 } | 756 } |
756 | 757 |
757 void emitIAS(const Cfg *Func) const override { | 758 void emitIAS(const Cfg *Func) const override { |
758 (void)Func; | 759 (void)Func; |
759 llvm_unreachable("Not yet implemented"); | 760 llvm_unreachable("Not yet implemented"); |
760 } | 761 } |
761 void dump(const Cfg *Func) const override { | 762 void dump(const Cfg *Func) const override { |
762 if (!BuildDefs::dump()) | 763 if (!BuildDefs::dump()) |
763 return; | 764 return; |
764 Ostream &Str = Func->getContext()->getStrDump(); | 765 Ostream &Str = Func->getContext()->getStrDump(); |
765 Str << " "; | 766 Str << " "; |
766 Str << "\t" << Opcode << "\t"; | 767 Str << "\t" << Opcode << "\t"; |
767 dumpDest(Func); | 768 dumpDest(Func); |
768 Str << ", "; | 769 Str << ", "; |
769 dumpSources(Func); | 770 dumpSources(Func); |
770 if (Signed) | 771 if (Signed) |
771 Str << (int32_t)Imm; | 772 Str << (int32_t)Imm; |
772 else | 773 else |
773 Str << Imm; | 774 Str << Imm; |
774 Str << "\n"; | |
775 } | 775 } |
776 | 776 |
777 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 777 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
778 | 778 |
779 private: | 779 private: |
780 InstMIPS32Imm16(Cfg *Func, Variable *Dest, Operand *Source, uint32_t Imm) | 780 InstMIPS32Imm16(Cfg *Func, Variable *Dest, Operand *Source, uint32_t Imm) |
781 : InstMIPS32(Func, K, 1, Dest), Imm(Imm) { | 781 : InstMIPS32(Func, K, 1, Dest), Imm(Imm) { |
782 addSource(Source); | 782 addSource(Source); |
783 } | 783 } |
784 | 784 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const; | 900 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const; |
901 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const; | 901 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const; |
902 template <> void InstMIPS32Mult::emit(const Cfg *Func) const; | 902 template <> void InstMIPS32Mult::emit(const Cfg *Func) const; |
903 template <> void InstMIPS32Multu::emit(const Cfg *Func) const; | 903 template <> void InstMIPS32Multu::emit(const Cfg *Func) const; |
904 template <> void InstMIPS32Lui::emit(const Cfg *Func) const; | 904 template <> void InstMIPS32Lui::emit(const Cfg *Func) const; |
905 | 905 |
906 } // end of namespace MIPS32 | 906 } // end of namespace MIPS32 |
907 } // end of namespace Ice | 907 } // end of namespace Ice |
908 | 908 |
909 #endif // SUBZERO_SRC_ICEINSTMIPS32_H | 909 #endif // SUBZERO_SRC_ICEINSTMIPS32_H |
OLD | NEW |