| 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 | 7 |
| 8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
| 9 #ifdef DEBUG | 9 #ifdef DEBUG |
| 10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
| 11 v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \ | 11 v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \ |
| 12 __FILE__, __LINE__, __func__) | 12 __FILE__, __LINE__, __func__) |
| 13 #else | 13 #else |
| 14 #define UNIMPLEMENTED_MIPS() | 14 #define UNIMPLEMENTED_MIPS() |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #define UNSUPPORTED_MIPS() v8::internal::PrintF("Unsupported instruction.\n") | 17 #define UNSUPPORTED_MIPS() v8::internal::PrintF("Unsupported instruction.\n") |
| 18 | 18 |
| 19 enum ArchVariants { | 19 enum ArchVariants { |
| 20 kMips32r2, | 20 kMips32r2, |
| 21 kMips32r1, | 21 kMips32r1, |
| 22 kLoongson | 22 kLoongson, |
| 23 kMips64r2 |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 #ifdef _MIPS_ARCH_MIPS32R2 | 26 |
| 26 static const ArchVariants kArchVariant = kMips32r2; | 27 #ifdef _MIPS_ARCH_MIPS64R2 |
| 28 static const ArchVariants kArchVariant = kMips64r2; |
| 27 #elif _MIPS_ARCH_LOONGSON | 29 #elif _MIPS_ARCH_LOONGSON |
| 28 // The loongson flag refers to the LOONGSON architectures based on MIPS-III, | 30 // The loongson flag refers to the LOONGSON architectures based on MIPS-III, |
| 29 // which predates (and is a subset of) the mips32r2 and r1 architectures. | 31 // which predates (and is a subset of) the mips32r2 and r1 architectures. |
| 30 static const ArchVariants kArchVariant = kLoongson; | 32 static const ArchVariants kArchVariant = kLoongson; |
| 31 #else | 33 #else |
| 32 static const ArchVariants kArchVariant = kMips32r1; | 34 static const ArchVariants kArchVariant = kMips64r1; |
| 33 #endif | 35 #endif |
| 34 | 36 |
| 35 enum Endianness { | 37 |
| 36 kLittle, | 38 // TODO(plind): consider deriving ABI from compiler flags or build system. |
| 37 kBig | 39 |
| 40 // ABI-dependent definitions are made with #define in simulator-mips64.h, |
| 41 // so the ABI choice must be available to the pre-processor. However, in all |
| 42 // other cases, we should use the enum AbiVariants with normal if statements. |
| 43 |
| 44 #define MIPS_ABI_N64 1 |
| 45 // #define MIPS_ABI_O32 1 |
| 46 |
| 47 // The only supported Abi's are O32, and n64. |
| 48 enum AbiVariants { |
| 49 kO32, |
| 50 kN64 // Use upper case N for 'n64' ABI to conform to style standard. |
| 38 }; | 51 }; |
| 39 | 52 |
| 40 #if defined(V8_TARGET_LITTLE_ENDIAN) | 53 #ifdef MIPS_ABI_N64 |
| 41 static const Endianness kArchEndian = kLittle; | 54 static const AbiVariants kMipsAbi = kN64; |
| 42 #elif defined(V8_TARGET_BIG_ENDIAN) | |
| 43 static const Endianness kArchEndian = kBig; | |
| 44 #else | 55 #else |
| 45 #error Unknown endianness | 56 static const AbiVariants kMipsAbi = kO32; |
| 46 #endif | 57 #endif |
| 47 | 58 |
| 59 |
| 60 // TODO(plind): consider renaming these ... |
| 48 #if(defined(__mips_hard_float) && __mips_hard_float != 0) | 61 #if(defined(__mips_hard_float) && __mips_hard_float != 0) |
| 49 // Use floating-point coprocessor instructions. This flag is raised when | 62 // Use floating-point coprocessor instructions. This flag is raised when |
| 50 // -mhard-float is passed to the compiler. | 63 // -mhard-float is passed to the compiler. |
| 51 const bool IsMipsSoftFloatABI = false; | 64 const bool IsMipsSoftFloatABI = false; |
| 52 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) | 65 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) |
| 53 // This flag is raised when -msoft-float is passed to the compiler. | 66 // This flag is raised when -msoft-float is passed to the compiler. |
| 54 // Although FPU is a base requirement for v8, soft-float ABI is used | 67 // Although FPU is a base requirement for v8, soft-float ABI is used |
| 55 // on soft-float systems with FPU kernel emulation. | 68 // on soft-float systems with FPU kernel emulation. |
| 56 const bool IsMipsSoftFloatABI = true; | 69 const bool IsMipsSoftFloatABI = true; |
| 57 #else | 70 #else |
| 58 const bool IsMipsSoftFloatABI = true; | 71 const bool IsMipsSoftFloatABI = true; |
| 59 #endif | 72 #endif |
| 60 | 73 |
| 61 #if defined(V8_TARGET_LITTLE_ENDIAN) | 74 |
| 62 const uint32_t kHoleNanUpper32Offset = 4; | 75 #define __STDC_FORMAT_MACROS |
| 63 const uint32_t kHoleNanLower32Offset = 0; | 76 #include <inttypes.h> |
| 64 #elif defined(V8_TARGET_BIG_ENDIAN) | 77 |
| 65 const uint32_t kHoleNanUpper32Offset = 0; | |
| 66 const uint32_t kHoleNanLower32Offset = 4; | |
| 67 #else | |
| 68 #error Unknown endianness | |
| 69 #endif | |
| 70 | 78 |
| 71 // Defines constants and accessor classes to assemble, disassemble and | 79 // Defines constants and accessor classes to assemble, disassemble and |
| 72 // simulate MIPS32 instructions. | 80 // simulate MIPS32 instructions. |
| 73 // | 81 // |
| 74 // See: MIPS32 Architecture For Programmers | 82 // See: MIPS32 Architecture For Programmers |
| 75 // Volume II: The MIPS32 Instruction Set | 83 // Volume II: The MIPS32 Instruction Set |
| 76 // Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf. | 84 // Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf. |
| 77 | 85 |
| 78 namespace v8 { | 86 namespace v8 { |
| 79 namespace internal { | 87 namespace internal { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 const int kPCRegister = 34; | 100 const int kPCRegister = 34; |
| 93 | 101 |
| 94 // Number coprocessor registers. | 102 // Number coprocessor registers. |
| 95 const int kNumFPURegisters = 32; | 103 const int kNumFPURegisters = 32; |
| 96 const int kInvalidFPURegister = -1; | 104 const int kInvalidFPURegister = -1; |
| 97 | 105 |
| 98 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. | 106 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. |
| 99 const int kFCSRRegister = 31; | 107 const int kFCSRRegister = 31; |
| 100 const int kInvalidFPUControlRegister = -1; | 108 const int kInvalidFPUControlRegister = -1; |
| 101 const uint32_t kFPUInvalidResult = static_cast<uint32_t>(1 << 31) - 1; | 109 const uint32_t kFPUInvalidResult = static_cast<uint32_t>(1 << 31) - 1; |
| 110 const uint64_t kFPU64InvalidResult = |
| 111 static_cast<uint64_t>(static_cast<uint64_t>(1) << 63) - 1; |
| 102 | 112 |
| 103 // FCSR constants. | 113 // FCSR constants. |
| 104 const uint32_t kFCSRInexactFlagBit = 2; | 114 const uint32_t kFCSRInexactFlagBit = 2; |
| 105 const uint32_t kFCSRUnderflowFlagBit = 3; | 115 const uint32_t kFCSRUnderflowFlagBit = 3; |
| 106 const uint32_t kFCSROverflowFlagBit = 4; | 116 const uint32_t kFCSROverflowFlagBit = 4; |
| 107 const uint32_t kFCSRDivideByZeroFlagBit = 5; | 117 const uint32_t kFCSRDivideByZeroFlagBit = 5; |
| 108 const uint32_t kFCSRInvalidOpFlagBit = 6; | 118 const uint32_t kFCSRInvalidOpFlagBit = 6; |
| 109 | 119 |
| 110 const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit; | 120 const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit; |
| 111 const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit; | 121 const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 139 static const char* Name(int reg); | 149 static const char* Name(int reg); |
| 140 | 150 |
| 141 // Lookup the register number for the name provided. | 151 // Lookup the register number for the name provided. |
| 142 static int Number(const char* name); | 152 static int Number(const char* name); |
| 143 | 153 |
| 144 struct RegisterAlias { | 154 struct RegisterAlias { |
| 145 int reg; | 155 int reg; |
| 146 const char* name; | 156 const char* name; |
| 147 }; | 157 }; |
| 148 | 158 |
| 149 static const int32_t kMaxValue = 0x7fffffff; | 159 static const int64_t kMaxValue = 0x7fffffffffffffffl; |
| 150 static const int32_t kMinValue = 0x80000000; | 160 static const int64_t kMinValue = 0x8000000000000000l; |
| 151 | 161 |
| 152 private: | 162 private: |
| 153 static const char* names_[kNumSimuRegisters]; | 163 static const char* names_[kNumSimuRegisters]; |
| 154 static const RegisterAlias aliases_[]; | 164 static const RegisterAlias aliases_[]; |
| 155 }; | 165 }; |
| 156 | 166 |
| 157 // Helper functions for converting between register numbers and names. | 167 // Helper functions for converting between register numbers and names. |
| 158 class FPURegisters { | 168 class FPURegisters { |
| 159 public: | 169 public: |
| 160 // Return the name of the register. | 170 // Return the name of the register. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 const int kFunctionShift = 0; | 223 const int kFunctionShift = 0; |
| 214 const int kFunctionBits = 6; | 224 const int kFunctionBits = 6; |
| 215 const int kLuiShift = 16; | 225 const int kLuiShift = 16; |
| 216 | 226 |
| 217 const int kImm16Shift = 0; | 227 const int kImm16Shift = 0; |
| 218 const int kImm16Bits = 16; | 228 const int kImm16Bits = 16; |
| 219 const int kImm26Shift = 0; | 229 const int kImm26Shift = 0; |
| 220 const int kImm26Bits = 26; | 230 const int kImm26Bits = 26; |
| 221 const int kImm28Shift = 0; | 231 const int kImm28Shift = 0; |
| 222 const int kImm28Bits = 28; | 232 const int kImm28Bits = 28; |
| 233 const int kImm32Shift = 0; |
| 234 const int kImm32Bits = 32; |
| 223 | 235 |
| 224 // In branches and jumps immediate fields point to words, not bytes, | 236 // In branches and jumps immediate fields point to words, not bytes, |
| 225 // and are therefore shifted by 2. | 237 // and are therefore shifted by 2. |
| 226 const int kImmFieldShift = 2; | 238 const int kImmFieldShift = 2; |
| 227 | 239 |
| 228 const int kFrBits = 5; | 240 const int kFrBits = 5; |
| 229 const int kFrShift = 21; | 241 const int kFrShift = 21; |
| 230 const int kFsShift = 11; | 242 const int kFsShift = 11; |
| 231 const int kFsBits = 5; | 243 const int kFsBits = 5; |
| 232 const int kFtShift = 16; | 244 const int kFtShift = 16; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 249 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; | 261 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; |
| 250 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; | 262 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; |
| 251 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; | 263 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; |
| 252 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; | 264 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; |
| 253 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift; | 265 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift; |
| 254 // Misc masks. | 266 // Misc masks. |
| 255 const int kHiMask = 0xffff << 16; | 267 const int kHiMask = 0xffff << 16; |
| 256 const int kLoMask = 0xffff; | 268 const int kLoMask = 0xffff; |
| 257 const int kSignMask = 0x80000000; | 269 const int kSignMask = 0x80000000; |
| 258 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; | 270 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; |
| 271 const int64_t kHi16MaskOf64 = (int64_t)0xffff << 48; |
| 272 const int64_t kSe16MaskOf64 = (int64_t)0xffff << 32; |
| 273 const int64_t kTh16MaskOf64 = (int64_t)0xffff << 16; |
| 259 | 274 |
| 260 // ----- MIPS Opcodes and Function Fields. | 275 // ----- MIPS Opcodes and Function Fields. |
| 261 // We use this presentation to stay close to the table representation in | 276 // We use this presentation to stay close to the table representation in |
| 262 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. | 277 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. |
| 263 enum Opcode { | 278 enum Opcode { |
| 264 SPECIAL = 0 << kOpcodeShift, | 279 SPECIAL = 0 << kOpcodeShift, |
| 265 REGIMM = 1 << kOpcodeShift, | 280 REGIMM = 1 << kOpcodeShift, |
| 266 | 281 |
| 267 J = ((0 << 3) + 2) << kOpcodeShift, | 282 J = ((0 << 3) + 2) << kOpcodeShift, |
| 268 JAL = ((0 << 3) + 3) << kOpcodeShift, | 283 JAL = ((0 << 3) + 3) << kOpcodeShift, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 279 ORI = ((1 << 3) + 5) << kOpcodeShift, | 294 ORI = ((1 << 3) + 5) << kOpcodeShift, |
| 280 XORI = ((1 << 3) + 6) << kOpcodeShift, | 295 XORI = ((1 << 3) + 6) << kOpcodeShift, |
| 281 LUI = ((1 << 3) + 7) << kOpcodeShift, | 296 LUI = ((1 << 3) + 7) << kOpcodeShift, |
| 282 | 297 |
| 283 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. | 298 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. |
| 284 BEQL = ((2 << 3) + 4) << kOpcodeShift, | 299 BEQL = ((2 << 3) + 4) << kOpcodeShift, |
| 285 BNEL = ((2 << 3) + 5) << kOpcodeShift, | 300 BNEL = ((2 << 3) + 5) << kOpcodeShift, |
| 286 BLEZL = ((2 << 3) + 6) << kOpcodeShift, | 301 BLEZL = ((2 << 3) + 6) << kOpcodeShift, |
| 287 BGTZL = ((2 << 3) + 7) << kOpcodeShift, | 302 BGTZL = ((2 << 3) + 7) << kOpcodeShift, |
| 288 | 303 |
| 304 DADDI = ((3 << 3) + 0) << kOpcodeShift, |
| 305 DADDIU = ((3 << 3) + 1) << kOpcodeShift, |
| 306 LDL = ((3 << 3) + 2) << kOpcodeShift, |
| 307 LDR = ((3 << 3) + 3) << kOpcodeShift, |
| 289 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, | 308 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, |
| 290 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, | 309 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, |
| 291 | 310 |
| 292 LB = ((4 << 3) + 0) << kOpcodeShift, | 311 LB = ((4 << 3) + 0) << kOpcodeShift, |
| 293 LH = ((4 << 3) + 1) << kOpcodeShift, | 312 LH = ((4 << 3) + 1) << kOpcodeShift, |
| 294 LWL = ((4 << 3) + 2) << kOpcodeShift, | 313 LWL = ((4 << 3) + 2) << kOpcodeShift, |
| 295 LW = ((4 << 3) + 3) << kOpcodeShift, | 314 LW = ((4 << 3) + 3) << kOpcodeShift, |
| 296 LBU = ((4 << 3) + 4) << kOpcodeShift, | 315 LBU = ((4 << 3) + 4) << kOpcodeShift, |
| 297 LHU = ((4 << 3) + 5) << kOpcodeShift, | 316 LHU = ((4 << 3) + 5) << kOpcodeShift, |
| 298 LWR = ((4 << 3) + 6) << kOpcodeShift, | 317 LWR = ((4 << 3) + 6) << kOpcodeShift, |
| 318 LWU = ((4 << 3) + 7) << kOpcodeShift, |
| 319 |
| 299 SB = ((5 << 3) + 0) << kOpcodeShift, | 320 SB = ((5 << 3) + 0) << kOpcodeShift, |
| 300 SH = ((5 << 3) + 1) << kOpcodeShift, | 321 SH = ((5 << 3) + 1) << kOpcodeShift, |
| 301 SWL = ((5 << 3) + 2) << kOpcodeShift, | 322 SWL = ((5 << 3) + 2) << kOpcodeShift, |
| 302 SW = ((5 << 3) + 3) << kOpcodeShift, | 323 SW = ((5 << 3) + 3) << kOpcodeShift, |
| 324 SDL = ((5 << 3) + 4) << kOpcodeShift, |
| 325 SDR = ((5 << 3) + 5) << kOpcodeShift, |
| 303 SWR = ((5 << 3) + 6) << kOpcodeShift, | 326 SWR = ((5 << 3) + 6) << kOpcodeShift, |
| 304 | 327 |
| 305 LWC1 = ((6 << 3) + 1) << kOpcodeShift, | 328 LWC1 = ((6 << 3) + 1) << kOpcodeShift, |
| 329 LLD = ((6 << 3) + 4) << kOpcodeShift, |
| 306 LDC1 = ((6 << 3) + 5) << kOpcodeShift, | 330 LDC1 = ((6 << 3) + 5) << kOpcodeShift, |
| 331 LD = ((6 << 3) + 7) << kOpcodeShift, |
| 307 | 332 |
| 308 PREF = ((6 << 3) + 3) << kOpcodeShift, | 333 PREF = ((6 << 3) + 3) << kOpcodeShift, |
| 309 | 334 |
| 310 SWC1 = ((7 << 3) + 1) << kOpcodeShift, | 335 SWC1 = ((7 << 3) + 1) << kOpcodeShift, |
| 336 SCD = ((7 << 3) + 4) << kOpcodeShift, |
| 311 SDC1 = ((7 << 3) + 5) << kOpcodeShift, | 337 SDC1 = ((7 << 3) + 5) << kOpcodeShift, |
| 338 SD = ((7 << 3) + 7) << kOpcodeShift, |
| 312 | 339 |
| 313 COP1X = ((1 << 4) + 3) << kOpcodeShift | 340 COP1X = ((1 << 4) + 3) << kOpcodeShift |
| 314 }; | 341 }; |
| 315 | 342 |
| 316 enum SecondaryField { | 343 enum SecondaryField { |
| 317 // SPECIAL Encoding of Function Field. | 344 // SPECIAL Encoding of Function Field. |
| 318 SLL = ((0 << 3) + 0), | 345 SLL = ((0 << 3) + 0), |
| 319 MOVCI = ((0 << 3) + 1), | 346 MOVCI = ((0 << 3) + 1), |
| 320 SRL = ((0 << 3) + 2), | 347 SRL = ((0 << 3) + 2), |
| 321 SRA = ((0 << 3) + 3), | 348 SRA = ((0 << 3) + 3), |
| 322 SLLV = ((0 << 3) + 4), | 349 SLLV = ((0 << 3) + 4), |
| 323 SRLV = ((0 << 3) + 6), | 350 SRLV = ((0 << 3) + 6), |
| 324 SRAV = ((0 << 3) + 7), | 351 SRAV = ((0 << 3) + 7), |
| 325 | 352 |
| 326 JR = ((1 << 3) + 0), | 353 JR = ((1 << 3) + 0), |
| 327 JALR = ((1 << 3) + 1), | 354 JALR = ((1 << 3) + 1), |
| 328 MOVZ = ((1 << 3) + 2), | 355 MOVZ = ((1 << 3) + 2), |
| 329 MOVN = ((1 << 3) + 3), | 356 MOVN = ((1 << 3) + 3), |
| 330 BREAK = ((1 << 3) + 5), | 357 BREAK = ((1 << 3) + 5), |
| 331 | 358 |
| 332 MFHI = ((2 << 3) + 0), | 359 MFHI = ((2 << 3) + 0), |
| 333 MFLO = ((2 << 3) + 2), | 360 MFLO = ((2 << 3) + 2), |
| 361 DSLLV = ((2 << 3) + 4), |
| 362 DSRLV = ((2 << 3) + 6), |
| 363 DSRAV = ((2 << 3) + 7), |
| 334 | 364 |
| 335 MULT = ((3 << 3) + 0), | 365 MULT = ((3 << 3) + 0), |
| 336 MULTU = ((3 << 3) + 1), | 366 MULTU = ((3 << 3) + 1), |
| 337 DIV = ((3 << 3) + 2), | 367 DIV = ((3 << 3) + 2), |
| 338 DIVU = ((3 << 3) + 3), | 368 DIVU = ((3 << 3) + 3), |
| 369 DMULT = ((3 << 3) + 4), |
| 370 DMULTU = ((3 << 3) + 5), |
| 371 DDIV = ((3 << 3) + 6), |
| 372 DDIVU = ((3 << 3) + 7), |
| 339 | 373 |
| 340 ADD = ((4 << 3) + 0), | 374 ADD = ((4 << 3) + 0), |
| 341 ADDU = ((4 << 3) + 1), | 375 ADDU = ((4 << 3) + 1), |
| 342 SUB = ((4 << 3) + 2), | 376 SUB = ((4 << 3) + 2), |
| 343 SUBU = ((4 << 3) + 3), | 377 SUBU = ((4 << 3) + 3), |
| 344 AND = ((4 << 3) + 4), | 378 AND = ((4 << 3) + 4), |
| 345 OR = ((4 << 3) + 5), | 379 OR = ((4 << 3) + 5), |
| 346 XOR = ((4 << 3) + 6), | 380 XOR = ((4 << 3) + 6), |
| 347 NOR = ((4 << 3) + 7), | 381 NOR = ((4 << 3) + 7), |
| 348 | 382 |
| 349 SLT = ((5 << 3) + 2), | 383 SLT = ((5 << 3) + 2), |
| 350 SLTU = ((5 << 3) + 3), | 384 SLTU = ((5 << 3) + 3), |
| 385 DADD = ((5 << 3) + 4), |
| 386 DADDU = ((5 << 3) + 5), |
| 387 DSUB = ((5 << 3) + 6), |
| 388 DSUBU = ((5 << 3) + 7), |
| 351 | 389 |
| 352 TGE = ((6 << 3) + 0), | 390 TGE = ((6 << 3) + 0), |
| 353 TGEU = ((6 << 3) + 1), | 391 TGEU = ((6 << 3) + 1), |
| 354 TLT = ((6 << 3) + 2), | 392 TLT = ((6 << 3) + 2), |
| 355 TLTU = ((6 << 3) + 3), | 393 TLTU = ((6 << 3) + 3), |
| 356 TEQ = ((6 << 3) + 4), | 394 TEQ = ((6 << 3) + 4), |
| 357 TNE = ((6 << 3) + 6), | 395 TNE = ((6 << 3) + 6), |
| 358 | 396 |
| 397 DSLL = ((7 << 3) + 0), |
| 398 DSRL = ((7 << 3) + 2), |
| 399 DSRA = ((7 << 3) + 3), |
| 400 DSLL32 = ((7 << 3) + 4), |
| 401 DSRL32 = ((7 << 3) + 6), |
| 402 DSRA32 = ((7 << 3) + 7), |
| 403 // drotr in special4? |
| 404 |
| 359 // SPECIAL2 Encoding of Function Field. | 405 // SPECIAL2 Encoding of Function Field. |
| 360 MUL = ((0 << 3) + 2), | 406 MUL = ((0 << 3) + 2), |
| 361 CLZ = ((4 << 3) + 0), | 407 CLZ = ((4 << 3) + 0), |
| 362 CLO = ((4 << 3) + 1), | 408 CLO = ((4 << 3) + 1), |
| 363 | 409 |
| 364 // SPECIAL3 Encoding of Function Field. | 410 // SPECIAL3 Encoding of Function Field. |
| 365 EXT = ((0 << 3) + 0), | 411 EXT = ((0 << 3) + 0), |
| 412 DEXTM = ((0 << 3) + 1), |
| 413 DEXTU = ((0 << 3) + 2), |
| 414 DEXT = ((0 << 3) + 3), |
| 366 INS = ((0 << 3) + 4), | 415 INS = ((0 << 3) + 4), |
| 416 DINSM = ((0 << 3) + 5), |
| 417 DINSU = ((0 << 3) + 6), |
| 418 DINS = ((0 << 3) + 7), |
| 419 |
| 420 DSBH = ((4 << 3) + 4), |
| 367 | 421 |
| 368 // REGIMM encoding of rt Field. | 422 // REGIMM encoding of rt Field. |
| 369 BLTZ = ((0 << 3) + 0) << 16, | 423 BLTZ = ((0 << 3) + 0) << 16, |
| 370 BGEZ = ((0 << 3) + 1) << 16, | 424 BGEZ = ((0 << 3) + 1) << 16, |
| 371 BLTZAL = ((2 << 3) + 0) << 16, | 425 BLTZAL = ((2 << 3) + 0) << 16, |
| 372 BGEZAL = ((2 << 3) + 1) << 16, | 426 BGEZAL = ((2 << 3) + 1) << 16, |
| 373 | 427 |
| 374 // COP1 Encoding of rs Field. | 428 // COP1 Encoding of rs Field. |
| 375 MFC1 = ((0 << 3) + 0) << 21, | 429 MFC1 = ((0 << 3) + 0) << 21, |
| 430 DMFC1 = ((0 << 3) + 1) << 21, |
| 376 CFC1 = ((0 << 3) + 2) << 21, | 431 CFC1 = ((0 << 3) + 2) << 21, |
| 377 MFHC1 = ((0 << 3) + 3) << 21, | 432 MFHC1 = ((0 << 3) + 3) << 21, |
| 378 MTC1 = ((0 << 3) + 4) << 21, | 433 MTC1 = ((0 << 3) + 4) << 21, |
| 434 DMTC1 = ((0 << 3) + 5) << 21, |
| 379 CTC1 = ((0 << 3) + 6) << 21, | 435 CTC1 = ((0 << 3) + 6) << 21, |
| 380 MTHC1 = ((0 << 3) + 7) << 21, | 436 MTHC1 = ((0 << 3) + 7) << 21, |
| 381 BC1 = ((1 << 3) + 0) << 21, | 437 BC1 = ((1 << 3) + 0) << 21, |
| 382 S = ((2 << 3) + 0) << 21, | 438 S = ((2 << 3) + 0) << 21, |
| 383 D = ((2 << 3) + 1) << 21, | 439 D = ((2 << 3) + 1) << 21, |
| 384 W = ((2 << 3) + 4) << 21, | 440 W = ((2 << 3) + 4) << 21, |
| 385 L = ((2 << 3) + 5) << 21, | 441 L = ((2 << 3) + 5) << 21, |
| 386 PS = ((2 << 3) + 6) << 21, | 442 PS = ((2 << 3) + 6) << 21, |
| 387 // COP1 Encoding of Function Field When rs=S. | 443 // COP1 Encoding of Function Field When rs=S. |
| 388 ROUND_L_S = ((1 << 3) + 0), | 444 ROUND_L_S = ((1 << 3) + 0), |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 private: | 854 private: |
| 799 // We need to prevent the creation of instances of class Instruction. | 855 // We need to prevent the creation of instances of class Instruction. |
| 800 DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction); | 856 DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction); |
| 801 }; | 857 }; |
| 802 | 858 |
| 803 | 859 |
| 804 // ----------------------------------------------------------------------------- | 860 // ----------------------------------------------------------------------------- |
| 805 // MIPS assembly various constants. | 861 // MIPS assembly various constants. |
| 806 | 862 |
| 807 // C/C++ argument slots size. | 863 // C/C++ argument slots size. |
| 808 const int kCArgSlotCount = 4; | 864 const int kCArgSlotCount = (kMipsAbi == kN64) ? 0 : 4; |
| 809 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize; | 865 |
| 810 // JS argument slots size. | 866 // TODO(plind): below should be based on kPointerSize |
| 811 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 867 // TODO(plind): find all usages and remove the needless instructions for n64. |
| 812 // Assembly builtins argument slots size. | 868 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; |
| 813 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | |
| 814 | 869 |
| 815 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 870 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
| 816 | 871 |
| 817 } } // namespace v8::internal | 872 } } // namespace v8::internal |
| 818 | 873 |
| 819 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 874 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
| OLD | NEW |