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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 Vars = &this->Base; | 55 Vars = &this->Base; |
56 } | 56 } |
57 | 57 |
58 const char *InstMIPS32::getWidthString(Type Ty) { | 58 const char *InstMIPS32::getWidthString(Type Ty) { |
59 (void)Ty; | 59 (void)Ty; |
60 return "TBD"; | 60 return "TBD"; |
61 } | 61 } |
62 | 62 |
63 template <> const char *InstMIPS32Abs_d::Opcode = "abs.d"; | 63 template <> const char *InstMIPS32Abs_d::Opcode = "abs.d"; |
64 template <> const char *InstMIPS32Abs_s::Opcode = "abs.s"; | 64 template <> const char *InstMIPS32Abs_s::Opcode = "abs.s"; |
| 65 template <> const char *InstMIPS32Addi::Opcode = "addi"; |
65 template <> const char *InstMIPS32Add::Opcode = "add"; | 66 template <> const char *InstMIPS32Add::Opcode = "add"; |
66 template <> const char *InstMIPS32Add_d::Opcode = "add.d"; | 67 template <> const char *InstMIPS32Add_d::Opcode = "add.d"; |
67 template <> const char *InstMIPS32Add_s::Opcode = "add.s"; | 68 template <> const char *InstMIPS32Add_s::Opcode = "add.s"; |
68 template <> const char *InstMIPS32Addiu::Opcode = "addiu"; | 69 template <> const char *InstMIPS32Addiu::Opcode = "addiu"; |
69 template <> const char *InstMIPS32Addu::Opcode = "addu"; | 70 template <> const char *InstMIPS32Addu::Opcode = "addu"; |
70 template <> const char *InstMIPS32And::Opcode = "and"; | 71 template <> const char *InstMIPS32And::Opcode = "and"; |
71 template <> const char *InstMIPS32Andi::Opcode = "andi"; | 72 template <> const char *InstMIPS32Andi::Opcode = "andi"; |
72 template <> const char *InstMIPS32C_eq_d::Opcode = "c.eq.d"; | 73 template <> const char *InstMIPS32C_eq_d::Opcode = "c.eq.d"; |
73 template <> const char *InstMIPS32C_eq_s::Opcode = "c.eq.s"; | 74 template <> const char *InstMIPS32C_eq_s::Opcode = "c.eq.s"; |
74 template <> const char *InstMIPS32C_ole_d::Opcode = "c.ole.d"; | 75 template <> const char *InstMIPS32C_ole_d::Opcode = "c.ole.d"; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 if (!BuildDefs::dump()) | 537 if (!BuildDefs::dump()) |
537 return; | 538 return; |
538 Ostream &Str = Func->getContext()->getStrEmit(); | 539 Ostream &Str = Func->getContext()->getStrEmit(); |
539 assert(getSrcSize() == 1); | 540 assert(getSrcSize() == 1); |
540 if (llvm::isa<ConstantInteger32>(getCallTarget())) { | 541 if (llvm::isa<ConstantInteger32>(getCallTarget())) { |
541 // This shouldn't happen (typically have to copy the full 32-bits to a | 542 // This shouldn't happen (typically have to copy the full 32-bits to a |
542 // register and do an indirect jump). | 543 // register and do an indirect jump). |
543 llvm::report_fatal_error("MIPS2Call to ConstantInteger32"); | 544 llvm::report_fatal_error("MIPS2Call to ConstantInteger32"); |
544 } else if (const auto *CallTarget = | 545 } else if (const auto *CallTarget = |
545 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { | 546 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { |
546 // Calls only have 24-bits, but the linker should insert veneers to extend | 547 // Calls only have 26-bits, but the linker should insert veneers to extend |
547 // the range if needed. | 548 // the range if needed. |
548 Str << "\t" | 549 Str << "\t" |
549 "jal" | 550 "jal" |
550 "\t"; | 551 "\t"; |
551 CallTarget->emitWithoutPrefix(Func->getTarget()); | 552 CallTarget->emitWithoutPrefix(Func->getTarget()); |
552 } else { | 553 } else { |
553 Str << "\t" | 554 Str << "\t" |
554 "jal" | 555 "jal" |
555 "\t"; | 556 "\t"; |
556 getCallTarget()->emit(Func); | 557 getCallTarget()->emit(Func); |
557 } | 558 } |
558 } | 559 } |
559 | 560 |
560 void InstMIPS32Call::emitIAS(const Cfg *Func) const { | 561 void InstMIPS32Call::emitIAS(const Cfg *Func) const { |
561 (void)Func; | 562 assert(getSrcSize() == 1); |
562 llvm_unreachable("Not yet implemented"); | 563 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 564 if (const auto *CallTarget = |
| 565 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { |
| 566 Asm->jal(CallTarget); |
| 567 } else { |
| 568 llvm::report_fatal_error("MIPS32Call: Invalid operand"); |
| 569 } |
563 } | 570 } |
564 | 571 |
565 void InstMIPS32Call::dump(const Cfg *Func) const { | 572 void InstMIPS32Call::dump(const Cfg *Func) const { |
566 if (!BuildDefs::dump()) | 573 if (!BuildDefs::dump()) |
567 return; | 574 return; |
568 Ostream &Str = Func->getContext()->getStrDump(); | 575 Ostream &Str = Func->getContext()->getStrDump(); |
569 if (getDest()) { | 576 if (getDest()) { |
570 dumpDest(Func); | 577 dumpDest(Func); |
571 Str << " = "; | 578 Str << " = "; |
572 } | 579 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 Str << "\t" << ActualOpcode << "\t"; | 656 Str << "\t" << ActualOpcode << "\t"; |
650 getDest()->emit(Func); | 657 getDest()->emit(Func); |
651 Str << ", "; | 658 Str << ", "; |
652 getSrc(0)->emit(Func); | 659 getSrc(0)->emit(Func); |
653 return; | 660 return; |
654 } | 661 } |
655 | 662 |
656 llvm::report_fatal_error("Invalid mov instruction. Dest or Src is memory."); | 663 llvm::report_fatal_error("Invalid mov instruction. Dest or Src is memory."); |
657 } | 664 } |
658 | 665 |
659 // TODO(jaydeep.patil) Handle all types of operands in mov | |
660 void InstMIPS32Mov::emitIAS(const Cfg *Func) const { | 666 void InstMIPS32Mov::emitIAS(const Cfg *Func) const { |
661 Variable *Dest = getDest(); | 667 Variable *Dest = getDest(); |
662 Operand *Src = getSrc(0); | 668 Operand *Src = getSrc(0); |
663 auto *SrcV = llvm::dyn_cast<Variable>(Src); | 669 auto *SrcV = llvm::dyn_cast<Variable>(Src); |
664 assert(!llvm::isa<Constant>(Src)); | 670 assert(!llvm::isa<Constant>(Src)); |
665 const bool DestIsReg = Dest->hasReg(); | 671 const bool DestIsReg = Dest->hasReg(); |
666 const bool SrcIsReg = (SrcV && SrcV->hasReg()); | 672 const bool SrcIsReg = (SrcV && SrcV->hasReg()); |
667 | 673 |
668 // reg to reg | 674 // reg to reg |
669 if (DestIsReg && SrcIsReg) { | 675 if (DestIsReg && SrcIsReg) { |
670 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 676 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
671 Asm->move(getDest(), getSrc(0)); | 677 Asm->move(getDest(), getSrc(0)); |
672 return; | 678 return; |
673 } | 679 } |
674 llvm_unreachable("Not yet implemented"); | 680 |
| 681 llvm::report_fatal_error("InstMIPS32Mov invalid operands"); |
675 } | 682 } |
676 | 683 |
677 void InstMIPS32Mov::dump(const Cfg *Func) const { | 684 void InstMIPS32Mov::dump(const Cfg *Func) const { |
678 if (!BuildDefs::dump()) | 685 if (!BuildDefs::dump()) |
679 return; | 686 return; |
680 assert(getSrcSize() == 1 || getSrcSize() == 2); | 687 assert(getSrcSize() == 1 || getSrcSize() == 2); |
681 Ostream &Str = Func->getContext()->getStrDump(); | 688 Ostream &Str = Func->getContext()->getStrDump(); |
682 Variable *Dest = getDest(); | 689 Variable *Dest = getDest(); |
683 Variable *DestHi = getDestHi(); | 690 Variable *DestHi = getDestHi(); |
684 Dest->dump(Func); | 691 Dest->dump(Func); |
685 if (DestHi) { | 692 if (DestHi) { |
686 Str << ", "; | 693 Str << ", "; |
687 DestHi->dump(Func); | 694 DestHi->dump(Func); |
688 } | 695 } |
689 dumpOpcode(Str, " = mov", getDest()->getType()); | 696 dumpOpcode(Str, " = mov", getDest()->getType()); |
690 Str << " "; | 697 Str << " "; |
691 dumpSources(Func); | 698 dumpSources(Func); |
692 } | 699 } |
693 | 700 |
694 template <> void InstMIPS32Abs_d::emitIAS(const Cfg *Func) const { | 701 template <> void InstMIPS32Abs_d::emitIAS(const Cfg *Func) const { |
695 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 702 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
696 Asm->abs_d(getDest(), getSrc(0)); | 703 Asm->abs_d(getDest(), getSrc(0)); |
697 } | 704 } |
698 | 705 |
699 template <> void InstMIPS32Abs_s::emitIAS(const Cfg *Func) const { | 706 template <> void InstMIPS32Abs_s::emitIAS(const Cfg *Func) const { |
700 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 707 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
701 Asm->abs_s(getDest(), getSrc(0)); | 708 Asm->abs_s(getDest(), getSrc(0)); |
702 } | 709 } |
703 | 710 |
| 711 template <> void InstMIPS32Addi::emitIAS(const Cfg *Func) const { |
| 712 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 713 Asm->addi(getDest(), getSrc(0), Imm); |
| 714 } |
| 715 |
704 template <> void InstMIPS32Add_d::emitIAS(const Cfg *Func) const { | 716 template <> void InstMIPS32Add_d::emitIAS(const Cfg *Func) const { |
705 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 717 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
706 Asm->add_d(getDest(), getSrc(0), getSrc(1)); | 718 Asm->add_d(getDest(), getSrc(0), getSrc(1)); |
707 } | 719 } |
708 | 720 |
709 template <> void InstMIPS32Add_s::emitIAS(const Cfg *Func) const { | 721 template <> void InstMIPS32Add_s::emitIAS(const Cfg *Func) const { |
710 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 722 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
711 Asm->add_s(getDest(), getSrc(0), getSrc(1)); | 723 Asm->add_s(getDest(), getSrc(0), getSrc(1)); |
712 } | 724 } |
713 | 725 |
714 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const { | 726 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const { |
715 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 727 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
716 Asm->addiu(getDest(), getSrc(0), Imm); | 728 if (Reloc == RO_No) { |
| 729 Asm->addiu(getDest(), getSrc(0), Imm); |
| 730 } else { |
| 731 Asm->addiu(getDest(), getSrc(0), getSrc(1), Reloc); |
| 732 } |
717 } | 733 } |
718 | 734 |
719 template <> void InstMIPS32Addu::emitIAS(const Cfg *Func) const { | 735 template <> void InstMIPS32Addu::emitIAS(const Cfg *Func) const { |
720 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 736 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
721 Asm->addu(getDest(), getSrc(0), getSrc(1)); | 737 Asm->addu(getDest(), getSrc(0), getSrc(1)); |
722 } | 738 } |
723 | 739 |
724 template <> void InstMIPS32And::emitIAS(const Cfg *Func) const { | 740 template <> void InstMIPS32And::emitIAS(const Cfg *Func) const { |
725 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 741 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
726 Asm->and_(getDest(), getSrc(0), getSrc(1)); | 742 Asm->and_(getDest(), getSrc(0), getSrc(1)); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 Asm->cvt_s_l(getDest(), getSrc(0)); | 847 Asm->cvt_s_l(getDest(), getSrc(0)); |
832 } | 848 } |
833 | 849 |
834 template <> void InstMIPS32Cvt_s_w::emitIAS(const Cfg *Func) const { | 850 template <> void InstMIPS32Cvt_s_w::emitIAS(const Cfg *Func) const { |
835 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 851 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
836 Asm->cvt_s_w(getDest(), getSrc(0)); | 852 Asm->cvt_s_w(getDest(), getSrc(0)); |
837 } | 853 } |
838 | 854 |
839 template <> void InstMIPS32Div::emitIAS(const Cfg *Func) const { | 855 template <> void InstMIPS32Div::emitIAS(const Cfg *Func) const { |
840 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 856 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
841 Asm->div(getDest(), getSrc(0)); | 857 Asm->div(getSrc(0), getSrc(1)); |
842 } | 858 } |
843 | 859 |
844 template <> void InstMIPS32Div_d::emitIAS(const Cfg *Func) const { | 860 template <> void InstMIPS32Div_d::emitIAS(const Cfg *Func) const { |
845 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 861 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
846 Asm->div_d(getDest(), getSrc(0), getSrc(1)); | 862 Asm->div_d(getDest(), getSrc(0), getSrc(1)); |
847 } | 863 } |
848 | 864 |
849 template <> void InstMIPS32Div_s::emitIAS(const Cfg *Func) const { | 865 template <> void InstMIPS32Div_s::emitIAS(const Cfg *Func) const { |
850 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 866 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
851 Asm->div_s(getDest(), getSrc(0), getSrc(1)); | 867 Asm->div_s(getDest(), getSrc(0), getSrc(1)); |
852 } | 868 } |
853 | 869 |
854 template <> void InstMIPS32Divu::emitIAS(const Cfg *Func) const { | 870 template <> void InstMIPS32Divu::emitIAS(const Cfg *Func) const { |
855 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 871 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
856 Asm->divu(getDest(), getSrc(0)); | 872 Asm->divu(getSrc(0), getSrc(1)); |
857 } | 873 } |
858 | 874 |
859 template <> void InstMIPS32Lui::emitIAS(const Cfg *Func) const { | 875 template <> void InstMIPS32Lui::emitIAS(const Cfg *Func) const { |
860 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 876 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
861 auto *C32 = llvm::dyn_cast<ConstantInteger32>(getSrc(0)); | 877 Asm->lui(getDest(), getSrc(0), Reloc); |
862 uint16_t Imm = static_cast<uint16_t>(C32->getValue()); | 878 } |
863 Asm->lui(getDest(), Imm); | 879 |
| 880 template <> void InstMIPS32Ldc1::emitIAS(const Cfg *Func) const { |
| 881 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 882 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
| 883 Asm->ldc1(getDest(), Mem->getBase(), Mem->getOffset(), Reloc); |
864 } | 884 } |
865 | 885 |
866 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { | 886 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { |
867 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 887 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
868 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); | 888 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
869 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 889 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
870 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 890 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
871 Asm->lw(getDest(), Mem->getBase(), Imm); | 891 Asm->lw(getDest(), Mem->getBase(), Imm); |
872 } | 892 } |
873 | 893 |
| 894 template <> void InstMIPS32Lwc1::emitIAS(const Cfg *Func) const { |
| 895 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 896 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
| 897 Asm->lwc1(getDest(), Mem->getBase(), Mem->getOffset(), Reloc); |
| 898 } |
| 899 |
874 template <> void InstMIPS32Mfc1::emitIAS(const Cfg *Func) const { | 900 template <> void InstMIPS32Mfc1::emitIAS(const Cfg *Func) const { |
875 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 901 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
876 Asm->mfc1(getDest(), getSrc(0)); | 902 Asm->mfc1(getDest(), getSrc(0)); |
877 } | 903 } |
878 | 904 |
879 template <> void InstMIPS32Mflo::emit(const Cfg *Func) const { | 905 template <> void InstMIPS32Mflo::emit(const Cfg *Func) const { |
880 if (!BuildDefs::dump()) | 906 if (!BuildDefs::dump()) |
881 return; | 907 return; |
882 emitUnaryopGPRFLoHi(Opcode, this, Func); | 908 emitUnaryopGPRFLoHi(Opcode, this, Func); |
883 } | 909 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 Ostream &Str = Func->getContext()->getStrEmit(); | 980 Ostream &Str = Func->getContext()->getStrEmit(); |
955 assert(getSrcSize() == 1); | 981 assert(getSrcSize() == 1); |
956 Str << "\t" << Opcode << "\t"; | 982 Str << "\t" << Opcode << "\t"; |
957 getSrc(0)->emit(Func); | 983 getSrc(0)->emit(Func); |
958 Str << ", "; | 984 Str << ", "; |
959 getDest()->emit(Func); | 985 getDest()->emit(Func); |
960 } | 986 } |
961 | 987 |
962 template <> void InstMIPS32Mtc1::emitIAS(const Cfg *Func) const { | 988 template <> void InstMIPS32Mtc1::emitIAS(const Cfg *Func) const { |
963 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 989 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
964 Asm->mtc1(getDest(), getSrc(0)); | 990 Asm->mtc1(getSrc(0), getDest()); |
965 } | 991 } |
966 | 992 |
967 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const { | 993 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const { |
968 if (!BuildDefs::dump()) | 994 if (!BuildDefs::dump()) |
969 return; | 995 return; |
970 emitUnaryopGPRTLoHi(Opcode, this, Func); | 996 emitUnaryopGPRTLoHi(Opcode, this, Func); |
971 } | 997 } |
972 | 998 |
973 template <> void InstMIPS32Mtlo::emitIAS(const Cfg *Func) const { | 999 template <> void InstMIPS32Mtlo::emitIAS(const Cfg *Func) const { |
974 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1000 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
(...skipping 25 matching lines...) Expand all Loading... |
1000 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1026 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1001 Asm->mul_s(getDest(), getSrc(0), getSrc(1)); | 1027 Asm->mul_s(getDest(), getSrc(0), getSrc(1)); |
1002 } | 1028 } |
1003 | 1029 |
1004 template <> void InstMIPS32Mult::emit(const Cfg *Func) const { | 1030 template <> void InstMIPS32Mult::emit(const Cfg *Func) const { |
1005 if (!BuildDefs::dump()) | 1031 if (!BuildDefs::dump()) |
1006 return; | 1032 return; |
1007 emitThreeAddrLoHi(Opcode, this, Func); | 1033 emitThreeAddrLoHi(Opcode, this, Func); |
1008 } | 1034 } |
1009 | 1035 |
| 1036 template <> void InstMIPS32Mult::emitIAS(const Cfg *Func) const { |
| 1037 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1038 Asm->mult(getDest(), getSrc(0)); |
| 1039 } |
| 1040 |
1010 template <> void InstMIPS32Multu::emit(const Cfg *Func) const { | 1041 template <> void InstMIPS32Multu::emit(const Cfg *Func) const { |
1011 if (!BuildDefs::dump()) | 1042 if (!BuildDefs::dump()) |
1012 return; | 1043 return; |
1013 emitThreeAddrLoHi(Opcode, this, Func); | 1044 emitThreeAddrLoHi(Opcode, this, Func); |
1014 } | 1045 } |
1015 | 1046 |
1016 template <> void InstMIPS32Multu::emitIAS(const Cfg *Func) const { | 1047 template <> void InstMIPS32Multu::emitIAS(const Cfg *Func) const { |
1017 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1048 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1018 Asm->multu(getDest(), getSrc(0)); | 1049 Asm->multu(getSrc(0), getSrc(1)); |
1019 } | 1050 } |
1020 | 1051 |
1021 template <> void InstMIPS32Nor::emitIAS(const Cfg *Func) const { | 1052 template <> void InstMIPS32Nor::emitIAS(const Cfg *Func) const { |
1022 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1053 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1023 Asm->nor(getDest(), getSrc(0), getSrc(1)); | 1054 Asm->nor(getDest(), getSrc(0), getSrc(1)); |
1024 } | 1055 } |
1025 | 1056 |
1026 template <> void InstMIPS32Or::emitIAS(const Cfg *Func) const { | 1057 template <> void InstMIPS32Or::emitIAS(const Cfg *Func) const { |
1027 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1058 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1028 Asm->or_(getDest(), getSrc(0), getSrc(1)); | 1059 Asm->or_(getDest(), getSrc(0), getSrc(1)); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 template <> void InstMIPS32Sub_s::emitIAS(const Cfg *Func) const { | 1132 template <> void InstMIPS32Sub_s::emitIAS(const Cfg *Func) const { |
1102 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1133 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1103 Asm->sub_s(getDest(), getSrc(0), getSrc(1)); | 1134 Asm->sub_s(getDest(), getSrc(0), getSrc(1)); |
1104 } | 1135 } |
1105 | 1136 |
1106 template <> void InstMIPS32Subu::emitIAS(const Cfg *Func) const { | 1137 template <> void InstMIPS32Subu::emitIAS(const Cfg *Func) const { |
1107 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1138 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1108 Asm->subu(getDest(), getSrc(0), getSrc(1)); | 1139 Asm->subu(getDest(), getSrc(0), getSrc(1)); |
1109 } | 1140 } |
1110 | 1141 |
| 1142 template <> void InstMIPS32Sdc1::emitIAS(const Cfg *Func) const { |
| 1143 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1144 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
| 1145 Asm->sdc1(getSrc(0), Mem->getBase(), Mem->getOffset(), Reloc); |
| 1146 } |
| 1147 |
1111 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const { | 1148 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const { |
1112 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1149 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1113 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(1)); | 1150 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(1)); |
1114 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 1151 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
1115 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 1152 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
1116 Asm->sw(getSrc(0), Mem->getBase(), Imm); | 1153 Asm->sw(getSrc(0), Mem->getBase(), Imm); |
1117 } | 1154 } |
1118 | 1155 |
| 1156 template <> void InstMIPS32Swc1::emitIAS(const Cfg *Func) const { |
| 1157 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1158 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
| 1159 Asm->swc1(getSrc(0), Mem->getBase(), Mem->getOffset(), Reloc); |
| 1160 } |
| 1161 |
1119 template <> void InstMIPS32Teq::emitIAS(const Cfg *Func) const { | 1162 template <> void InstMIPS32Teq::emitIAS(const Cfg *Func) const { |
1120 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1163 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1121 Asm->teq(getSrc(0), getSrc(1), getTrapCode()); | 1164 Asm->teq(getSrc(0), getSrc(1), getTrapCode()); |
1122 } | 1165 } |
1123 | 1166 |
1124 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const { | 1167 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const { |
1125 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1168 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1126 Asm->trunc_l_d(getDest(), getSrc(0)); | 1169 Asm->trunc_l_d(getDest(), getSrc(0)); |
1127 } | 1170 } |
1128 | 1171 |
(...skipping 17 matching lines...) Expand all Loading... |
1146 Asm->xor_(getDest(), getSrc(0), getSrc(1)); | 1189 Asm->xor_(getDest(), getSrc(0), getSrc(1)); |
1147 } | 1190 } |
1148 | 1191 |
1149 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { | 1192 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { |
1150 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1193 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1151 Asm->xori(getDest(), getSrc(0), Imm); | 1194 Asm->xori(getDest(), getSrc(0), Imm); |
1152 } | 1195 } |
1153 | 1196 |
1154 } // end of namespace MIPS32 | 1197 } // end of namespace MIPS32 |
1155 } // end of namespace Ice | 1198 } // end of namespace Ice |
OLD | NEW |