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 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 Srl, | 258 Srl, |
259 Srlv, | 259 Srlv, |
260 Sqrt_d, | 260 Sqrt_d, |
261 Sqrt_s, | 261 Sqrt_s, |
262 Sub, | 262 Sub, |
263 Sub_d, | 263 Sub_d, |
264 Sub_s, | 264 Sub_s, |
265 Subu, | 265 Subu, |
266 Sw, | 266 Sw, |
267 Swc1, | 267 Swc1, |
| 268 Teq, |
268 Trunc_l_d, | 269 Trunc_l_d, |
269 Trunc_l_s, | 270 Trunc_l_s, |
270 Trunc_w_d, | 271 Trunc_w_d, |
271 Trunc_w_s, | 272 Trunc_w_s, |
272 Xor, | 273 Xor, |
273 Xori | 274 Xori |
274 }; | 275 }; |
275 | 276 |
276 static constexpr size_t InstSize = sizeof(uint32_t); | 277 static constexpr size_t InstSize = sizeof(uint32_t); |
277 | 278 |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 private: | 907 private: |
907 InstMIPS32FPCmp(Cfg *Func, Variable *Src0, Variable *Src1) | 908 InstMIPS32FPCmp(Cfg *Func, Variable *Src0, Variable *Src1) |
908 : InstMIPS32(Func, K, 2, nullptr) { | 909 : InstMIPS32(Func, K, 2, nullptr) { |
909 addSource(Src0); | 910 addSource(Src0); |
910 addSource(Src1); | 911 addSource(Src1); |
911 }; | 912 }; |
912 | 913 |
913 static const char *Opcode; | 914 static const char *Opcode; |
914 }; | 915 }; |
915 | 916 |
| 917 // Trap |
| 918 template <InstMIPS32::InstKindMIPS32 K> |
| 919 class InstMIPS32Trap : public InstMIPS32 { |
| 920 InstMIPS32Trap() = delete; |
| 921 InstMIPS32Trap(const InstMIPS32Trap &) = delete; |
| 922 InstMIPS32Trap &operator=(const InstMIPS32Trap &) = delete; |
| 923 |
| 924 public: |
| 925 static InstMIPS32Trap *create(Cfg *Func, Operand *Src0, Operand *Src1, |
| 926 uint32_t Tcode) { |
| 927 return new (Func->allocate<InstMIPS32Trap>()) |
| 928 InstMIPS32Trap(Func, Src0, Src1, Tcode); |
| 929 } |
| 930 |
| 931 void emit(const Cfg *Func) const override { |
| 932 if (!BuildDefs::dump()) |
| 933 return; |
| 934 Ostream &Str = Func->getContext()->getStrEmit(); |
| 935 Str << "\t" << Opcode << "\t"; |
| 936 getSrc(0)->emit(Func); |
| 937 Str << ", "; |
| 938 getSrc(1)->emit(Func); |
| 939 Str << ", " << TrapCode; |
| 940 } |
| 941 |
| 942 void emitIAS(const Cfg *Func) const override { |
| 943 (void)Func; |
| 944 llvm_unreachable("Not yet implemented"); |
| 945 } |
| 946 |
| 947 void dump(const Cfg *Func) const override { |
| 948 if (!BuildDefs::dump()) |
| 949 return; |
| 950 Ostream &Str = Func->getContext()->getStrEmit(); |
| 951 Str << "\t" << Opcode << "\t"; |
| 952 getSrc(0)->emit(Func); |
| 953 Str << ", "; |
| 954 getSrc(1)->emit(Func); |
| 955 Str << ", " << TrapCode; |
| 956 } |
| 957 |
| 958 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 959 |
| 960 private: |
| 961 InstMIPS32Trap(Cfg *Func, Operand *Src0, Operand *Src1, const uint32_t Tcode) |
| 962 : InstMIPS32(Func, K, 2, nullptr), TrapCode(Tcode) { |
| 963 addSource(Src0); |
| 964 addSource(Src1); |
| 965 } |
| 966 |
| 967 static const char *Opcode; |
| 968 const uint32_t TrapCode; |
| 969 }; |
| 970 |
916 template <InstMIPS32::InstKindMIPS32 K, bool Signed = false> | 971 template <InstMIPS32::InstKindMIPS32 K, bool Signed = false> |
917 class InstMIPS32Imm16 : public InstMIPS32 { | 972 class InstMIPS32Imm16 : public InstMIPS32 { |
918 InstMIPS32Imm16() = delete; | 973 InstMIPS32Imm16() = delete; |
919 InstMIPS32Imm16(const InstMIPS32Imm16 &) = delete; | 974 InstMIPS32Imm16(const InstMIPS32Imm16 &) = delete; |
920 InstMIPS32Imm16 &operator=(const InstMIPS32Imm16 &) = delete; | 975 InstMIPS32Imm16 &operator=(const InstMIPS32Imm16 &) = delete; |
921 | 976 |
922 public: | 977 public: |
923 static InstMIPS32Imm16 *create(Cfg *Func, Variable *Dest, Operand *Source, | 978 static InstMIPS32Imm16 *create(Cfg *Func, Variable *Dest, Operand *Source, |
924 uint32_t Imm) { | 979 uint32_t Imm) { |
925 return new (Func->allocate<InstMIPS32Imm16>()) | 980 return new (Func->allocate<InstMIPS32Imm16>()) |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 using InstMIPS32Sra = InstMIPS32Imm16<InstMIPS32::Sra>; | 1168 using InstMIPS32Sra = InstMIPS32Imm16<InstMIPS32::Sra>; |
1114 using InstMIPS32Srav = InstMIPS32ThreeAddrGPR<InstMIPS32::Srav>; | 1169 using InstMIPS32Srav = InstMIPS32ThreeAddrGPR<InstMIPS32::Srav>; |
1115 using InstMIPS32Srl = InstMIPS32Imm16<InstMIPS32::Srl>; | 1170 using InstMIPS32Srl = InstMIPS32Imm16<InstMIPS32::Srl>; |
1116 using InstMIPS32Srlv = InstMIPS32ThreeAddrGPR<InstMIPS32::Srlv>; | 1171 using InstMIPS32Srlv = InstMIPS32ThreeAddrGPR<InstMIPS32::Srlv>; |
1117 using InstMIPS32Sub = InstMIPS32ThreeAddrGPR<InstMIPS32::Sub>; | 1172 using InstMIPS32Sub = InstMIPS32ThreeAddrGPR<InstMIPS32::Sub>; |
1118 using InstMIPS32Sub_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_d>; | 1173 using InstMIPS32Sub_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_d>; |
1119 using InstMIPS32Sub_s = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_s>; | 1174 using InstMIPS32Sub_s = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_s>; |
1120 using InstMIPS32Subu = InstMIPS32ThreeAddrGPR<InstMIPS32::Subu>; | 1175 using InstMIPS32Subu = InstMIPS32ThreeAddrGPR<InstMIPS32::Subu>; |
1121 using InstMIPS32Sw = InstMIPS32Store<InstMIPS32::Sw>; | 1176 using InstMIPS32Sw = InstMIPS32Store<InstMIPS32::Sw>; |
1122 using InstMIPS32Swc1 = InstMIPS32Store<InstMIPS32::Swc1>; | 1177 using InstMIPS32Swc1 = InstMIPS32Store<InstMIPS32::Swc1>; |
| 1178 using InstMIPS32Teq = InstMIPS32Trap<InstMIPS32::Teq>; |
1123 using InstMIPS32Trunc_l_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_d>; | 1179 using InstMIPS32Trunc_l_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_d>; |
1124 using InstMIPS32Trunc_l_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_s>; | 1180 using InstMIPS32Trunc_l_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_s>; |
1125 using InstMIPS32Trunc_w_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_d>; | 1181 using InstMIPS32Trunc_w_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_d>; |
1126 using InstMIPS32Trunc_w_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_s>; | 1182 using InstMIPS32Trunc_w_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_s>; |
1127 using InstMIPS32Ori = InstMIPS32Imm16<InstMIPS32::Ori>; | 1183 using InstMIPS32Ori = InstMIPS32Imm16<InstMIPS32::Ori>; |
1128 using InstMIPS32Xor = InstMIPS32ThreeAddrGPR<InstMIPS32::Xor>; | 1184 using InstMIPS32Xor = InstMIPS32ThreeAddrGPR<InstMIPS32::Xor>; |
1129 using InstMIPS32Xori = InstMIPS32Imm16<InstMIPS32::Xori>; | 1185 using InstMIPS32Xori = InstMIPS32Imm16<InstMIPS32::Xori>; |
1130 | 1186 |
1131 /// Handles (some of) vmov's various formats. | 1187 /// Handles (some of) vmov's various formats. |
1132 class InstMIPS32Mov final : public InstMIPS32 { | 1188 class InstMIPS32Mov final : public InstMIPS32 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 template <> void InstMIPS32Addu::emitIAS(const Cfg *Func) const; | 1250 template <> void InstMIPS32Addu::emitIAS(const Cfg *Func) const; |
1195 template <> void InstMIPS32Slt::emitIAS(const Cfg *Func) const; | 1251 template <> void InstMIPS32Slt::emitIAS(const Cfg *Func) const; |
1196 template <> void InstMIPS32Sltu::emitIAS(const Cfg *Func) const; | 1252 template <> void InstMIPS32Sltu::emitIAS(const Cfg *Func) const; |
1197 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const; | 1253 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const; |
1198 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const; | 1254 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const; |
1199 | 1255 |
1200 } // end of namespace MIPS32 | 1256 } // end of namespace MIPS32 |
1201 } // end of namespace Ice | 1257 } // end of namespace Ice |
1202 | 1258 |
1203 #endif // SUBZERO_SRC_ICEINSTMIPS32_H | 1259 #endif // SUBZERO_SRC_ICEINSTMIPS32_H |
OLD | NEW |