| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
| 6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
| 7 #include "src/globals.h" | 7 #include "src/globals.h" |
| 8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
| 9 #ifdef DEBUG | 9 #ifdef DEBUG |
| 10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 const int kOpcodeShift = 26; | 254 const int kOpcodeShift = 26; |
| 255 const int kOpcodeBits = 6; | 255 const int kOpcodeBits = 6; |
| 256 const int kRsShift = 21; | 256 const int kRsShift = 21; |
| 257 const int kRsBits = 5; | 257 const int kRsBits = 5; |
| 258 const int kRtShift = 16; | 258 const int kRtShift = 16; |
| 259 const int kRtBits = 5; | 259 const int kRtBits = 5; |
| 260 const int kRdShift = 11; | 260 const int kRdShift = 11; |
| 261 const int kRdBits = 5; | 261 const int kRdBits = 5; |
| 262 const int kSaShift = 6; | 262 const int kSaShift = 6; |
| 263 const int kSaBits = 5; | 263 const int kSaBits = 5; |
| 264 const int kLsaSaBits = 2; |
| 264 const int kFunctionShift = 0; | 265 const int kFunctionShift = 0; |
| 265 const int kFunctionBits = 6; | 266 const int kFunctionBits = 6; |
| 266 const int kLuiShift = 16; | 267 const int kLuiShift = 16; |
| 267 const int kBp2Shift = 6; | 268 const int kBp2Shift = 6; |
| 268 const int kBp2Bits = 2; | 269 const int kBp2Bits = 2; |
| 269 | 270 |
| 270 const int kImm16Shift = 0; | 271 const int kImm16Shift = 0; |
| 271 const int kImm16Bits = 16; | 272 const int kImm16Bits = 16; |
| 272 const int kImm18Shift = 0; | 273 const int kImm18Shift = 0; |
| 273 const int kImm18Bits = 18; | 274 const int kImm18Bits = 18; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 POP30 = DADDI, // bnezalc, bvnc, bnec | 393 POP30 = DADDI, // bnezalc, bvnc, bnec |
| 393 }; | 394 }; |
| 394 | 395 |
| 395 enum SecondaryField : uint32_t { | 396 enum SecondaryField : uint32_t { |
| 396 // SPECIAL Encoding of Function Field. | 397 // SPECIAL Encoding of Function Field. |
| 397 SLL = ((0U << 3) + 0), | 398 SLL = ((0U << 3) + 0), |
| 398 MOVCI = ((0U << 3) + 1), | 399 MOVCI = ((0U << 3) + 1), |
| 399 SRL = ((0U << 3) + 2), | 400 SRL = ((0U << 3) + 2), |
| 400 SRA = ((0U << 3) + 3), | 401 SRA = ((0U << 3) + 3), |
| 401 SLLV = ((0U << 3) + 4), | 402 SLLV = ((0U << 3) + 4), |
| 403 LSA = ((0U << 3) + 5), |
| 402 SRLV = ((0U << 3) + 6), | 404 SRLV = ((0U << 3) + 6), |
| 403 SRAV = ((0U << 3) + 7), | 405 SRAV = ((0U << 3) + 7), |
| 404 | 406 |
| 405 JR = ((1U << 3) + 0), | 407 JR = ((1U << 3) + 0), |
| 406 JALR = ((1U << 3) + 1), | 408 JALR = ((1U << 3) + 1), |
| 407 MOVZ = ((1U << 3) + 2), | 409 MOVZ = ((1U << 3) + 2), |
| 408 MOVN = ((1U << 3) + 3), | 410 MOVN = ((1U << 3) + 3), |
| 409 BREAK = ((1U << 3) + 5), | 411 BREAK = ((1U << 3) + 5), |
| 410 | 412 |
| 411 MFHI = ((2U << 3) + 0), | 413 MFHI = ((2U << 3) + 0), |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 OpcodeToBitNumber(PCREL) | OpcodeToBitNumber(BC) | | 906 OpcodeToBitNumber(PCREL) | OpcodeToBitNumber(BC) | |
| 905 OpcodeToBitNumber(BALC); | 907 OpcodeToBitNumber(BALC); |
| 906 | 908 |
| 907 #define FunctionFieldToBitNumber(function) (1ULL << function) | 909 #define FunctionFieldToBitNumber(function) (1ULL << function) |
| 908 | 910 |
| 909 static const uint64_t kFunctionFieldRegisterTypeMask = | 911 static const uint64_t kFunctionFieldRegisterTypeMask = |
| 910 FunctionFieldToBitNumber(JR) | FunctionFieldToBitNumber(JALR) | | 912 FunctionFieldToBitNumber(JR) | FunctionFieldToBitNumber(JALR) | |
| 911 FunctionFieldToBitNumber(BREAK) | FunctionFieldToBitNumber(SLL) | | 913 FunctionFieldToBitNumber(BREAK) | FunctionFieldToBitNumber(SLL) | |
| 912 FunctionFieldToBitNumber(SRL) | FunctionFieldToBitNumber(SRA) | | 914 FunctionFieldToBitNumber(SRL) | FunctionFieldToBitNumber(SRA) | |
| 913 FunctionFieldToBitNumber(SLLV) | FunctionFieldToBitNumber(SRLV) | | 915 FunctionFieldToBitNumber(SLLV) | FunctionFieldToBitNumber(SRLV) | |
| 914 FunctionFieldToBitNumber(SRAV) | FunctionFieldToBitNumber(MFHI) | | 916 FunctionFieldToBitNumber(SRAV) | FunctionFieldToBitNumber(LSA) | |
| 915 FunctionFieldToBitNumber(MFLO) | FunctionFieldToBitNumber(MULT) | | 917 FunctionFieldToBitNumber(MFHI) | FunctionFieldToBitNumber(MFLO) | |
| 916 FunctionFieldToBitNumber(MULTU) | FunctionFieldToBitNumber(DIV) | | 918 FunctionFieldToBitNumber(MULT) | FunctionFieldToBitNumber(MULTU) | |
| 917 FunctionFieldToBitNumber(DIVU) | FunctionFieldToBitNumber(ADD) | | 919 FunctionFieldToBitNumber(DIV) | FunctionFieldToBitNumber(DIVU) | |
| 918 FunctionFieldToBitNumber(ADDU) | FunctionFieldToBitNumber(SUB) | | 920 FunctionFieldToBitNumber(ADD) | FunctionFieldToBitNumber(ADDU) | |
| 919 FunctionFieldToBitNumber(SUBU) | FunctionFieldToBitNumber(AND) | | 921 FunctionFieldToBitNumber(SUB) | FunctionFieldToBitNumber(SUBU) | |
| 920 FunctionFieldToBitNumber(OR) | FunctionFieldToBitNumber(XOR) | | 922 FunctionFieldToBitNumber(AND) | FunctionFieldToBitNumber(OR) | |
| 921 FunctionFieldToBitNumber(NOR) | FunctionFieldToBitNumber(SLT) | | 923 FunctionFieldToBitNumber(XOR) | FunctionFieldToBitNumber(NOR) | |
| 922 FunctionFieldToBitNumber(SLTU) | FunctionFieldToBitNumber(TGE) | | 924 FunctionFieldToBitNumber(SLT) | FunctionFieldToBitNumber(SLTU) | |
| 923 FunctionFieldToBitNumber(TGEU) | FunctionFieldToBitNumber(TLT) | | 925 FunctionFieldToBitNumber(TGE) | FunctionFieldToBitNumber(TGEU) | |
| 924 FunctionFieldToBitNumber(TLTU) | FunctionFieldToBitNumber(TEQ) | | 926 FunctionFieldToBitNumber(TLT) | FunctionFieldToBitNumber(TLTU) | |
| 925 FunctionFieldToBitNumber(TNE) | FunctionFieldToBitNumber(MOVZ) | | 927 FunctionFieldToBitNumber(TEQ) | FunctionFieldToBitNumber(TNE) | |
| 926 FunctionFieldToBitNumber(MOVN) | FunctionFieldToBitNumber(MOVCI) | | 928 FunctionFieldToBitNumber(MOVZ) | FunctionFieldToBitNumber(MOVN) | |
| 927 FunctionFieldToBitNumber(SELEQZ_S) | FunctionFieldToBitNumber(SELNEZ_S); | 929 FunctionFieldToBitNumber(MOVCI) | FunctionFieldToBitNumber(SELEQZ_S) | |
| 930 FunctionFieldToBitNumber(SELNEZ_S); |
| 928 | 931 |
| 929 | 932 |
| 930 // Get the encoding type of the instruction. | 933 // Get the encoding type of the instruction. |
| 931 inline Type InstructionType(TypeChecks checks = NORMAL) const; | 934 inline Type InstructionType(TypeChecks checks = NORMAL) const; |
| 932 | 935 |
| 933 // Accessors for the different named fields used in the MIPS encoding. | 936 // Accessors for the different named fields used in the MIPS encoding. |
| 934 inline Opcode OpcodeValue() const { | 937 inline Opcode OpcodeValue() const { |
| 935 return static_cast<Opcode>( | 938 return static_cast<Opcode>( |
| 936 Bits(kOpcodeShift + kOpcodeBits - 1, kOpcodeShift)); | 939 Bits(kOpcodeShift + kOpcodeBits - 1, kOpcodeShift)); |
| 937 } | 940 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 951 inline int RdValue() const { | 954 inline int RdValue() const { |
| 952 DCHECK(InstructionType() == kRegisterType); | 955 DCHECK(InstructionType() == kRegisterType); |
| 953 return Bits(kRdShift + kRdBits - 1, kRdShift); | 956 return Bits(kRdShift + kRdBits - 1, kRdShift); |
| 954 } | 957 } |
| 955 | 958 |
| 956 inline int SaValue() const { | 959 inline int SaValue() const { |
| 957 DCHECK(InstructionType() == kRegisterType); | 960 DCHECK(InstructionType() == kRegisterType); |
| 958 return Bits(kSaShift + kSaBits - 1, kSaShift); | 961 return Bits(kSaShift + kSaBits - 1, kSaShift); |
| 959 } | 962 } |
| 960 | 963 |
| 964 inline int LsaSaValue() const { |
| 965 DCHECK(InstructionType() == kRegisterType); |
| 966 return Bits(kSaShift + kLsaSaBits - 1, kSaShift); |
| 967 } |
| 968 |
| 961 inline int FunctionValue() const { | 969 inline int FunctionValue() const { |
| 962 DCHECK(InstructionType() == kRegisterType || | 970 DCHECK(InstructionType() == kRegisterType || |
| 963 InstructionType() == kImmediateType); | 971 InstructionType() == kImmediateType); |
| 964 return Bits(kFunctionShift + kFunctionBits - 1, kFunctionShift); | 972 return Bits(kFunctionShift + kFunctionBits - 1, kFunctionShift); |
| 965 } | 973 } |
| 966 | 974 |
| 967 inline int FdValue() const { | 975 inline int FdValue() const { |
| 968 return Bits(kFdShift + kFdBits - 1, kFdShift); | 976 return Bits(kFdShift + kFdBits - 1, kFdShift); |
| 969 } | 977 } |
| 970 | 978 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 } | 1217 } |
| 1210 } | 1218 } |
| 1211 } | 1219 } |
| 1212 | 1220 |
| 1213 #undef OpcodeToBitNumber | 1221 #undef OpcodeToBitNumber |
| 1214 #undef FunctionFieldToBitNumber | 1222 #undef FunctionFieldToBitNumber |
| 1215 } // namespace internal | 1223 } // namespace internal |
| 1216 } // namespace v8 | 1224 } // namespace v8 |
| 1217 | 1225 |
| 1218 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 1226 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
| OLD | NEW |