| 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 11 matching lines...) Expand all Loading... |
| 22 #include "IceConditionCodesMIPS32.h" | 22 #include "IceConditionCodesMIPS32.h" |
| 23 #include "IceDefs.h" | 23 #include "IceDefs.h" |
| 24 #include "IceInst.h" | 24 #include "IceInst.h" |
| 25 #include "IceInstMIPS32.def" | 25 #include "IceInstMIPS32.def" |
| 26 #include "IceOperand.h" | 26 #include "IceOperand.h" |
| 27 | 27 |
| 28 namespace Ice { | 28 namespace Ice { |
| 29 namespace MIPS32 { | 29 namespace MIPS32 { |
| 30 | 30 |
| 31 enum RelocOp { RO_No, RO_Hi, RO_Lo, RO_Jal }; | 31 enum RelocOp { RO_No, RO_Hi, RO_Lo, RO_Jal }; |
| 32 enum Int64Part { Int64_Hi, Int64_Lo }; |
| 32 | 33 |
| 33 inline void emitRelocOp(Ostream &Str, RelocOp Reloc) { | 34 inline void emitRelocOp(Ostream &Str, RelocOp Reloc) { |
| 34 switch (Reloc) { | 35 switch (Reloc) { |
| 35 default: | 36 default: |
| 36 break; | 37 break; |
| 37 case RO_Hi: | 38 case RO_Hi: |
| 38 Str << "%hi"; | 39 Str << "%hi"; |
| 39 break; | 40 break; |
| 40 case RO_Lo: | 41 case RO_Lo: |
| 41 Str << "%lo"; | 42 Str << "%lo"; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 Label, | 226 Label, |
| 226 Ldc1, | 227 Ldc1, |
| 227 Ll, | 228 Ll, |
| 228 Lui, | 229 Lui, |
| 229 Lw, | 230 Lw, |
| 230 Lwc1, | 231 Lwc1, |
| 231 Mfc1, | 232 Mfc1, |
| 232 Mfhi, | 233 Mfhi, |
| 233 Mflo, | 234 Mflo, |
| 234 Mov, // actually a pseudo op for addi rd, rs, 0 | 235 Mov, // actually a pseudo op for addi rd, rs, 0 |
| 236 Mov_fp, |
| 235 Mov_d, | 237 Mov_d, |
| 236 Mov_s, | 238 Mov_s, |
| 237 Movf, | 239 Movf, |
| 238 Movn, | 240 Movn, |
| 239 Movn_d, | 241 Movn_d, |
| 240 Movn_s, | 242 Movn_s, |
| 241 Movt, | 243 Movt, |
| 242 Movz, | 244 Movz, |
| 243 Movz_d, | 245 Movz_d, |
| 244 Movz_s, | 246 Movz_s, |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 private: | 1315 private: |
| 1314 InstMIPS32Mov(Cfg *Func, Variable *Dest, Operand *Src, Operand *Src2); | 1316 InstMIPS32Mov(Cfg *Func, Variable *Dest, Operand *Src, Operand *Src2); |
| 1315 | 1317 |
| 1316 void emitMultiDestSingleSource(const Cfg *Func) const; | 1318 void emitMultiDestSingleSource(const Cfg *Func) const; |
| 1317 void emitSingleDestMultiSource(const Cfg *Func) const; | 1319 void emitSingleDestMultiSource(const Cfg *Func) const; |
| 1318 void emitSingleDestSingleSource(const Cfg *Func) const; | 1320 void emitSingleDestSingleSource(const Cfg *Func) const; |
| 1319 | 1321 |
| 1320 Variable *DestHi = nullptr; | 1322 Variable *DestHi = nullptr; |
| 1321 }; | 1323 }; |
| 1322 | 1324 |
| 1325 /// Handle double to i64 move |
| 1326 class InstMIPS32MovFP64ToI64 final : public InstMIPS32 { |
| 1327 InstMIPS32MovFP64ToI64() = delete; |
| 1328 InstMIPS32MovFP64ToI64(const InstMIPS32MovFP64ToI64 &) = delete; |
| 1329 InstMIPS32MovFP64ToI64 &operator=(const InstMIPS32MovFP64ToI64 &) = delete; |
| 1330 |
| 1331 public: |
| 1332 static InstMIPS32MovFP64ToI64 *create(Cfg *Func, Variable *Dest, Operand *Src, |
| 1333 Int64Part Int64HiLo) { |
| 1334 return new (Func->allocate<InstMIPS32MovFP64ToI64>()) |
| 1335 InstMIPS32MovFP64ToI64(Func, Dest, Src, Int64HiLo); |
| 1336 } |
| 1337 |
| 1338 bool isRedundantAssign() const override { |
| 1339 return checkForRedundantAssign(getDest(), getSrc(0)); |
| 1340 } |
| 1341 |
| 1342 void dump(const Cfg *Func) const override { |
| 1343 if (!BuildDefs::dump()) |
| 1344 return; |
| 1345 Ostream &Str = Func->getContext()->getStrDump(); |
| 1346 getDest()->dump(Func); |
| 1347 Str << " = "; |
| 1348 dumpOpcode(Str, "mov_fp", getDest()->getType()); |
| 1349 Str << " "; |
| 1350 getSrc(0)->dump(Func); |
| 1351 } |
| 1352 |
| 1353 Int64Part getInt64Part() const { return Int64HiLo; } |
| 1354 |
| 1355 static bool classof(const Inst *Inst) { return isClassof(Inst, Mov_fp); } |
| 1356 |
| 1357 private: |
| 1358 InstMIPS32MovFP64ToI64(Cfg *Func, Variable *Dest, Operand *Src, |
| 1359 Int64Part Int64HiLo); |
| 1360 const Int64Part Int64HiLo; |
| 1361 }; |
| 1362 |
| 1323 // Declare partial template specializations of emit() methods that already have | 1363 // Declare partial template specializations of emit() methods that already have |
| 1324 // default implementations. Without this, there is the possibility of ODR | 1364 // default implementations. Without this, there is the possibility of ODR |
| 1325 // violations and link errors. | 1365 // violations and link errors. |
| 1326 | 1366 |
| 1327 template <> void InstMIPS32Abs_d::emitIAS(const Cfg *Func) const; | 1367 template <> void InstMIPS32Abs_d::emitIAS(const Cfg *Func) const; |
| 1328 template <> void InstMIPS32Abs_s::emitIAS(const Cfg *Func) const; | 1368 template <> void InstMIPS32Abs_s::emitIAS(const Cfg *Func) const; |
| 1329 template <> void InstMIPS32Add_d::emitIAS(const Cfg *Func) const; | 1369 template <> void InstMIPS32Add_d::emitIAS(const Cfg *Func) const; |
| 1330 template <> void InstMIPS32Add_s::emitIAS(const Cfg *Func) const; | 1370 template <> void InstMIPS32Add_s::emitIAS(const Cfg *Func) const; |
| 1331 template <> void InstMIPS32Addi::emitIAS(const Cfg *Func) const; | 1371 template <> void InstMIPS32Addi::emitIAS(const Cfg *Func) const; |
| 1332 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const; | 1372 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const; | 1458 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const; |
| 1419 template <> void InstMIPS32Trunc_w_d::emitIAS(const Cfg *Func) const; | 1459 template <> void InstMIPS32Trunc_w_d::emitIAS(const Cfg *Func) const; |
| 1420 template <> void InstMIPS32Trunc_w_s::emitIAS(const Cfg *Func) const; | 1460 template <> void InstMIPS32Trunc_w_s::emitIAS(const Cfg *Func) const; |
| 1421 template <> void InstMIPS32Xor::emitIAS(const Cfg *Func) const; | 1461 template <> void InstMIPS32Xor::emitIAS(const Cfg *Func) const; |
| 1422 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const; | 1462 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const; |
| 1423 | 1463 |
| 1424 } // end of namespace MIPS32 | 1464 } // end of namespace MIPS32 |
| 1425 } // end of namespace Ice | 1465 } // end of namespace Ice |
| 1426 | 1466 |
| 1427 #endif // SUBZERO_SRC_ICEINSTMIPS32_H | 1467 #endif // SUBZERO_SRC_ICEINSTMIPS32_H |
| OLD | NEW |