| 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() \ |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 // On MIPS Simulator breakpoints can have different codes: | 198 // On MIPS Simulator breakpoints can have different codes: |
| 199 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, | 199 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, |
| 200 // the simulator will run through them and print the registers. | 200 // the simulator will run through them and print the registers. |
| 201 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() | 201 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() |
| 202 // instructions (see Assembler::stop()). | 202 // instructions (see Assembler::stop()). |
| 203 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the | 203 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the |
| 204 // debugger. | 204 // debugger. |
| 205 const uint32_t kMaxWatchpointCode = 31; | 205 const uint32_t kMaxWatchpointCode = 31; |
| 206 const uint32_t kMaxStopCode = 127; | 206 const uint32_t kMaxStopCode = 127; |
| 207 const int32_t kMaxInt18 = 131071; |
| 208 const int32_t kMinInt18 = -131072; |
| 209 const int32_t kMaxInt19 = 262143; |
| 210 const int32_t kMinInt19 = -262144; |
| 211 const int32_t kMaxInt26 = 33554431; |
| 212 const int32_t kMinInt26 = -33554432; |
| 207 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode); | 213 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode); |
| 208 | 214 |
| 209 | 215 |
| 210 // ----- Fields offset and length. | 216 // ----- Fields offset and length. |
| 211 const int kOpcodeShift = 26; | 217 const int kOpcodeShift = 26; |
| 212 const int kOpcodeBits = 6; | 218 const int kOpcodeBits = 6; |
| 213 const int kRsShift = 21; | 219 const int kRsShift = 21; |
| 214 const int kRsBits = 5; | 220 const int kRsBits = 5; |
| 215 const int kRtShift = 16; | 221 const int kRtShift = 16; |
| 216 const int kRtBits = 5; | 222 const int kRtBits = 5; |
| 217 const int kRdShift = 11; | 223 const int kRdShift = 11; |
| 218 const int kRdBits = 5; | 224 const int kRdBits = 5; |
| 219 const int kSaShift = 6; | 225 const int kSaShift = 6; |
| 220 const int kSaBits = 5; | 226 const int kSaBits = 5; |
| 221 const int kFunctionShift = 0; | 227 const int kFunctionShift = 0; |
| 222 const int kFunctionBits = 6; | 228 const int kFunctionBits = 6; |
| 223 const int kLuiShift = 16; | 229 const int kLuiShift = 16; |
| 230 const int kBp2Shift = 6; |
| 231 const int kBp2Bits = 2; |
| 232 const int kBp3Shift = 6; |
| 233 const int kBp3Bits = 3; |
| 224 | 234 |
| 225 const int kImm16Shift = 0; | 235 const int kImm16Shift = 0; |
| 226 const int kImm16Bits = 16; | 236 const int kImm16Bits = 16; |
| 237 const int kImm18Shift = 0; |
| 238 const int kImm18Bits = 18; |
| 239 const int kImm19Shift = 0; |
| 240 const int kImm19Bits = 19; |
| 227 const int kImm21Shift = 0; | 241 const int kImm21Shift = 0; |
| 228 const int kImm21Bits = 21; | 242 const int kImm21Bits = 21; |
| 229 const int kImm26Shift = 0; | 243 const int kImm26Shift = 0; |
| 230 const int kImm26Bits = 26; | 244 const int kImm26Bits = 26; |
| 231 const int kImm28Shift = 0; | 245 const int kImm28Shift = 0; |
| 232 const int kImm28Bits = 28; | 246 const int kImm28Bits = 28; |
| 233 const int kImm32Shift = 0; | 247 const int kImm32Shift = 0; |
| 234 const int kImm32Bits = 32; | 248 const int kImm32Bits = 32; |
| 235 | 249 |
| 236 // In branches and jumps immediate fields point to words, not bytes, | 250 // In branches and jumps immediate fields point to words, not bytes, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 249 const int kFCccBits = 3; | 263 const int kFCccBits = 3; |
| 250 const int kFBccShift = 18; | 264 const int kFBccShift = 18; |
| 251 const int kFBccBits = 3; | 265 const int kFBccBits = 3; |
| 252 const int kFBtrueShift = 16; | 266 const int kFBtrueShift = 16; |
| 253 const int kFBtrueBits = 1; | 267 const int kFBtrueBits = 1; |
| 254 | 268 |
| 255 // ----- Miscellaneous useful masks. | 269 // ----- Miscellaneous useful masks. |
| 256 // Instruction bit masks. | 270 // Instruction bit masks. |
| 257 const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; | 271 const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; |
| 258 const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; | 272 const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; |
| 273 const int kImm18Mask = ((1 << kImm18Bits) - 1) << kImm18Shift; |
| 274 const int kImm19Mask = ((1 << kImm19Bits) - 1) << kImm19Shift; |
| 275 const int kImm21Mask = ((1 << kImm21Bits) - 1) << kImm21Shift; |
| 259 const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; | 276 const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; |
| 260 const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift; | 277 const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift; |
| 261 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; | 278 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; |
| 262 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; | 279 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; |
| 263 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; | 280 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; |
| 264 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; | 281 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; |
| 265 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift; | 282 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift; |
| 266 // Misc masks. | 283 // Misc masks. |
| 267 const int kHiMask = 0xffff << 16; | 284 const int kHiMask = 0xffff << 16; |
| 268 const int kLoMask = 0xffff; | 285 const int kLoMask = 0xffff; |
| 269 const int kSignMask = 0x80000000; | 286 const int kSignMask = 0x80000000; |
| 270 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; | 287 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; |
| 271 const int64_t kHi16MaskOf64 = (int64_t)0xffff << 48; | 288 const int64_t kHi16MaskOf64 = (int64_t)0xffff << 48; |
| 272 const int64_t kSe16MaskOf64 = (int64_t)0xffff << 32; | 289 const int64_t kSe16MaskOf64 = (int64_t)0xffff << 32; |
| 273 const int64_t kTh16MaskOf64 = (int64_t)0xffff << 16; | 290 const int64_t kTh16MaskOf64 = (int64_t)0xffff << 16; |
| 274 | 291 |
| 275 // ----- MIPS Opcodes and Function Fields. | 292 // ----- MIPS Opcodes and Function Fields. |
| 276 // We use this presentation to stay close to the table representation in | 293 // We use this presentation to stay close to the table representation in |
| 277 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. | 294 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. |
| 278 enum Opcode { | 295 enum Opcode { |
| 279 SPECIAL = 0 << kOpcodeShift, | 296 SPECIAL = 0 << kOpcodeShift, |
| 280 REGIMM = 1 << kOpcodeShift, | 297 REGIMM = 1 << kOpcodeShift, |
| 281 | 298 |
| 282 J = ((0 << 3) + 2) << kOpcodeShift, | 299 J = ((0 << 3) + 2) << kOpcodeShift, |
| 283 JAL = ((0 << 3) + 3) << kOpcodeShift, | 300 JAL = ((0 << 3) + 3) << kOpcodeShift, |
| 284 BEQ = ((0 << 3) + 4) << kOpcodeShift, | 301 BEQ = ((0 << 3) + 4) << kOpcodeShift, |
| 285 BNE = ((0 << 3) + 5) << kOpcodeShift, | 302 BNE = ((0 << 3) + 5) << kOpcodeShift, |
| 286 BLEZ = ((0 << 3) + 6) << kOpcodeShift, | 303 BLEZ = ((0 << 3) + 6) << kOpcodeShift, |
| 287 BGTZ = ((0 << 3) + 7) << kOpcodeShift, | 304 BGTZ = ((0 << 3) + 7) << kOpcodeShift, |
| 288 | 305 |
| 289 ADDI = ((1 << 3) + 0) << kOpcodeShift, | 306 ADDI = ((1 << 3) + 0) << kOpcodeShift, |
| 290 ADDIU = ((1 << 3) + 1) << kOpcodeShift, | 307 ADDIU = ((1 << 3) + 1) << kOpcodeShift, |
| 291 SLTI = ((1 << 3) + 2) << kOpcodeShift, | 308 SLTI = ((1 << 3) + 2) << kOpcodeShift, |
| 292 SLTIU = ((1 << 3) + 3) << kOpcodeShift, | 309 SLTIU = ((1 << 3) + 3) << kOpcodeShift, |
| 293 ANDI = ((1 << 3) + 4) << kOpcodeShift, | 310 ANDI = ((1 << 3) + 4) << kOpcodeShift, |
| 294 ORI = ((1 << 3) + 5) << kOpcodeShift, | 311 ORI = ((1 << 3) + 5) << kOpcodeShift, |
| 295 XORI = ((1 << 3) + 6) << kOpcodeShift, | 312 XORI = ((1 << 3) + 6) << kOpcodeShift, |
| 296 LUI = ((1 << 3) + 7) << kOpcodeShift, // LUI/AUI family. | 313 LUI = ((1 << 3) + 7) << kOpcodeShift, // LUI/AUI family. |
| 297 DAUI = ((3 << 3) + 5) << kOpcodeShift, | 314 DAUI = ((3 << 3) + 5) << kOpcodeShift, |
| 298 | 315 |
| 299 BEQC = ((2 << 3) + 0) << kOpcodeShift, | 316 BEQC = ((2 << 3) + 0) << kOpcodeShift, |
| 300 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. | 317 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. |
| 301 BEQL = ((2 << 3) + 4) << kOpcodeShift, | 318 BEQL = ((2 << 3) + 4) << kOpcodeShift, |
| 302 BNEL = ((2 << 3) + 5) << kOpcodeShift, | 319 BNEL = ((2 << 3) + 5) << kOpcodeShift, |
| 303 BLEZL = ((2 << 3) + 6) << kOpcodeShift, | 320 BLEZL = ((2 << 3) + 6) << kOpcodeShift, |
| 304 BGTZL = ((2 << 3) + 7) << kOpcodeShift, | 321 BGTZL = ((2 << 3) + 7) << kOpcodeShift, |
| 305 | 322 |
| 306 DADDI = ((3 << 3) + 0) << kOpcodeShift, // This is also BNEC. | 323 DADDI = ((3 << 3) + 0) << kOpcodeShift, // This is also BNEC. |
| 307 DADDIU = ((3 << 3) + 1) << kOpcodeShift, | 324 DADDIU = ((3 << 3) + 1) << kOpcodeShift, |
| 308 LDL = ((3 << 3) + 2) << kOpcodeShift, | 325 LDL = ((3 << 3) + 2) << kOpcodeShift, |
| 309 LDR = ((3 << 3) + 3) << kOpcodeShift, | 326 LDR = ((3 << 3) + 3) << kOpcodeShift, |
| 310 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, | 327 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, |
| 311 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, | 328 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, |
| 312 | 329 |
| 313 LB = ((4 << 3) + 0) << kOpcodeShift, | 330 LB = ((4 << 3) + 0) << kOpcodeShift, |
| 314 LH = ((4 << 3) + 1) << kOpcodeShift, | 331 LH = ((4 << 3) + 1) << kOpcodeShift, |
| 315 LWL = ((4 << 3) + 2) << kOpcodeShift, | 332 LWL = ((4 << 3) + 2) << kOpcodeShift, |
| 316 LW = ((4 << 3) + 3) << kOpcodeShift, | 333 LW = ((4 << 3) + 3) << kOpcodeShift, |
| 317 LBU = ((4 << 3) + 4) << kOpcodeShift, | 334 LBU = ((4 << 3) + 4) << kOpcodeShift, |
| 318 LHU = ((4 << 3) + 5) << kOpcodeShift, | 335 LHU = ((4 << 3) + 5) << kOpcodeShift, |
| 319 LWR = ((4 << 3) + 6) << kOpcodeShift, | 336 LWR = ((4 << 3) + 6) << kOpcodeShift, |
| 320 LWU = ((4 << 3) + 7) << kOpcodeShift, | 337 LWU = ((4 << 3) + 7) << kOpcodeShift, |
| 321 | 338 |
| 322 SB = ((5 << 3) + 0) << kOpcodeShift, | 339 SB = ((5 << 3) + 0) << kOpcodeShift, |
| 323 SH = ((5 << 3) + 1) << kOpcodeShift, | 340 SH = ((5 << 3) + 1) << kOpcodeShift, |
| 324 SWL = ((5 << 3) + 2) << kOpcodeShift, | 341 SWL = ((5 << 3) + 2) << kOpcodeShift, |
| 325 SW = ((5 << 3) + 3) << kOpcodeShift, | 342 SW = ((5 << 3) + 3) << kOpcodeShift, |
| 326 SDL = ((5 << 3) + 4) << kOpcodeShift, | 343 SDL = ((5 << 3) + 4) << kOpcodeShift, |
| 327 SDR = ((5 << 3) + 5) << kOpcodeShift, | 344 SDR = ((5 << 3) + 5) << kOpcodeShift, |
| 328 SWR = ((5 << 3) + 6) << kOpcodeShift, | 345 SWR = ((5 << 3) + 6) << kOpcodeShift, |
| 329 | 346 |
| 330 LWC1 = ((6 << 3) + 1) << kOpcodeShift, | 347 LWC1 = ((6 << 3) + 1) << kOpcodeShift, |
| 331 LLD = ((6 << 3) + 4) << kOpcodeShift, | 348 BC = ((6 << 3) + 2) << kOpcodeShift, |
| 332 LDC1 = ((6 << 3) + 5) << kOpcodeShift, | 349 LLD = ((6 << 3) + 4) << kOpcodeShift, |
| 333 BEQZC = ((6 << 3) + 6) << kOpcodeShift, | 350 LDC1 = ((6 << 3) + 5) << kOpcodeShift, |
| 334 LD = ((6 << 3) + 7) << kOpcodeShift, | 351 POP66 = ((6 << 3) + 6) << kOpcodeShift, |
| 352 LD = ((6 << 3) + 7) << kOpcodeShift, |
| 335 | 353 |
| 336 PREF = ((6 << 3) + 3) << kOpcodeShift, | 354 PREF = ((6 << 3) + 3) << kOpcodeShift, |
| 337 | 355 |
| 338 SWC1 = ((7 << 3) + 1) << kOpcodeShift, | 356 SWC1 = ((7 << 3) + 1) << kOpcodeShift, |
| 339 SCD = ((7 << 3) + 4) << kOpcodeShift, | 357 BALC = ((7 << 3) + 2) << kOpcodeShift, |
| 340 SDC1 = ((7 << 3) + 5) << kOpcodeShift, | 358 PCREL = ((7 << 3) + 3) << kOpcodeShift, |
| 341 BNEZC = ((7 << 3) + 6) << kOpcodeShift, | 359 SCD = ((7 << 3) + 4) << kOpcodeShift, |
| 342 SD = ((7 << 3) + 7) << kOpcodeShift, | 360 SDC1 = ((7 << 3) + 5) << kOpcodeShift, |
| 361 POP76 = ((7 << 3) + 6) << kOpcodeShift, |
| 362 SD = ((7 << 3) + 7) << kOpcodeShift, |
| 343 | 363 |
| 344 COP1X = ((1 << 4) + 3) << kOpcodeShift | 364 COP1X = ((1 << 4) + 3) << kOpcodeShift |
| 345 }; | 365 }; |
| 346 | 366 |
| 347 enum SecondaryField { | 367 enum SecondaryField { |
| 348 // SPECIAL Encoding of Function Field. | 368 // SPECIAL Encoding of Function Field. |
| 349 SLL = ((0 << 3) + 0), | 369 SLL = ((0 << 3) + 0), |
| 350 MOVCI = ((0 << 3) + 1), | 370 MOVCI = ((0 << 3) + 1), |
| 351 SRL = ((0 << 3) + 2), | 371 SRL = ((0 << 3) + 2), |
| 352 SRA = ((0 << 3) + 3), | 372 SRA = ((0 << 3) + 3), |
| 353 SLLV = ((0 << 3) + 4), | 373 SLLV = ((0 << 3) + 4), |
| 354 SRLV = ((0 << 3) + 6), | 374 SRLV = ((0 << 3) + 6), |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 // SPECIAL3 Encoding of Function Field. | 456 // SPECIAL3 Encoding of Function Field. |
| 437 EXT = ((0 << 3) + 0), | 457 EXT = ((0 << 3) + 0), |
| 438 DEXTM = ((0 << 3) + 1), | 458 DEXTM = ((0 << 3) + 1), |
| 439 DEXTU = ((0 << 3) + 2), | 459 DEXTU = ((0 << 3) + 2), |
| 440 DEXT = ((0 << 3) + 3), | 460 DEXT = ((0 << 3) + 3), |
| 441 INS = ((0 << 3) + 4), | 461 INS = ((0 << 3) + 4), |
| 442 DINSM = ((0 << 3) + 5), | 462 DINSM = ((0 << 3) + 5), |
| 443 DINSU = ((0 << 3) + 6), | 463 DINSU = ((0 << 3) + 6), |
| 444 DINS = ((0 << 3) + 7), | 464 DINS = ((0 << 3) + 7), |
| 445 | 465 |
| 446 BITSWAP = ((4 << 3) + 0), | 466 BSHFL = ((4 << 3) + 0), |
| 447 DBITSWAP = ((4 << 3) + 4), | 467 DBSHFL = ((4 << 3) + 4), |
| 448 DSBH = ((4 << 3) + 4), | |
| 449 | 468 |
| 450 // SPECIAL3 Encoding of sa Field. | 469 // SPECIAL3 Encoding of sa Field |
| 470 BITSWAP = ((0 << 3) + 0), |
| 471 ALIGN = ((0 << 3) + 2), |
| 472 WSBH = ((0 << 3) + 2), |
| 473 SEB = ((2 << 3) + 0), |
| 474 SEH = ((3 << 3) + 0), |
| 475 |
| 476 DBITSWAP = ((0 << 3) + 0), |
| 477 DALIGN = ((0 << 3) + 1), |
| 451 DBITSWAP_SA = ((0 << 3) + 0) << kSaShift, | 478 DBITSWAP_SA = ((0 << 3) + 0) << kSaShift, |
| 479 DSBH = ((0 << 3) + 2), |
| 480 DSHD = ((0 << 3) + 5), |
| 452 | 481 |
| 453 // REGIMM encoding of rt Field. | 482 // REGIMM encoding of rt Field. |
| 454 BLTZ = ((0 << 3) + 0) << 16, | 483 BLTZ = ((0 << 3) + 0) << 16, |
| 455 BGEZ = ((0 << 3) + 1) << 16, | 484 BGEZ = ((0 << 3) + 1) << 16, |
| 456 BLTZAL = ((2 << 3) + 0) << 16, | 485 BLTZAL = ((2 << 3) + 0) << 16, |
| 457 BGEZAL = ((2 << 3) + 1) << 16, | 486 BGEZAL = ((2 << 3) + 1) << 16, |
| 458 BGEZALL = ((2 << 3) + 3) << 16, | 487 BGEZALL = ((2 << 3) + 3) << 16, |
| 459 DAHI = ((0 << 3) + 6) << 16, | 488 DAHI = ((0 << 3) + 6) << 16, |
| 460 DATI = ((3 << 3) + 6) << 16, | 489 DATI = ((3 << 3) + 6) << 16, |
| 461 | 490 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 MOVF = ((2 << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt | 610 MOVF = ((2 << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt |
| 582 MOVZ_C = ((2 << 3) + 2), // COP1 on FPR registers. | 611 MOVZ_C = ((2 << 3) + 2), // COP1 on FPR registers. |
| 583 MOVN_C = ((2 << 3) + 3), // COP1 on FPR registers. | 612 MOVN_C = ((2 << 3) + 3), // COP1 on FPR registers. |
| 584 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. | 613 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. |
| 585 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. | 614 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. |
| 586 | 615 |
| 587 // COP1 Encoding of Function Field When rs=PS. | 616 // COP1 Encoding of Function Field When rs=PS. |
| 588 // COP1X Encoding of Function Field. | 617 // COP1X Encoding of Function Field. |
| 589 MADD_D = ((4 << 3) + 1), | 618 MADD_D = ((4 << 3) + 1), |
| 590 | 619 |
| 620 // PCREL Encoding of rt field |
| 621 ADDIUPC = ((0 << 2) + 0), |
| 622 LWPC = ((0 << 2) + 1), |
| 623 LWUPC = ((0 << 2) + 2), |
| 624 LDPC = ((0 << 3) + 6), |
| 625 // reserved ((1 << 3) + 6), |
| 626 AUIPC = ((3 << 3) + 6), |
| 627 ALUIPC = ((3 << 3) + 7), |
| 628 |
| 629 // POP66 Encoding of rs field |
| 630 JIC = ((0 << 5) + 0), |
| 631 |
| 632 // POP76 Encoding of rs field |
| 633 JIALC = ((0 << 5) + 0), |
| 634 |
| 591 NULLSF = 0 | 635 NULLSF = 0 |
| 592 }; | 636 }; |
| 593 | 637 |
| 594 | 638 |
| 595 // ----- Emulated conditions. | 639 // ----- Emulated conditions. |
| 596 // On MIPS we use this enum to abstract from conditional branch instructions. | 640 // On MIPS we use this enum to abstract from conditional branch instructions. |
| 597 // The 'U' prefix is used to specify unsigned comparisons. | 641 // The 'U' prefix is used to specify unsigned comparisons. |
| 598 // Opposite conditions must be paired as odd/even numbers | 642 // Opposite conditions must be paired as odd/even numbers |
| 599 // because 'NegateCondition' function flips LSB to negate condition. | 643 // because 'NegateCondition' function flips LSB to negate condition. |
| 600 enum Condition { | 644 enum Condition { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 } | 935 } |
| 892 | 936 |
| 893 inline int FtValue() const { | 937 inline int FtValue() const { |
| 894 return Bits(kFtShift + kFtBits - 1, kFtShift); | 938 return Bits(kFtShift + kFtBits - 1, kFtShift); |
| 895 } | 939 } |
| 896 | 940 |
| 897 inline int FrValue() const { | 941 inline int FrValue() const { |
| 898 return Bits(kFrShift + kFrBits -1, kFrShift); | 942 return Bits(kFrShift + kFrBits -1, kFrShift); |
| 899 } | 943 } |
| 900 | 944 |
| 945 inline int Bp2Value() const { |
| 946 DCHECK(InstructionType() == kRegisterType); |
| 947 return Bits(kBp2Shift + kBp2Bits - 1, kBp2Shift); |
| 948 } |
| 949 |
| 950 inline int Bp3Value() const { |
| 951 DCHECK(InstructionType() == kRegisterType); |
| 952 return Bits(kBp3Shift + kBp3Bits - 1, kBp3Shift); |
| 953 } |
| 954 |
| 901 // Float Compare condition code instruction bits. | 955 // Float Compare condition code instruction bits. |
| 902 inline int FCccValue() const { | 956 inline int FCccValue() const { |
| 903 return Bits(kFCccShift + kFCccBits - 1, kFCccShift); | 957 return Bits(kFCccShift + kFCccBits - 1, kFCccShift); |
| 904 } | 958 } |
| 905 | 959 |
| 906 // Float Branch condition code instruction bits. | 960 // Float Branch condition code instruction bits. |
| 907 inline int FBccValue() const { | 961 inline int FBccValue() const { |
| 908 return Bits(kFBccShift + kFBccBits - 1, kFBccShift); | 962 return Bits(kFBccShift + kFBccBits - 1, kFBccShift); |
| 909 } | 963 } |
| 910 | 964 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 934 InstructionType() == kImmediateType); | 988 InstructionType() == kImmediateType); |
| 935 return InstructionBits() & kRtFieldMask; | 989 return InstructionBits() & kRtFieldMask; |
| 936 } | 990 } |
| 937 | 991 |
| 938 inline int RdFieldRaw() const { | 992 inline int RdFieldRaw() const { |
| 939 DCHECK(InstructionType() == kRegisterType); | 993 DCHECK(InstructionType() == kRegisterType); |
| 940 return InstructionBits() & kRdFieldMask; | 994 return InstructionBits() & kRdFieldMask; |
| 941 } | 995 } |
| 942 | 996 |
| 943 inline int SaFieldRaw() const { | 997 inline int SaFieldRaw() const { |
| 944 DCHECK(InstructionType() == kRegisterType); | 998 // DCHECK(InstructionType() == kRegisterType); |
| 945 return InstructionBits() & kSaFieldMask; | 999 return InstructionBits() & kSaFieldMask; |
| 946 } | 1000 } |
| 947 | 1001 |
| 948 inline int FunctionFieldRaw() const { | 1002 inline int FunctionFieldRaw() const { |
| 949 return InstructionBits() & kFunctionFieldMask; | 1003 return InstructionBits() & kFunctionFieldMask; |
| 950 } | 1004 } |
| 951 | 1005 |
| 952 // Get the secondary field according to the opcode. | 1006 // Get the secondary field according to the opcode. |
| 953 inline int SecondaryValue() const { | 1007 inline int SecondaryValue() const { |
| 954 Opcode op = OpcodeFieldRaw(); | 1008 Opcode op = OpcodeFieldRaw(); |
| 955 switch (op) { | 1009 switch (op) { |
| 956 case SPECIAL: | 1010 case SPECIAL: |
| 957 case SPECIAL2: | 1011 case SPECIAL2: |
| 958 return FunctionValue(); | 1012 return FunctionValue(); |
| 959 case COP1: | 1013 case COP1: |
| 960 return RsValue(); | 1014 return RsValue(); |
| 961 case REGIMM: | 1015 case REGIMM: |
| 962 return RtValue(); | 1016 return RtValue(); |
| 963 default: | 1017 default: |
| 964 return NULLSF; | 1018 return NULLSF; |
| 965 } | 1019 } |
| 966 } | 1020 } |
| 967 | 1021 |
| 968 inline int32_t Imm16Value() const { | 1022 inline int32_t Imm16Value() const { |
| 969 DCHECK(InstructionType() == kImmediateType); | 1023 DCHECK(InstructionType() == kImmediateType); |
| 970 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); | 1024 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); |
| 971 } | 1025 } |
| 972 | 1026 |
| 1027 inline int32_t Imm18Value() const { |
| 1028 DCHECK(InstructionType() == kImmediateType); |
| 1029 return Bits(kImm18Shift + kImm18Bits - 1, kImm18Shift); |
| 1030 } |
| 1031 |
| 1032 inline int32_t Imm19Value() const { |
| 1033 DCHECK(InstructionType() == kImmediateType); |
| 1034 return Bits(kImm19Shift + kImm19Bits - 1, kImm19Shift); |
| 1035 } |
| 1036 |
| 973 inline int32_t Imm21Value() const { | 1037 inline int32_t Imm21Value() const { |
| 974 DCHECK(InstructionType() == kImmediateType); | 1038 DCHECK(InstructionType() == kImmediateType); |
| 975 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift); | 1039 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift); |
| 976 } | 1040 } |
| 977 | 1041 |
| 978 inline int32_t Imm26Value() const { | 1042 inline int32_t Imm26Value() const { |
| 979 DCHECK(InstructionType() == kJumpType); | 1043 DCHECK((InstructionType() == kJumpType) || |
| 1044 (InstructionType() == kImmediateType)); |
| 980 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); | 1045 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); |
| 981 } | 1046 } |
| 982 | 1047 |
| 983 // Say if the instruction should not be used in a branch delay slot. | 1048 // Say if the instruction should not be used in a branch delay slot. |
| 984 bool IsForbiddenInBranchDelay() const; | 1049 bool IsForbiddenInBranchDelay() const; |
| 985 // Say if the instruction 'links'. e.g. jal, bal. | 1050 // Say if the instruction 'links'. e.g. jal, bal. |
| 986 bool IsLinkingInstruction() const; | 1051 bool IsLinkingInstruction() const; |
| 987 // Say if the instruction is a break or a trap. | 1052 // Say if the instruction is a break or a trap. |
| 988 bool IsTrap() const; | 1053 bool IsTrap() const; |
| 989 | 1054 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1010 // TODO(plind): below should be based on kPointerSize | 1075 // TODO(plind): below should be based on kPointerSize |
| 1011 // TODO(plind): find all usages and remove the needless instructions for n64. | 1076 // TODO(plind): find all usages and remove the needless instructions for n64. |
| 1012 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; | 1077 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; |
| 1013 | 1078 |
| 1014 const int kInvalidStackOffset = -1; | 1079 const int kInvalidStackOffset = -1; |
| 1015 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 1080 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
| 1016 | 1081 |
| 1017 } } // namespace v8::internal | 1082 } } // namespace v8::internal |
| 1018 | 1083 |
| 1019 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 1084 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
| OLD | NEW |