OLD | NEW |
1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// | 1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// |
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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 Str << "\t" << ActualOpcode << "\t"; | 779 Str << "\t" << ActualOpcode << "\t"; |
780 getDest()->emit(Func); | 780 getDest()->emit(Func); |
781 Str << ", "; | 781 Str << ", "; |
782 getSrc(0)->emit(Func); | 782 getSrc(0)->emit(Func); |
783 return; | 783 return; |
784 } | 784 } |
785 | 785 |
786 llvm::report_fatal_error("Invalid mov instruction. Dest or Src is memory."); | 786 llvm::report_fatal_error("Invalid mov instruction. Dest or Src is memory."); |
787 } | 787 } |
788 | 788 |
| 789 template <> void InstMIPS32Add_d::emitIAS(const Cfg *Func) const { |
| 790 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 791 Asm->add_d(getDest(), getSrc(0), getSrc(1)); |
| 792 } |
| 793 |
| 794 template <> void InstMIPS32Add_s::emitIAS(const Cfg *Func) const { |
| 795 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 796 Asm->add_s(getDest(), getSrc(0), getSrc(1)); |
| 797 } |
| 798 |
| 799 template <> void InstMIPS32Div_d::emitIAS(const Cfg *Func) const { |
| 800 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 801 Asm->div_d(getDest(), getSrc(0), getSrc(1)); |
| 802 } |
| 803 |
| 804 template <> void InstMIPS32Div_s::emitIAS(const Cfg *Func) const { |
| 805 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 806 Asm->div_s(getDest(), getSrc(0), getSrc(1)); |
| 807 } |
| 808 |
| 809 template <> void InstMIPS32Mul_d::emitIAS(const Cfg *Func) const { |
| 810 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 811 Asm->mul_d(getDest(), getSrc(0), getSrc(1)); |
| 812 } |
| 813 |
| 814 template <> void InstMIPS32Mul_s::emitIAS(const Cfg *Func) const { |
| 815 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 816 Asm->mul_s(getDest(), getSrc(0), getSrc(1)); |
| 817 } |
| 818 |
| 819 template <> void InstMIPS32Sub_d::emitIAS(const Cfg *Func) const { |
| 820 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 821 Asm->sub_d(getDest(), getSrc(0), getSrc(1)); |
| 822 } |
| 823 |
| 824 template <> void InstMIPS32Sub_s::emitIAS(const Cfg *Func) const { |
| 825 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 826 Asm->sub_s(getDest(), getSrc(0), getSrc(1)); |
| 827 } |
| 828 |
789 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const { | 829 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const { |
790 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 830 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
791 Asm->addiu(getDest(), getSrc(0), Imm); | 831 Asm->addiu(getDest(), getSrc(0), Imm); |
792 } | 832 } |
793 | 833 |
794 template <> void InstMIPS32Slti::emitIAS(const Cfg *Func) const { | 834 template <> void InstMIPS32Slti::emitIAS(const Cfg *Func) const { |
795 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 835 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
796 Asm->slti(getDest(), getSrc(0), Imm); | 836 Asm->slti(getDest(), getSrc(0), Imm); |
797 } | 837 } |
798 | 838 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { | 912 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { |
873 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 913 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
874 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); | 914 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
875 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 915 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
876 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 916 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
877 Asm->lw(getDest(), Mem->getBase(), Imm); | 917 Asm->lw(getDest(), Mem->getBase(), Imm); |
878 } | 918 } |
879 | 919 |
880 } // end of namespace MIPS32 | 920 } // end of namespace MIPS32 |
881 } // end of namespace Ice | 921 } // end of namespace Ice |
OLD | NEW |