OLD | NEW |
---|---|
1 //===- subzero/src/IceAssemblerMIPS32.cpp - MIPS32 Assembler --------------===// | 1 //===- subzero/src/IceAssemblerMIPS32.cpp - MIPS32 Assembler --------------===// |
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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
689 } else { | 689 } else { |
690 llvm::report_fatal_error("ldc1: Invalid 2nd operand"); | 690 llvm::report_fatal_error("ldc1: Invalid 2nd operand"); |
691 } | 691 } |
692 | 692 |
693 Opcode |= Base << 21; | 693 Opcode |= Base << 21; |
694 Opcode |= Rt << 16; | 694 Opcode |= Rt << 16; |
695 Opcode |= Imm16; | 695 Opcode |= Imm16; |
696 emitInst(Opcode); | 696 emitInst(Opcode); |
697 } | 697 } |
698 | 698 |
699 void AssemblerMIPS32::ll(const Operand *OpRt, const Operand *OpBase, | |
700 const uint32_t Offset) { | |
701 static constexpr IValueT Opcode = 0xC0000000; | |
702 emitRtRsImm16(Opcode, OpRt, OpBase, Offset, "ll"); | |
703 } | |
704 | |
699 void AssemblerMIPS32::lw(const Operand *OpRt, const Operand *OpBase, | 705 void AssemblerMIPS32::lw(const Operand *OpRt, const Operand *OpBase, |
700 const uint32_t Offset) { | 706 const uint32_t Offset) { |
701 switch (OpRt->getType()) { | 707 switch (OpRt->getType()) { |
702 case IceType_i1: | 708 case IceType_i1: |
703 case IceType_i8: { | 709 case IceType_i8: { |
704 static constexpr IValueT Opcode = 0x80000000; | 710 static constexpr IValueT Opcode = 0x80000000; |
705 emitRtRsImm16(Opcode, OpRt, OpBase, Offset, "lb"); | 711 emitRtRsImm16(Opcode, OpRt, OpBase, Offset, "lb"); |
706 break; | 712 break; |
707 } | 713 } |
708 case IceType_i16: { | 714 case IceType_i16: { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
952 static constexpr IValueT Opcode = 0x34000000; | 958 static constexpr IValueT Opcode = 0x34000000; |
953 emitRtRsImm16(Opcode, OpRt, OpRs, Imm, "ori"); | 959 emitRtRsImm16(Opcode, OpRt, OpRs, Imm, "ori"); |
954 } | 960 } |
955 | 961 |
956 void AssemblerMIPS32::ret(void) { | 962 void AssemblerMIPS32::ret(void) { |
957 static constexpr IValueT Opcode = 0x03E00008; // JR $31 | 963 static constexpr IValueT Opcode = 0x03E00008; // JR $31 |
958 emitInst(Opcode); | 964 emitInst(Opcode); |
959 nop(); // delay slot | 965 nop(); // delay slot |
960 } | 966 } |
961 | 967 |
968 void AssemblerMIPS32::sc(const Operand *OpRt, const Operand *OpBase, | |
969 const uint32_t Offset) { | |
970 static constexpr IValueT Opcode = 0xE0000000; | |
971 emitRtRsImm16(Opcode, OpRt, OpBase, Offset, "sc"); | |
972 } | |
973 | |
962 void AssemblerMIPS32::sll(const Operand *OpRd, const Operand *OpRt, | 974 void AssemblerMIPS32::sll(const Operand *OpRd, const Operand *OpRt, |
963 const uint32_t Sa) { | 975 const uint32_t Sa) { |
964 static constexpr IValueT Opcode = 0x00000000; | 976 static constexpr IValueT Opcode = 0x00000000; |
965 emitRdRtSa(Opcode, OpRd, OpRt, Sa, "sll"); | 977 emitRdRtSa(Opcode, OpRd, OpRt, Sa, "sll"); |
966 } | 978 } |
967 | 979 |
968 void AssemblerMIPS32::sllv(const Operand *OpRd, const Operand *OpRt, | 980 void AssemblerMIPS32::sllv(const Operand *OpRd, const Operand *OpRt, |
969 const Operand *OpRs) { | 981 const Operand *OpRs) { |
970 static constexpr IValueT Opcode = 0x00000004; | 982 static constexpr IValueT Opcode = 0x00000004; |
971 emitRdRsRt(Opcode, OpRd, OpRs, OpRt, "sllv"); | 983 emitRdRsRt(Opcode, OpRd, OpRs, OpRt, "sllv"); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 } else { | 1127 } else { |
1116 llvm::report_fatal_error("swc1: Invalid 2nd operand"); | 1128 llvm::report_fatal_error("swc1: Invalid 2nd operand"); |
1117 } | 1129 } |
1118 | 1130 |
1119 Opcode |= Base << 21; | 1131 Opcode |= Base << 21; |
1120 Opcode |= Rt << 16; | 1132 Opcode |= Rt << 16; |
1121 Opcode |= Imm16; | 1133 Opcode |= Imm16; |
1122 emitInst(Opcode); | 1134 emitInst(Opcode); |
1123 } | 1135 } |
1124 | 1136 |
1137 void AssemblerMIPS32::sync() { | |
1138 IValueT Opcode = 0x0000000f; | |
Jim Stichnoth
2016/11/17 05:35:38
static constexpr like the others?
sagar.thakur
2016/11/17 10:57:28
Done.
| |
1139 emitInst(Opcode); | |
1140 } | |
1141 | |
1125 void AssemblerMIPS32::teq(const Operand *OpRs, const Operand *OpRt, | 1142 void AssemblerMIPS32::teq(const Operand *OpRs, const Operand *OpRt, |
1126 const uint32_t TrapCode) { | 1143 const uint32_t TrapCode) { |
1127 IValueT Opcode = 0x00000034; | 1144 IValueT Opcode = 0x00000034; |
1128 const IValueT Rs = encodeGPRegister(OpRs, "Rs", "teq"); | 1145 const IValueT Rs = encodeGPRegister(OpRs, "Rs", "teq"); |
1129 const IValueT Rt = encodeGPRegister(OpRt, "Rt", "teq"); | 1146 const IValueT Rt = encodeGPRegister(OpRt, "Rt", "teq"); |
1130 Opcode |= (TrapCode & 0xFFFFF) << 6; | 1147 Opcode |= (TrapCode & 0xFFFFF) << 6; |
1131 Opcode |= Rt << 16; | 1148 Opcode |= Rt << 16; |
1132 Opcode |= Rs << 21; | 1149 Opcode |= Rs << 21; |
1133 emitInst(Opcode); | 1150 emitInst(Opcode); |
1134 } | 1151 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1234 emitBr(Cond, OpRs, OpRtNone, Dest); | 1251 emitBr(Cond, OpRs, OpRtNone, Dest); |
1235 return; | 1252 return; |
1236 } | 1253 } |
1237 const IOffsetT Position = Buffer.size(); | 1254 const IOffsetT Position = Buffer.size(); |
1238 emitBr(Cond, OpRs, OpRtNone, TargetLabel->getEncodedPosition()); | 1255 emitBr(Cond, OpRs, OpRtNone, TargetLabel->getEncodedPosition()); |
1239 TargetLabel->linkTo(*this, Position); | 1256 TargetLabel->linkTo(*this, Position); |
1240 } | 1257 } |
1241 | 1258 |
1242 } // end of namespace MIPS32 | 1259 } // end of namespace MIPS32 |
1243 } // end of namespace Ice | 1260 } // end of namespace Ice |
OLD | NEW |