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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 InstMIPS32ThreeAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0, | 485 InstMIPS32ThreeAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0, |
| 486 Variable *Src1) | 486 Variable *Src1) |
| 487 : InstMIPS32(Func, K, 2, Dest) { | 487 : InstMIPS32(Func, K, 2, Dest) { |
| 488 addSource(Src0); | 488 addSource(Src0); |
| 489 addSource(Src1); | 489 addSource(Src1); |
| 490 } | 490 } |
| 491 | 491 |
| 492 static const char *Opcode; | 492 static const char *Opcode; |
| 493 }; | 493 }; |
| 494 | 494 |
| 495 // InstMIPS32Memory represents instructions which loads/stores data on memory | 495 // InstMIPS32Load represents instructions which loads data from memory |
| 496 // Its format is "OPCODE GPR, OFFSET(BASE GPR)" | |
| 497 template <InstMIPS32::InstKindMIPS32 K> | |
| 498 class InstMIPS32Load : public InstMIPS32 { | |
| 499 InstMIPS32Load() = delete; | |
| 500 InstMIPS32Load(const InstMIPS32Load &) = delete; | |
| 501 InstMIPS32Load &operator=(const InstMIPS32Load &) = delete; | |
| 502 | |
| 503 public: | |
| 504 static InstMIPS32Load *create(Cfg *Func, Variable *Value, | |
| 505 OperandMIPS32Mem *Mem, | |
| 506 RelocOp Reloc = RO_No) { | |
| 507 return new (Func->allocate<InstMIPS32Load>()) | |
| 508 InstMIPS32Load(Func, Value, Mem, Reloc); | |
| 509 } | |
| 510 | |
| 511 void emit(const Cfg *Func) const override { | |
| 512 if (!BuildDefs::dump()) | |
| 513 return; | |
| 514 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 515 assert(getSrcSize() == 1); | |
| 516 Str << "\t" << Opcode << "\t"; | |
| 517 getDest()->emit(Func); | |
| 518 Str << ", "; | |
| 519 emitRelocOp(Str, Reloc); | |
| 520 getSrc(0)->emit(Func); | |
| 521 } | |
| 522 | |
| 523 void emitIAS(const Cfg *Func) const override { | |
| 524 (void)Func; | |
| 525 llvm_unreachable("Not yet implemented"); | |
| 526 } | |
| 527 | |
| 528 void dump(const Cfg *Func) const override { | |
| 529 if (!BuildDefs::dump()) | |
| 530 return; | |
| 531 Ostream &Str = Func->getContext()->getStrDump(); | |
| 532 Str << "\t" << Opcode << "\t"; | |
| 533 getDest()->dump(Func); | |
| 534 Str << ", "; | |
| 535 emitRelocOp(Str, Reloc); | |
| 536 Str << (Reloc ? "(" : ""); | |
| 537 getSrc(0)->dump(Func); | |
| 538 Str << (Reloc ? ")" : ""); | |
| 539 } | |
| 540 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | |
| 541 | |
| 542 private: | |
| 543 InstMIPS32Load(Cfg *Func, Variable *Value, OperandMIPS32Mem *Mem, | |
| 544 RelocOp Reloc = RO_No) | |
| 545 : InstMIPS32(Func, K, 2, Value), Reloc(Reloc) { | |
| 546 addSource(Mem); | |
| 547 } | |
| 548 static const char *Opcode; | |
| 549 const RelocOp Reloc; | |
| 550 }; | |
| 551 | |
| 552 // InstMIPS32Memory represents instructions which stores data to memory | |
|
Jim Stichnoth
2016/08/18 15:08:55
What do you think about renaming this to InstMIPS3
| |
| 496 // Its format is "OPCODE GPR, OFFSET(BASE GPR)" | 553 // Its format is "OPCODE GPR, OFFSET(BASE GPR)" |
| 497 template <InstMIPS32::InstKindMIPS32 K> | 554 template <InstMIPS32::InstKindMIPS32 K> |
| 498 class InstMIPS32Memory : public InstMIPS32 { | 555 class InstMIPS32Memory : public InstMIPS32 { |
|
John
2016/08/18 14:53:35
Rename this to InstMIPS32Store?
| |
| 499 InstMIPS32Memory() = delete; | 556 InstMIPS32Memory() = delete; |
| 500 InstMIPS32Memory(const InstMIPS32Memory &) = delete; | 557 InstMIPS32Memory(const InstMIPS32Memory &) = delete; |
| 501 InstMIPS32Memory &operator=(const InstMIPS32Memory &) = delete; | 558 InstMIPS32Memory &operator=(const InstMIPS32Memory &) = delete; |
| 502 | 559 |
| 503 public: | 560 public: |
| 504 static InstMIPS32Memory *create(Cfg *Func, Variable *Value, | 561 static InstMIPS32Memory *create(Cfg *Func, Variable *Value, |
| 505 OperandMIPS32Mem *Mem, | 562 OperandMIPS32Mem *Mem, |
| 506 RelocOp Reloc = RO_No) { | 563 RelocOp Reloc = RO_No) { |
| 507 return new (Func->allocate<InstMIPS32Memory>()) | 564 return new (Func->allocate<InstMIPS32Memory>()) |
| 508 InstMIPS32Memory(Func, Value, Mem, Reloc); | 565 InstMIPS32Memory(Func, Value, Mem, Reloc); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 750 using InstMIPS32Cvt_d_l = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_d_l>; | 807 using InstMIPS32Cvt_d_l = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_d_l>; |
| 751 using InstMIPS32Cvt_d_w = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_d_w>; | 808 using InstMIPS32Cvt_d_w = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_d_w>; |
| 752 using InstMIPS32Cvt_s_d = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_s_d>; | 809 using InstMIPS32Cvt_s_d = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_s_d>; |
| 753 using InstMIPS32Cvt_s_l = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_s_l>; | 810 using InstMIPS32Cvt_s_l = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_s_l>; |
| 754 using InstMIPS32Cvt_s_w = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_s_w>; | 811 using InstMIPS32Cvt_s_w = InstMIPS32TwoAddrFPR<InstMIPS32::Cvt_s_w>; |
| 755 using InstMIPS32Div = InstMIPS32ThreeAddrGPR<InstMIPS32::Div>; | 812 using InstMIPS32Div = InstMIPS32ThreeAddrGPR<InstMIPS32::Div>; |
| 756 using InstMIPS32Div_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Div_d>; | 813 using InstMIPS32Div_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Div_d>; |
| 757 using InstMIPS32Div_s = InstMIPS32ThreeAddrFPR<InstMIPS32::Div_s>; | 814 using InstMIPS32Div_s = InstMIPS32ThreeAddrFPR<InstMIPS32::Div_s>; |
| 758 using InstMIPS32Divu = InstMIPS32ThreeAddrGPR<InstMIPS32::Divu>; | 815 using InstMIPS32Divu = InstMIPS32ThreeAddrGPR<InstMIPS32::Divu>; |
| 759 using InstMIPS32La = InstMIPS32UnaryopGPR<InstMIPS32::La>; | 816 using InstMIPS32La = InstMIPS32UnaryopGPR<InstMIPS32::La>; |
| 760 using InstMIPS32Ldc1 = InstMIPS32Memory<InstMIPS32::Ldc1>; | 817 using InstMIPS32Ldc1 = InstMIPS32Load<InstMIPS32::Ldc1>; |
| 761 using InstMIPS32Lui = InstMIPS32UnaryopGPR<InstMIPS32::Lui>; | 818 using InstMIPS32Lui = InstMIPS32UnaryopGPR<InstMIPS32::Lui>; |
| 762 using InstMIPS32Lw = InstMIPS32Memory<InstMIPS32::Lw>; | 819 using InstMIPS32Lw = InstMIPS32Load<InstMIPS32::Lw>; |
| 763 using InstMIPS32Lwc1 = InstMIPS32Memory<InstMIPS32::Lwc1>; | 820 using InstMIPS32Lwc1 = InstMIPS32Load<InstMIPS32::Lwc1>; |
| 764 using InstMIPS32Mfc1 = InstMIPS32TwoAddrGPR<InstMIPS32::Mfc1>; | 821 using InstMIPS32Mfc1 = InstMIPS32TwoAddrGPR<InstMIPS32::Mfc1>; |
| 765 using InstMIPS32Mfhi = InstMIPS32UnaryopGPR<InstMIPS32::Mfhi>; | 822 using InstMIPS32Mfhi = InstMIPS32UnaryopGPR<InstMIPS32::Mfhi>; |
| 766 using InstMIPS32Mflo = InstMIPS32UnaryopGPR<InstMIPS32::Mflo>; | 823 using InstMIPS32Mflo = InstMIPS32UnaryopGPR<InstMIPS32::Mflo>; |
| 767 using InstMIPS32Mov_d = InstMIPS32TwoAddrFPR<InstMIPS32::Mov_d>; | 824 using InstMIPS32Mov_d = InstMIPS32TwoAddrFPR<InstMIPS32::Mov_d>; |
| 768 using InstMIPS32Mov_s = InstMIPS32TwoAddrFPR<InstMIPS32::Mov_s>; | 825 using InstMIPS32Mov_s = InstMIPS32TwoAddrFPR<InstMIPS32::Mov_s>; |
| 769 using InstMIPS32Mtc1 = InstMIPS32TwoAddrGPR<InstMIPS32::Mtc1>; | 826 using InstMIPS32Mtc1 = InstMIPS32TwoAddrGPR<InstMIPS32::Mtc1>; |
| 770 using InstMIPS32Mthi = InstMIPS32UnaryopGPR<InstMIPS32::Mthi>; | 827 using InstMIPS32Mthi = InstMIPS32UnaryopGPR<InstMIPS32::Mthi>; |
| 771 using InstMIPS32Mtlo = InstMIPS32UnaryopGPR<InstMIPS32::Mtlo>; | 828 using InstMIPS32Mtlo = InstMIPS32UnaryopGPR<InstMIPS32::Mtlo>; |
| 772 using InstMIPS32Mul = InstMIPS32ThreeAddrGPR<InstMIPS32::Mul>; | 829 using InstMIPS32Mul = InstMIPS32ThreeAddrGPR<InstMIPS32::Mul>; |
| 773 using InstMIPS32Mul_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Mul_d>; | 830 using InstMIPS32Mul_d = InstMIPS32ThreeAddrFPR<InstMIPS32::Mul_d>; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const; | 906 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const; |
| 850 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const; | 907 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const; |
| 851 template <> void InstMIPS32Mult::emit(const Cfg *Func) const; | 908 template <> void InstMIPS32Mult::emit(const Cfg *Func) const; |
| 852 template <> void InstMIPS32Multu::emit(const Cfg *Func) const; | 909 template <> void InstMIPS32Multu::emit(const Cfg *Func) const; |
| 853 template <> void InstMIPS32Lui::emit(const Cfg *Func) const; | 910 template <> void InstMIPS32Lui::emit(const Cfg *Func) const; |
| 854 | 911 |
| 855 } // end of namespace MIPS32 | 912 } // end of namespace MIPS32 |
| 856 } // end of namespace Ice | 913 } // end of namespace Ice |
| 857 | 914 |
| 858 #endif // SUBZERO_SRC_ICEINSTMIPS32_H | 915 #endif // SUBZERO_SRC_ICEINSTMIPS32_H |
| OLD | NEW |