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 /// \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> | |
|
Jim Stichnoth
2016/09/19 23:56:38
I guess I should have asked this in the previous r
jaydeep.patil
2016/09/20 03:16:54
There 11 more trap instructions (like TNE, TGE, TL
| |
| 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 uint32_t getTrapCode() const { return TrapCode; } | |
| 932 | |
| 933 void emit(const Cfg *Func) const override { | |
| 934 if (!BuildDefs::dump()) | |
| 935 return; | |
| 936 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 937 Str << "\t" << Opcode << "\t"; | |
| 938 getSrc(0)->emit(Func); | |
| 939 Str << ", "; | |
| 940 getSrc(1)->emit(Func); | |
| 941 Str << ", " << TrapCode; | |
| 942 } | |
| 943 | |
| 944 void emitIAS(const Cfg *Func) const override { | |
| 945 (void)Func; | |
| 946 llvm_unreachable("Not yet implemented"); | |
| 947 } | |
| 948 | |
| 949 void dump(const Cfg *Func) const override { | |
| 950 if (!BuildDefs::dump()) | |
| 951 return; | |
| 952 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 953 Str << "\t" << Opcode << "\t"; | |
| 954 getSrc(0)->emit(Func); | |
| 955 Str << ", "; | |
| 956 getSrc(1)->emit(Func); | |
| 957 Str << ", " << TrapCode; | |
| 958 } | |
| 959 | |
| 960 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | |
| 961 | |
| 962 private: | |
| 963 InstMIPS32Trap(Cfg *Func, Operand *Src0, Operand *Src1, const uint32_t Tcode) | |
| 964 : InstMIPS32(Func, K, 2, nullptr), TrapCode(Tcode) { | |
| 965 addSource(Src0); | |
| 966 addSource(Src1); | |
| 967 } | |
| 968 | |
| 969 static const char *Opcode; | |
| 970 const uint32_t TrapCode; | |
| 971 }; | |
| 972 | |
| 916 template <InstMIPS32::InstKindMIPS32 K, bool Signed = false> | 973 template <InstMIPS32::InstKindMIPS32 K, bool Signed = false> |
| 917 class InstMIPS32Imm16 : public InstMIPS32 { | 974 class InstMIPS32Imm16 : public InstMIPS32 { |
| 918 InstMIPS32Imm16() = delete; | 975 InstMIPS32Imm16() = delete; |
| 919 InstMIPS32Imm16(const InstMIPS32Imm16 &) = delete; | 976 InstMIPS32Imm16(const InstMIPS32Imm16 &) = delete; |
| 920 InstMIPS32Imm16 &operator=(const InstMIPS32Imm16 &) = delete; | 977 InstMIPS32Imm16 &operator=(const InstMIPS32Imm16 &) = delete; |
| 921 | 978 |
| 922 public: | 979 public: |
| 923 static InstMIPS32Imm16 *create(Cfg *Func, Variable *Dest, Operand *Source, | 980 static InstMIPS32Imm16 *create(Cfg *Func, Variable *Dest, Operand *Source, |
| 924 uint32_t Imm) { | 981 uint32_t Imm) { |
| 925 return new (Func->allocate<InstMIPS32Imm16>()) | 982 return new (Func->allocate<InstMIPS32Imm16>()) |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1113 using InstMIPS32Sra = InstMIPS32Imm16<InstMIPS32::Sra>; | 1170 using InstMIPS32Sra = InstMIPS32Imm16<InstMIPS32::Sra>; |
| 1114 using InstMIPS32Srav = InstMIPS32ThreeAddrGPR<InstMIPS32::Srav>; | 1171 using InstMIPS32Srav = InstMIPS32ThreeAddrGPR<InstMIPS32::Srav>; |
| 1115 using InstMIPS32Srl = InstMIPS32Imm16<InstMIPS32::Srl>; | 1172 using InstMIPS32Srl = InstMIPS32Imm16<InstMIPS32::Srl>; |
| 1116 using InstMIPS32Srlv = InstMIPS32ThreeAddrGPR<InstMIPS32::Srlv>; | 1173 using InstMIPS32Srlv = InstMIPS32ThreeAddrGPR<InstMIPS32::Srlv>; |
| 1117 using InstMIPS32Sub = InstMIPS32ThreeAddrGPR<InstMIPS32::Sub>; | 1174 using InstMIPS32Sub = InstMIPS32ThreeAddrGPR<InstMIPS32::Sub>; |
| 1118 using InstMIPS32Sub_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_d>; | 1175 using InstMIPS32Sub_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_d>; |
| 1119 using InstMIPS32Sub_s = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_s>; | 1176 using InstMIPS32Sub_s = InstMIPS32ThreeAddrFPR<InstMIPS32::Sub_s>; |
| 1120 using InstMIPS32Subu = InstMIPS32ThreeAddrGPR<InstMIPS32::Subu>; | 1177 using InstMIPS32Subu = InstMIPS32ThreeAddrGPR<InstMIPS32::Subu>; |
| 1121 using InstMIPS32Sw = InstMIPS32Store<InstMIPS32::Sw>; | 1178 using InstMIPS32Sw = InstMIPS32Store<InstMIPS32::Sw>; |
| 1122 using InstMIPS32Swc1 = InstMIPS32Store<InstMIPS32::Swc1>; | 1179 using InstMIPS32Swc1 = InstMIPS32Store<InstMIPS32::Swc1>; |
| 1180 using InstMIPS32Teq = InstMIPS32Trap<InstMIPS32::Teq>; | |
| 1123 using InstMIPS32Trunc_l_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_d>; | 1181 using InstMIPS32Trunc_l_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_d>; |
| 1124 using InstMIPS32Trunc_l_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_s>; | 1182 using InstMIPS32Trunc_l_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_l_s>; |
| 1125 using InstMIPS32Trunc_w_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_d>; | 1183 using InstMIPS32Trunc_w_d = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_d>; |
| 1126 using InstMIPS32Trunc_w_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_s>; | 1184 using InstMIPS32Trunc_w_s = InstMIPS32TwoAddrFPR<InstMIPS32::Trunc_w_s>; |
| 1127 using InstMIPS32Ori = InstMIPS32Imm16<InstMIPS32::Ori>; | 1185 using InstMIPS32Ori = InstMIPS32Imm16<InstMIPS32::Ori>; |
| 1128 using InstMIPS32Xor = InstMIPS32ThreeAddrGPR<InstMIPS32::Xor>; | 1186 using InstMIPS32Xor = InstMIPS32ThreeAddrGPR<InstMIPS32::Xor>; |
| 1129 using InstMIPS32Xori = InstMIPS32Imm16<InstMIPS32::Xori>; | 1187 using InstMIPS32Xori = InstMIPS32Imm16<InstMIPS32::Xori>; |
| 1130 | 1188 |
| 1131 /// Handles (some of) vmov's various formats. | 1189 /// Handles (some of) vmov's various formats. |
| 1132 class InstMIPS32Mov final : public InstMIPS32 { | 1190 class InstMIPS32Mov final : public InstMIPS32 { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1212 template <> void InstMIPS32Slti::emitIAS(const Cfg *Func) const; | 1270 template <> void InstMIPS32Slti::emitIAS(const Cfg *Func) const; |
| 1213 template <> void InstMIPS32Sltiu::emitIAS(const Cfg *Func) const; | 1271 template <> void InstMIPS32Sltiu::emitIAS(const Cfg *Func) const; |
| 1214 template <> void InstMIPS32Sltu::emitIAS(const Cfg *Func) const; | 1272 template <> void InstMIPS32Sltu::emitIAS(const Cfg *Func) const; |
| 1215 template <> void InstMIPS32Sqrt_d::emitIAS(const Cfg *Func) const; | 1273 template <> void InstMIPS32Sqrt_d::emitIAS(const Cfg *Func) const; |
| 1216 template <> void InstMIPS32Sqrt_s::emitIAS(const Cfg *Func) const; | 1274 template <> void InstMIPS32Sqrt_s::emitIAS(const Cfg *Func) const; |
| 1217 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const; | 1275 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const; |
| 1218 template <> void InstMIPS32Sra::emitIAS(const Cfg *Func) const; | 1276 template <> void InstMIPS32Sra::emitIAS(const Cfg *Func) const; |
| 1219 template <> void InstMIPS32Srl::emitIAS(const Cfg *Func) const; | 1277 template <> void InstMIPS32Srl::emitIAS(const Cfg *Func) const; |
| 1220 template <> void InstMIPS32Sub_d::emitIAS(const Cfg *Func) const; | 1278 template <> void InstMIPS32Sub_d::emitIAS(const Cfg *Func) const; |
| 1221 template <> void InstMIPS32Sub_s::emitIAS(const Cfg *Func) const; | 1279 template <> void InstMIPS32Sub_s::emitIAS(const Cfg *Func) const; |
| 1280 template <> void InstMIPS32Teq::emitIAS(const Cfg *Func) const; | |
| 1222 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const; | 1281 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const; |
| 1223 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const; | 1282 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const; |
| 1224 template <> void InstMIPS32Trunc_w_d::emitIAS(const Cfg *Func) const; | 1283 template <> void InstMIPS32Trunc_w_d::emitIAS(const Cfg *Func) const; |
| 1225 template <> void InstMIPS32Trunc_w_s::emitIAS(const Cfg *Func) const; | 1284 template <> void InstMIPS32Trunc_w_s::emitIAS(const Cfg *Func) const; |
| 1226 template <> void InstMIPS32Xor::emitIAS(const Cfg *Func) const; | 1285 template <> void InstMIPS32Xor::emitIAS(const Cfg *Func) const; |
| 1227 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const; | 1286 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const; |
| 1228 | 1287 |
| 1229 } // end of namespace MIPS32 | 1288 } // end of namespace MIPS32 |
| 1230 } // end of namespace Ice | 1289 } // end of namespace Ice |
| 1231 | 1290 |
| 1232 #endif // SUBZERO_SRC_ICEINSTMIPS32_H | 1291 #endif // SUBZERO_SRC_ICEINSTMIPS32_H |
| OLD | NEW |