Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: src/mips64/constants-mips64.h

Issue 1534183002: MIPS64: r6 compact branch optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing master to include the new changes Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/assembler-mips64-inl.h ('k') | src/mips64/constants-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/base/macros.h" 9 #include "src/base/macros.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Misc masks. 297 // Misc masks.
298 const int kHiMask = 0xffff << 16; 298 const int kHiMask = 0xffff << 16;
299 const int kLoMask = 0xffff; 299 const int kLoMask = 0xffff;
300 const int kSignMask = 0x80000000; 300 const int kSignMask = 0x80000000;
301 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; 301 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1;
302 const int64_t kHi16MaskOf64 = (int64_t)0xffff << 48; 302 const int64_t kHi16MaskOf64 = (int64_t)0xffff << 48;
303 const int64_t kSe16MaskOf64 = (int64_t)0xffff << 32; 303 const int64_t kSe16MaskOf64 = (int64_t)0xffff << 32;
304 const int64_t kTh16MaskOf64 = (int64_t)0xffff << 16; 304 const int64_t kTh16MaskOf64 = (int64_t)0xffff << 16;
305 const int32_t kJalRawMark = 0x00000000; 305 const int32_t kJalRawMark = 0x00000000;
306 const int32_t kJRawMark = 0xf0000000; 306 const int32_t kJRawMark = 0xf0000000;
307 const int32_t kJumpRawMask = 0xf0000000;
307 308
308 // ----- MIPS Opcodes and Function Fields. 309 // ----- MIPS Opcodes and Function Fields.
309 // We use this presentation to stay close to the table representation in 310 // We use this presentation to stay close to the table representation in
310 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. 311 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set.
311 enum Opcode { 312 enum Opcode : uint32_t {
312 SPECIAL = 0 << kOpcodeShift, 313 SPECIAL = 0U << kOpcodeShift,
313 REGIMM = 1 << kOpcodeShift, 314 REGIMM = 1U << kOpcodeShift,
314 315
315 J = ((0 << 3) + 2) << kOpcodeShift, 316 J = ((0U << 3) + 2) << kOpcodeShift,
316 JAL = ((0 << 3) + 3) << kOpcodeShift, 317 JAL = ((0U << 3) + 3) << kOpcodeShift,
317 BEQ = ((0 << 3) + 4) << kOpcodeShift, 318 BEQ = ((0U << 3) + 4) << kOpcodeShift,
318 BNE = ((0 << 3) + 5) << kOpcodeShift, 319 BNE = ((0U << 3) + 5) << kOpcodeShift,
319 BLEZ = ((0 << 3) + 6) << kOpcodeShift, 320 BLEZ = ((0U << 3) + 6) << kOpcodeShift,
320 BGTZ = ((0 << 3) + 7) << kOpcodeShift, 321 BGTZ = ((0U << 3) + 7) << kOpcodeShift,
321 322
322 ADDI = ((1 << 3) + 0) << kOpcodeShift, 323 ADDI = ((1U << 3) + 0) << kOpcodeShift,
323 ADDIU = ((1 << 3) + 1) << kOpcodeShift, 324 ADDIU = ((1U << 3) + 1) << kOpcodeShift,
324 SLTI = ((1 << 3) + 2) << kOpcodeShift, 325 SLTI = ((1U << 3) + 2) << kOpcodeShift,
325 SLTIU = ((1 << 3) + 3) << kOpcodeShift, 326 SLTIU = ((1U << 3) + 3) << kOpcodeShift,
326 ANDI = ((1 << 3) + 4) << kOpcodeShift, 327 ANDI = ((1U << 3) + 4) << kOpcodeShift,
327 ORI = ((1 << 3) + 5) << kOpcodeShift, 328 ORI = ((1U << 3) + 5) << kOpcodeShift,
328 XORI = ((1 << 3) + 6) << kOpcodeShift, 329 XORI = ((1U << 3) + 6) << kOpcodeShift,
329 LUI = ((1 << 3) + 7) << kOpcodeShift, // LUI/AUI family. 330 LUI = ((1U << 3) + 7) << kOpcodeShift, // LUI/AUI family.
330 DAUI = ((3 << 3) + 5) << kOpcodeShift, 331 DAUI = ((3U << 3) + 5) << kOpcodeShift,
331 332
332 BEQC = ((2 << 3) + 0) << kOpcodeShift, 333 BEQC = ((2U << 3) + 0) << kOpcodeShift,
333 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. 334 COP1 = ((2U << 3) + 1) << kOpcodeShift, // Coprocessor 1 class.
334 BEQL = ((2 << 3) + 4) << kOpcodeShift, 335 BEQL = ((2U << 3) + 4) << kOpcodeShift,
335 BNEL = ((2 << 3) + 5) << kOpcodeShift, 336 BNEL = ((2U << 3) + 5) << kOpcodeShift,
336 BLEZL = ((2 << 3) + 6) << kOpcodeShift, 337 BLEZL = ((2U << 3) + 6) << kOpcodeShift,
337 BGTZL = ((2 << 3) + 7) << kOpcodeShift, 338 BGTZL = ((2U << 3) + 7) << kOpcodeShift,
338 339
339 DADDI = ((3 << 3) + 0) << kOpcodeShift, // This is also BNEC. 340 DADDI = ((3U << 3) + 0) << kOpcodeShift, // This is also BNEC.
340 DADDIU = ((3 << 3) + 1) << kOpcodeShift, 341 DADDIU = ((3U << 3) + 1) << kOpcodeShift,
341 LDL = ((3 << 3) + 2) << kOpcodeShift, 342 LDL = ((3U << 3) + 2) << kOpcodeShift,
342 LDR = ((3 << 3) + 3) << kOpcodeShift, 343 LDR = ((3U << 3) + 3) << kOpcodeShift,
343 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, 344 SPECIAL2 = ((3U << 3) + 4) << kOpcodeShift,
344 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, 345 SPECIAL3 = ((3U << 3) + 7) << kOpcodeShift,
345 346
346 LB = ((4 << 3) + 0) << kOpcodeShift, 347 LB = ((4U << 3) + 0) << kOpcodeShift,
347 LH = ((4 << 3) + 1) << kOpcodeShift, 348 LH = ((4U << 3) + 1) << kOpcodeShift,
348 LWL = ((4 << 3) + 2) << kOpcodeShift, 349 LWL = ((4U << 3) + 2) << kOpcodeShift,
349 LW = ((4 << 3) + 3) << kOpcodeShift, 350 LW = ((4U << 3) + 3) << kOpcodeShift,
350 LBU = ((4 << 3) + 4) << kOpcodeShift, 351 LBU = ((4U << 3) + 4) << kOpcodeShift,
351 LHU = ((4 << 3) + 5) << kOpcodeShift, 352 LHU = ((4U << 3) + 5) << kOpcodeShift,
352 LWR = ((4 << 3) + 6) << kOpcodeShift, 353 LWR = ((4U << 3) + 6) << kOpcodeShift,
353 LWU = ((4 << 3) + 7) << kOpcodeShift, 354 LWU = ((4U << 3) + 7) << kOpcodeShift,
354 355
355 SB = ((5 << 3) + 0) << kOpcodeShift, 356 SB = ((5U << 3) + 0) << kOpcodeShift,
356 SH = ((5 << 3) + 1) << kOpcodeShift, 357 SH = ((5U << 3) + 1) << kOpcodeShift,
357 SWL = ((5 << 3) + 2) << kOpcodeShift, 358 SWL = ((5U << 3) + 2) << kOpcodeShift,
358 SW = ((5 << 3) + 3) << kOpcodeShift, 359 SW = ((5U << 3) + 3) << kOpcodeShift,
359 SDL = ((5 << 3) + 4) << kOpcodeShift, 360 SDL = ((5U << 3) + 4) << kOpcodeShift,
360 SDR = ((5 << 3) + 5) << kOpcodeShift, 361 SDR = ((5U << 3) + 5) << kOpcodeShift,
361 SWR = ((5 << 3) + 6) << kOpcodeShift, 362 SWR = ((5U << 3) + 6) << kOpcodeShift,
362 363
363 LWC1 = ((6 << 3) + 1) << kOpcodeShift, 364 LWC1 = ((6U << 3) + 1) << kOpcodeShift,
364 BC = ((6 << 3) + 2) << kOpcodeShift, 365 BC = ((6U << 3) + 2) << kOpcodeShift,
365 LLD = ((6 << 3) + 4) << kOpcodeShift, 366 LLD = ((6U << 3) + 4) << kOpcodeShift,
366 LDC1 = ((6 << 3) + 5) << kOpcodeShift, 367 LDC1 = ((6U << 3) + 5) << kOpcodeShift,
367 POP66 = ((6 << 3) + 6) << kOpcodeShift, 368 POP66 = ((6U << 3) + 6) << kOpcodeShift,
368 LD = ((6 << 3) + 7) << kOpcodeShift, 369 LD = ((6U << 3) + 7) << kOpcodeShift,
369 370
370 PREF = ((6 << 3) + 3) << kOpcodeShift, 371 PREF = ((6U << 3) + 3) << kOpcodeShift,
371 372
372 SWC1 = ((7 << 3) + 1) << kOpcodeShift, 373 SWC1 = ((7U << 3) + 1) << kOpcodeShift,
373 BALC = ((7 << 3) + 2) << kOpcodeShift, 374 BALC = ((7U << 3) + 2) << kOpcodeShift,
374 PCREL = ((7 << 3) + 3) << kOpcodeShift, 375 PCREL = ((7U << 3) + 3) << kOpcodeShift,
375 SCD = ((7 << 3) + 4) << kOpcodeShift, 376 SCD = ((7U << 3) + 4) << kOpcodeShift,
376 SDC1 = ((7 << 3) + 5) << kOpcodeShift, 377 SDC1 = ((7U << 3) + 5) << kOpcodeShift,
377 POP76 = ((7 << 3) + 6) << kOpcodeShift, 378 POP76 = ((7U << 3) + 6) << kOpcodeShift,
378 SD = ((7 << 3) + 7) << kOpcodeShift, 379 SD = ((7U << 3) + 7) << kOpcodeShift,
379 380
380 COP1X = ((1 << 4) + 3) << kOpcodeShift 381 COP1X = ((1U << 4) + 3) << kOpcodeShift,
382
383 // New r6 instruction.
384 POP06 = BLEZ, // bgeuc/bleuc, blezalc, bgezalc
385 POP07 = BGTZ, // bltuc/bgtuc, bgtzalc, bltzalc
386 POP10 = ADDI, // beqzalc, bovc, beqc
387 POP26 = BLEZL, // bgezc, blezc, bgec/blec
388 POP27 = BGTZL, // bgtzc, bltzc, bltc/bgtc
389 POP30 = DADDI, // bnezalc, bnvc, bnec
381 }; 390 };
382 391
383 enum SecondaryField { 392 enum SecondaryField : uint32_t {
384 // SPECIAL Encoding of Function Field. 393 // SPECIAL Encoding of Function Field.
385 SLL = ((0 << 3) + 0), 394 SLL = ((0U << 3) + 0),
386 MOVCI = ((0 << 3) + 1), 395 MOVCI = ((0U << 3) + 1),
387 SRL = ((0 << 3) + 2), 396 SRL = ((0U << 3) + 2),
388 SRA = ((0 << 3) + 3), 397 SRA = ((0U << 3) + 3),
389 SLLV = ((0 << 3) + 4), 398 SLLV = ((0U << 3) + 4),
390 LSA = ((0 << 3) + 5), 399 LSA = ((0U << 3) + 5),
391 SRLV = ((0 << 3) + 6), 400 SRLV = ((0U << 3) + 6),
392 SRAV = ((0 << 3) + 7), 401 SRAV = ((0U << 3) + 7),
393 402
394 JR = ((1 << 3) + 0), 403 JR = ((1U << 3) + 0),
395 JALR = ((1 << 3) + 1), 404 JALR = ((1U << 3) + 1),
396 MOVZ = ((1 << 3) + 2), 405 MOVZ = ((1U << 3) + 2),
397 MOVN = ((1 << 3) + 3), 406 MOVN = ((1U << 3) + 3),
398 BREAK = ((1 << 3) + 5), 407 BREAK = ((1U << 3) + 5),
399 408
400 MFHI = ((2 << 3) + 0), 409 MFHI = ((2U << 3) + 0),
401 CLZ_R6 = ((2 << 3) + 0), 410 CLZ_R6 = ((2U << 3) + 0),
402 CLO_R6 = ((2 << 3) + 1), 411 CLO_R6 = ((2U << 3) + 1),
403 MFLO = ((2 << 3) + 2), 412 MFLO = ((2U << 3) + 2),
404 DCLZ_R6 = ((2 << 3) + 2), 413 DCLZ_R6 = ((2U << 3) + 2),
405 DCLO_R6 = ((2 << 3) + 3), 414 DCLO_R6 = ((2U << 3) + 3),
406 DSLLV = ((2 << 3) + 4), 415 DSLLV = ((2U << 3) + 4),
407 DLSA = ((2 << 3) + 5), 416 DLSA = ((2U << 3) + 5),
408 DSRLV = ((2 << 3) + 6), 417 DSRLV = ((2U << 3) + 6),
409 DSRAV = ((2 << 3) + 7), 418 DSRAV = ((2U << 3) + 7),
410 419
411 MULT = ((3 << 3) + 0), 420 MULT = ((3U << 3) + 0),
412 MULTU = ((3 << 3) + 1), 421 MULTU = ((3U << 3) + 1),
413 DIV = ((3 << 3) + 2), 422 DIV = ((3U << 3) + 2),
414 DIVU = ((3 << 3) + 3), 423 DIVU = ((3U << 3) + 3),
415 DMULT = ((3 << 3) + 4), 424 DMULT = ((3U << 3) + 4),
416 DMULTU = ((3 << 3) + 5), 425 DMULTU = ((3U << 3) + 5),
417 DDIV = ((3 << 3) + 6), 426 DDIV = ((3U << 3) + 6),
418 DDIVU = ((3 << 3) + 7), 427 DDIVU = ((3U << 3) + 7),
419 428
420 ADD = ((4 << 3) + 0), 429 ADD = ((4U << 3) + 0),
421 ADDU = ((4 << 3) + 1), 430 ADDU = ((4U << 3) + 1),
422 SUB = ((4 << 3) + 2), 431 SUB = ((4U << 3) + 2),
423 SUBU = ((4 << 3) + 3), 432 SUBU = ((4U << 3) + 3),
424 AND = ((4 << 3) + 4), 433 AND = ((4U << 3) + 4),
425 OR = ((4 << 3) + 5), 434 OR = ((4U << 3) + 5),
426 XOR = ((4 << 3) + 6), 435 XOR = ((4U << 3) + 6),
427 NOR = ((4 << 3) + 7), 436 NOR = ((4U << 3) + 7),
428 437
429 SLT = ((5 << 3) + 2), 438 SLT = ((5U << 3) + 2),
430 SLTU = ((5 << 3) + 3), 439 SLTU = ((5U << 3) + 3),
431 DADD = ((5 << 3) + 4), 440 DADD = ((5U << 3) + 4),
432 DADDU = ((5 << 3) + 5), 441 DADDU = ((5U << 3) + 5),
433 DSUB = ((5 << 3) + 6), 442 DSUB = ((5U << 3) + 6),
434 DSUBU = ((5 << 3) + 7), 443 DSUBU = ((5U << 3) + 7),
435 444
436 TGE = ((6 << 3) + 0), 445 TGE = ((6U << 3) + 0),
437 TGEU = ((6 << 3) + 1), 446 TGEU = ((6U << 3) + 1),
438 TLT = ((6 << 3) + 2), 447 TLT = ((6U << 3) + 2),
439 TLTU = ((6 << 3) + 3), 448 TLTU = ((6U << 3) + 3),
440 TEQ = ((6 << 3) + 4), 449 TEQ = ((6U << 3) + 4),
441 SELEQZ_S = ((6 << 3) + 5), 450 SELEQZ_S = ((6U << 3) + 5),
442 TNE = ((6 << 3) + 6), 451 TNE = ((6U << 3) + 6),
443 SELNEZ_S = ((6 << 3) + 7), 452 SELNEZ_S = ((6U << 3) + 7),
444 453
445 DSLL = ((7 << 3) + 0), 454 DSLL = ((7U << 3) + 0),
446 DSRL = ((7 << 3) + 2), 455 DSRL = ((7U << 3) + 2),
447 DSRA = ((7 << 3) + 3), 456 DSRA = ((7U << 3) + 3),
448 DSLL32 = ((7 << 3) + 4), 457 DSLL32 = ((7U << 3) + 4),
449 DSRL32 = ((7 << 3) + 6), 458 DSRL32 = ((7U << 3) + 6),
450 DSRA32 = ((7 << 3) + 7), 459 DSRA32 = ((7U << 3) + 7),
451 460
452 // Multiply integers in r6. 461 // Multiply integers in r6.
453 MUL_MUH = ((3 << 3) + 0), // MUL, MUH. 462 MUL_MUH = ((3U << 3) + 0), // MUL, MUH.
454 MUL_MUH_U = ((3 << 3) + 1), // MUL_U, MUH_U. 463 MUL_MUH_U = ((3U << 3) + 1), // MUL_U, MUH_U.
455 D_MUL_MUH = ((7 << 2) + 0), // DMUL, DMUH. 464 D_MUL_MUH = ((7U << 2) + 0), // DMUL, DMUH.
456 D_MUL_MUH_U = ((7 << 2) + 1), // DMUL_U, DMUH_U. 465 D_MUL_MUH_U = ((7U << 2) + 1), // DMUL_U, DMUH_U.
457 RINT = ((3 << 3) + 2), 466 RINT = ((3U << 3) + 2),
458 467
459 MUL_OP = ((0 << 3) + 2), 468 MUL_OP = ((0U << 3) + 2),
460 MUH_OP = ((0 << 3) + 3), 469 MUH_OP = ((0U << 3) + 3),
461 DIV_OP = ((0 << 3) + 2), 470 DIV_OP = ((0U << 3) + 2),
462 MOD_OP = ((0 << 3) + 3), 471 MOD_OP = ((0U << 3) + 3),
463 472
464 DIV_MOD = ((3 << 3) + 2), 473 DIV_MOD = ((3U << 3) + 2),
465 DIV_MOD_U = ((3 << 3) + 3), 474 DIV_MOD_U = ((3U << 3) + 3),
466 D_DIV_MOD = ((3 << 3) + 6), 475 D_DIV_MOD = ((3U << 3) + 6),
467 D_DIV_MOD_U = ((3 << 3) + 7), 476 D_DIV_MOD_U = ((3U << 3) + 7),
468 477
469 // drotr in special4? 478 // drotr in special4?
470 479
471 // SPECIAL2 Encoding of Function Field. 480 // SPECIAL2 Encoding of Function Field.
472 MUL = ((0 << 3) + 2), 481 MUL = ((0U << 3) + 2),
473 CLZ = ((4 << 3) + 0), 482 CLZ = ((4U << 3) + 0),
474 CLO = ((4 << 3) + 1), 483 CLO = ((4U << 3) + 1),
475 DCLZ = ((4 << 3) + 4), 484 DCLZ = ((4U << 3) + 4),
476 DCLO = ((4 << 3) + 5), 485 DCLO = ((4U << 3) + 5),
477 486
478 // SPECIAL3 Encoding of Function Field. 487 // SPECIAL3 Encoding of Function Field.
479 EXT = ((0 << 3) + 0), 488 EXT = ((0U << 3) + 0),
480 DEXTM = ((0 << 3) + 1), 489 DEXTM = ((0U << 3) + 1),
481 DEXTU = ((0 << 3) + 2), 490 DEXTU = ((0U << 3) + 2),
482 DEXT = ((0 << 3) + 3), 491 DEXT = ((0U << 3) + 3),
483 INS = ((0 << 3) + 4), 492 INS = ((0U << 3) + 4),
484 DINSM = ((0 << 3) + 5), 493 DINSM = ((0U << 3) + 5),
485 DINSU = ((0 << 3) + 6), 494 DINSU = ((0U << 3) + 6),
486 DINS = ((0 << 3) + 7), 495 DINS = ((0U << 3) + 7),
487 496
488 BSHFL = ((4 << 3) + 0), 497 BSHFL = ((4U << 3) + 0),
489 DBSHFL = ((4 << 3) + 4), 498 DBSHFL = ((4U << 3) + 4),
490 499
491 // SPECIAL3 Encoding of sa Field. 500 // SPECIAL3 Encoding of sa Field.
492 BITSWAP = ((0 << 3) + 0), 501 BITSWAP = ((0U << 3) + 0),
493 ALIGN = ((0 << 3) + 2), 502 ALIGN = ((0U << 3) + 2),
494 WSBH = ((0 << 3) + 2), 503 WSBH = ((0U << 3) + 2),
495 SEB = ((2 << 3) + 0), 504 SEB = ((2U << 3) + 0),
496 SEH = ((3 << 3) + 0), 505 SEH = ((3U << 3) + 0),
497 506
498 DBITSWAP = ((0 << 3) + 0), 507 DBITSWAP = ((0U << 3) + 0),
499 DALIGN = ((0 << 3) + 1), 508 DALIGN = ((0U << 3) + 1),
500 DBITSWAP_SA = ((0 << 3) + 0) << kSaShift, 509 DBITSWAP_SA = ((0U << 3) + 0) << kSaShift,
501 DSBH = ((0 << 3) + 2), 510 DSBH = ((0U << 3) + 2),
502 DSHD = ((0 << 3) + 5), 511 DSHD = ((0U << 3) + 5),
503 512
504 // REGIMM encoding of rt Field. 513 // REGIMM encoding of rt Field.
505 BLTZ = ((0 << 3) + 0) << 16, 514 BLTZ = ((0U << 3) + 0) << 16,
506 BGEZ = ((0 << 3) + 1) << 16, 515 BGEZ = ((0U << 3) + 1) << 16,
507 BLTZAL = ((2 << 3) + 0) << 16, 516 BLTZAL = ((2U << 3) + 0) << 16,
508 BGEZAL = ((2 << 3) + 1) << 16, 517 BGEZAL = ((2U << 3) + 1) << 16,
509 BGEZALL = ((2 << 3) + 3) << 16, 518 BGEZALL = ((2U << 3) + 3) << 16,
510 DAHI = ((0 << 3) + 6) << 16, 519 DAHI = ((0U << 3) + 6) << 16,
511 DATI = ((3 << 3) + 6) << 16, 520 DATI = ((3U << 3) + 6) << 16,
512 521
513 // COP1 Encoding of rs Field. 522 // COP1 Encoding of rs Field.
514 MFC1 = ((0 << 3) + 0) << 21, 523 MFC1 = ((0U << 3) + 0) << 21,
515 DMFC1 = ((0 << 3) + 1) << 21, 524 DMFC1 = ((0U << 3) + 1) << 21,
516 CFC1 = ((0 << 3) + 2) << 21, 525 CFC1 = ((0U << 3) + 2) << 21,
517 MFHC1 = ((0 << 3) + 3) << 21, 526 MFHC1 = ((0U << 3) + 3) << 21,
518 MTC1 = ((0 << 3) + 4) << 21, 527 MTC1 = ((0U << 3) + 4) << 21,
519 DMTC1 = ((0 << 3) + 5) << 21, 528 DMTC1 = ((0U << 3) + 5) << 21,
520 CTC1 = ((0 << 3) + 6) << 21, 529 CTC1 = ((0U << 3) + 6) << 21,
521 MTHC1 = ((0 << 3) + 7) << 21, 530 MTHC1 = ((0U << 3) + 7) << 21,
522 BC1 = ((1 << 3) + 0) << 21, 531 BC1 = ((1U << 3) + 0) << 21,
523 S = ((2 << 3) + 0) << 21, 532 S = ((2U << 3) + 0) << 21,
524 D = ((2 << 3) + 1) << 21, 533 D = ((2U << 3) + 1) << 21,
525 W = ((2 << 3) + 4) << 21, 534 W = ((2U << 3) + 4) << 21,
526 L = ((2 << 3) + 5) << 21, 535 L = ((2U << 3) + 5) << 21,
527 PS = ((2 << 3) + 6) << 21, 536 PS = ((2U << 3) + 6) << 21,
528 // COP1 Encoding of Function Field When rs=S. 537 // COP1 Encoding of Function Field When rs=S.
529 538
530 ADD_S = ((0 << 3) + 0), 539 ADD_S = ((0U << 3) + 0),
531 SUB_S = ((0 << 3) + 1), 540 SUB_S = ((0U << 3) + 1),
532 MUL_S = ((0 << 3) + 2), 541 MUL_S = ((0U << 3) + 2),
533 DIV_S = ((0 << 3) + 3), 542 DIV_S = ((0U << 3) + 3),
534 ABS_S = ((0 << 3) + 5), 543 ABS_S = ((0U << 3) + 5),
535 SQRT_S = ((0 << 3) + 4), 544 SQRT_S = ((0U << 3) + 4),
536 MOV_S = ((0 << 3) + 6), 545 MOV_S = ((0U << 3) + 6),
537 NEG_S = ((0 << 3) + 7), 546 NEG_S = ((0U << 3) + 7),
538 ROUND_L_S = ((1 << 3) + 0), 547 ROUND_L_S = ((1U << 3) + 0),
539 TRUNC_L_S = ((1 << 3) + 1), 548 TRUNC_L_S = ((1U << 3) + 1),
540 CEIL_L_S = ((1 << 3) + 2), 549 CEIL_L_S = ((1U << 3) + 2),
541 FLOOR_L_S = ((1 << 3) + 3), 550 FLOOR_L_S = ((1U << 3) + 3),
542 ROUND_W_S = ((1 << 3) + 4), 551 ROUND_W_S = ((1U << 3) + 4),
543 TRUNC_W_S = ((1 << 3) + 5), 552 TRUNC_W_S = ((1U << 3) + 5),
544 CEIL_W_S = ((1 << 3) + 6), 553 CEIL_W_S = ((1U << 3) + 6),
545 FLOOR_W_S = ((1 << 3) + 7), 554 FLOOR_W_S = ((1U << 3) + 7),
546 RECIP_S = ((2 << 3) + 5), 555 RECIP_S = ((2U << 3) + 5),
547 RSQRT_S = ((2 << 3) + 6), 556 RSQRT_S = ((2U << 3) + 6),
548 CLASS_S = ((3 << 3) + 3), 557 CLASS_S = ((3U << 3) + 3),
549 CVT_D_S = ((4 << 3) + 1), 558 CVT_D_S = ((4U << 3) + 1),
550 CVT_W_S = ((4 << 3) + 4), 559 CVT_W_S = ((4U << 3) + 4),
551 CVT_L_S = ((4 << 3) + 5), 560 CVT_L_S = ((4U << 3) + 5),
552 CVT_PS_S = ((4 << 3) + 6), 561 CVT_PS_S = ((4U << 3) + 6),
553 // COP1 Encoding of Function Field When rs=D. 562 // COP1 Encoding of Function Field When rs=D.
554 ADD_D = ((0 << 3) + 0), 563 ADD_D = ((0U << 3) + 0),
555 SUB_D = ((0 << 3) + 1), 564 SUB_D = ((0U << 3) + 1),
556 MUL_D = ((0 << 3) + 2), 565 MUL_D = ((0U << 3) + 2),
557 DIV_D = ((0 << 3) + 3), 566 DIV_D = ((0U << 3) + 3),
558 SQRT_D = ((0 << 3) + 4), 567 SQRT_D = ((0U << 3) + 4),
559 ABS_D = ((0 << 3) + 5), 568 ABS_D = ((0U << 3) + 5),
560 MOV_D = ((0 << 3) + 6), 569 MOV_D = ((0U << 3) + 6),
561 NEG_D = ((0 << 3) + 7), 570 NEG_D = ((0U << 3) + 7),
562 ROUND_L_D = ((1 << 3) + 0), 571 ROUND_L_D = ((1U << 3) + 0),
563 TRUNC_L_D = ((1 << 3) + 1), 572 TRUNC_L_D = ((1U << 3) + 1),
564 CEIL_L_D = ((1 << 3) + 2), 573 CEIL_L_D = ((1U << 3) + 2),
565 FLOOR_L_D = ((1 << 3) + 3), 574 FLOOR_L_D = ((1U << 3) + 3),
566 ROUND_W_D = ((1 << 3) + 4), 575 ROUND_W_D = ((1U << 3) + 4),
567 TRUNC_W_D = ((1 << 3) + 5), 576 TRUNC_W_D = ((1U << 3) + 5),
568 CEIL_W_D = ((1 << 3) + 6), 577 CEIL_W_D = ((1U << 3) + 6),
569 FLOOR_W_D = ((1 << 3) + 7), 578 FLOOR_W_D = ((1U << 3) + 7),
570 RECIP_D = ((2 << 3) + 5), 579 RECIP_D = ((2U << 3) + 5),
571 RSQRT_D = ((2 << 3) + 6), 580 RSQRT_D = ((2U << 3) + 6),
572 CLASS_D = ((3 << 3) + 3), 581 CLASS_D = ((3U << 3) + 3),
573 MIN = ((3 << 3) + 4), 582 MIN = ((3U << 3) + 4),
574 MINA = ((3 << 3) + 5), 583 MINA = ((3U << 3) + 5),
575 MAX = ((3 << 3) + 6), 584 MAX = ((3U << 3) + 6),
576 MAXA = ((3 << 3) + 7), 585 MAXA = ((3U << 3) + 7),
577 CVT_S_D = ((4 << 3) + 0), 586 CVT_S_D = ((4U << 3) + 0),
578 CVT_W_D = ((4 << 3) + 4), 587 CVT_W_D = ((4U << 3) + 4),
579 CVT_L_D = ((4 << 3) + 5), 588 CVT_L_D = ((4U << 3) + 5),
580 C_F_D = ((6 << 3) + 0), 589 C_F_D = ((6U << 3) + 0),
581 C_UN_D = ((6 << 3) + 1), 590 C_UN_D = ((6U << 3) + 1),
582 C_EQ_D = ((6 << 3) + 2), 591 C_EQ_D = ((6U << 3) + 2),
583 C_UEQ_D = ((6 << 3) + 3), 592 C_UEQ_D = ((6U << 3) + 3),
584 C_OLT_D = ((6 << 3) + 4), 593 C_OLT_D = ((6U << 3) + 4),
585 C_ULT_D = ((6 << 3) + 5), 594 C_ULT_D = ((6U << 3) + 5),
586 C_OLE_D = ((6 << 3) + 6), 595 C_OLE_D = ((6U << 3) + 6),
587 C_ULE_D = ((6 << 3) + 7), 596 C_ULE_D = ((6U << 3) + 7),
588 597
589 // COP1 Encoding of Function Field When rs=W or L. 598 // COP1 Encoding of Function Field When rs=W or L.
590 CVT_S_W = ((4 << 3) + 0), 599 CVT_S_W = ((4U << 3) + 0),
591 CVT_D_W = ((4 << 3) + 1), 600 CVT_D_W = ((4U << 3) + 1),
592 CVT_S_L = ((4 << 3) + 0), 601 CVT_S_L = ((4U << 3) + 0),
593 CVT_D_L = ((4 << 3) + 1), 602 CVT_D_L = ((4U << 3) + 1),
594 BC1EQZ = ((2 << 2) + 1) << 21, 603 BC1EQZ = ((2U << 2) + 1) << 21,
595 BC1NEZ = ((3 << 2) + 1) << 21, 604 BC1NEZ = ((3U << 2) + 1) << 21,
596 // COP1 CMP positive predicates Bit 5..4 = 00. 605 // COP1 CMP positive predicates Bit 5..4 = 00.
597 CMP_AF = ((0 << 3) + 0), 606 CMP_AF = ((0U << 3) + 0),
598 CMP_UN = ((0 << 3) + 1), 607 CMP_UN = ((0U << 3) + 1),
599 CMP_EQ = ((0 << 3) + 2), 608 CMP_EQ = ((0U << 3) + 2),
600 CMP_UEQ = ((0 << 3) + 3), 609 CMP_UEQ = ((0U << 3) + 3),
601 CMP_LT = ((0 << 3) + 4), 610 CMP_LT = ((0U << 3) + 4),
602 CMP_ULT = ((0 << 3) + 5), 611 CMP_ULT = ((0U << 3) + 5),
603 CMP_LE = ((0 << 3) + 6), 612 CMP_LE = ((0U << 3) + 6),
604 CMP_ULE = ((0 << 3) + 7), 613 CMP_ULE = ((0U << 3) + 7),
605 CMP_SAF = ((1 << 3) + 0), 614 CMP_SAF = ((1U << 3) + 0),
606 CMP_SUN = ((1 << 3) + 1), 615 CMP_SUN = ((1U << 3) + 1),
607 CMP_SEQ = ((1 << 3) + 2), 616 CMP_SEQ = ((1U << 3) + 2),
608 CMP_SUEQ = ((1 << 3) + 3), 617 CMP_SUEQ = ((1U << 3) + 3),
609 CMP_SSLT = ((1 << 3) + 4), 618 CMP_SSLT = ((1U << 3) + 4),
610 CMP_SSULT = ((1 << 3) + 5), 619 CMP_SSULT = ((1U << 3) + 5),
611 CMP_SLE = ((1 << 3) + 6), 620 CMP_SLE = ((1U << 3) + 6),
612 CMP_SULE = ((1 << 3) + 7), 621 CMP_SULE = ((1U << 3) + 7),
613 // COP1 CMP negative predicates Bit 5..4 = 01. 622 // COP1 CMP negative predicates Bit 5..4 = 01.
614 CMP_AT = ((2 << 3) + 0), // Reserved, not implemented. 623 CMP_AT = ((2U << 3) + 0), // Reserved, not implemented.
615 CMP_OR = ((2 << 3) + 1), 624 CMP_OR = ((2U << 3) + 1),
616 CMP_UNE = ((2 << 3) + 2), 625 CMP_UNE = ((2U << 3) + 2),
617 CMP_NE = ((2 << 3) + 3), 626 CMP_NE = ((2U << 3) + 3),
618 CMP_UGE = ((2 << 3) + 4), // Reserved, not implemented. 627 CMP_UGE = ((2U << 3) + 4), // Reserved, not implemented.
619 CMP_OGE = ((2 << 3) + 5), // Reserved, not implemented. 628 CMP_OGE = ((2U << 3) + 5), // Reserved, not implemented.
620 CMP_UGT = ((2 << 3) + 6), // Reserved, not implemented. 629 CMP_UGT = ((2U << 3) + 6), // Reserved, not implemented.
621 CMP_OGT = ((2 << 3) + 7), // Reserved, not implemented. 630 CMP_OGT = ((2U << 3) + 7), // Reserved, not implemented.
622 CMP_SAT = ((3 << 3) + 0), // Reserved, not implemented. 631 CMP_SAT = ((3U << 3) + 0), // Reserved, not implemented.
623 CMP_SOR = ((3 << 3) + 1), 632 CMP_SOR = ((3U << 3) + 1),
624 CMP_SUNE = ((3 << 3) + 2), 633 CMP_SUNE = ((3U << 3) + 2),
625 CMP_SNE = ((3 << 3) + 3), 634 CMP_SNE = ((3U << 3) + 3),
626 CMP_SUGE = ((3 << 3) + 4), // Reserved, not implemented. 635 CMP_SUGE = ((3U << 3) + 4), // Reserved, not implemented.
627 CMP_SOGE = ((3 << 3) + 5), // Reserved, not implemented. 636 CMP_SOGE = ((3U << 3) + 5), // Reserved, not implemented.
628 CMP_SUGT = ((3 << 3) + 6), // Reserved, not implemented. 637 CMP_SUGT = ((3U << 3) + 6), // Reserved, not implemented.
629 CMP_SOGT = ((3 << 3) + 7), // Reserved, not implemented. 638 CMP_SOGT = ((3U << 3) + 7), // Reserved, not implemented.
630 639
631 SEL = ((2 << 3) + 0), 640 SEL = ((2U << 3) + 0),
632 MOVF = ((2 << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt 641 MOVF = ((2U << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt
633 MOVZ_C = ((2 << 3) + 2), // COP1 on FPR registers. 642 MOVZ_C = ((2U << 3) + 2), // COP1 on FPR registers.
634 MOVN_C = ((2 << 3) + 3), // COP1 on FPR registers. 643 MOVN_C = ((2U << 3) + 3), // COP1 on FPR registers.
635 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. 644 SELEQZ_C = ((2U << 3) + 4), // COP1 on FPR registers.
636 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. 645 SELNEZ_C = ((2U << 3) + 7), // COP1 on FPR registers.
637 646
638 // COP1 Encoding of Function Field When rs=PS. 647 // COP1 Encoding of Function Field When rs=PS.
639 // COP1X Encoding of Function Field. 648 // COP1X Encoding of Function Field.
640 MADD_D = ((4 << 3) + 1), 649 MADD_D = ((4U << 3) + 1),
641 650
642 // PCREL Encoding of rt Field. 651 // PCREL Encoding of rt Field.
643 ADDIUPC = ((0 << 2) + 0), 652 ADDIUPC = ((0U << 2) + 0),
644 LWPC = ((0 << 2) + 1), 653 LWPC = ((0U << 2) + 1),
645 LWUPC = ((0 << 2) + 2), 654 LWUPC = ((0U << 2) + 2),
646 LDPC = ((0 << 3) + 6), 655 LDPC = ((0U << 3) + 6),
647 // reserved ((1 << 3) + 6), 656 // reserved ((1U << 3) + 6),
648 AUIPC = ((3 << 3) + 6), 657 AUIPC = ((3U << 3) + 6),
649 ALUIPC = ((3 << 3) + 7), 658 ALUIPC = ((3U << 3) + 7),
650 659
651 // POP66 Encoding of rs Field. 660 // POP66 Encoding of rs Field.
652 JIC = ((0 << 5) + 0), 661 JIC = ((0U << 5) + 0),
653 662
654 // POP76 Encoding of rs Field. 663 // POP76 Encoding of rs Field.
655 JIALC = ((0 << 5) + 0), 664 JIALC = ((0U << 5) + 0),
656 665
657 NULLSF = 0 666 NULLSF = 0U
658 }; 667 };
659 668
660 669
661 // ----- Emulated conditions. 670 // ----- Emulated conditions.
662 // On MIPS we use this enum to abstract from conditional branch instructions. 671 // On MIPS we use this enum to abstract from conditional branch instructions.
663 // The 'U' prefix is used to specify unsigned comparisons. 672 // The 'U' prefix is used to specify unsigned comparisons.
664 // Opposite conditions must be paired as odd/even numbers 673 // Opposite conditions must be paired as odd/even numbers
665 // because 'NegateCondition' function flips LSB to negate condition. 674 // because 'NegateCondition' function flips LSB to negate condition.
666 enum Condition { 675 enum Condition {
667 // Any value < 0 is considered no_condition. 676 // Any value < 0 is considered no_condition.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 extern const Instr kRtMask; 879 extern const Instr kRtMask;
871 extern const Instr kLwSwInstrTypeMask; 880 extern const Instr kLwSwInstrTypeMask;
872 extern const Instr kLwSwInstrArgumentMask; 881 extern const Instr kLwSwInstrArgumentMask;
873 extern const Instr kLwSwOffsetMask; 882 extern const Instr kLwSwOffsetMask;
874 883
875 // Break 0xfffff, reserved for redirected real time call. 884 // Break 0xfffff, reserved for redirected real time call.
876 const Instr rtCallRedirInstr = SPECIAL | BREAK | call_rt_redirected << 6; 885 const Instr rtCallRedirInstr = SPECIAL | BREAK | call_rt_redirected << 6;
877 // A nop instruction. (Encoding of sll 0 0 0). 886 // A nop instruction. (Encoding of sll 0 0 0).
878 const Instr nopInstr = 0; 887 const Instr nopInstr = 0;
879 888
889 static constexpr uint64_t OpcodeToBitNumber(Opcode opcode) {
890 return 1ULL << (static_cast<uint32_t>(opcode) >> kOpcodeShift);
891 }
892
893
880 class Instruction { 894 class Instruction {
881 public: 895 public:
882 enum { 896 enum {
883 kInstrSize = 4, 897 kInstrSize = 4,
884 kInstrSizeLog2 = 2, 898 kInstrSizeLog2 = 2,
885 // On MIPS PC cannot actually be directly accessed. We behave as if PC was 899 // On MIPS PC cannot actually be directly accessed. We behave as if PC was
886 // always the value of the current instruction being executed. 900 // always the value of the current instruction being executed.
887 kPCReadOffset = 0 901 kPCReadOffset = 0
888 }; 902 };
889 903
890 // Get the raw instruction bits. 904 // Get the raw instruction bits.
891 inline Instr InstructionBits() const { 905 inline Instr InstructionBits() const {
892 return *reinterpret_cast<const Instr*>(this); 906 return *reinterpret_cast<const Instr*>(this);
893 } 907 }
894 908
895 // Set the raw instruction bits to value. 909 // Set the raw instruction bits to value.
896 inline void SetInstructionBits(Instr value) { 910 inline void SetInstructionBits(Instr value) {
897 *reinterpret_cast<Instr*>(this) = value; 911 *reinterpret_cast<Instr*>(this) = value;
898 } 912 }
899 913
900 // Read one particular bit out of the instruction bits. 914 // Read one particular bit out of the instruction bits.
901 inline int Bit(int nr) const { 915 inline int Bit(int nr) const {
902 return (InstructionBits() >> nr) & 1; 916 return (InstructionBits() >> nr) & 1;
903 } 917 }
904 918
905 // Read a bit field out of the instruction bits. 919 // Read a bit field out of the instruction bits.
906 inline int Bits(int hi, int lo) const { 920 inline int Bits(int hi, int lo) const {
907 return (InstructionBits() >> lo) & ((2 << (hi - lo)) - 1); 921 return (InstructionBits() >> lo) & ((2U << (hi - lo)) - 1);
908 } 922 }
909 923
910 // Instruction type. 924 // Instruction type.
911 enum Type { 925 enum Type {
912 kRegisterType, 926 kRegisterType,
913 kImmediateType, 927 kImmediateType,
914 kJumpType, 928 kJumpType,
915 kUnsupported = -1 929 kUnsupported = -1
916 }; 930 };
917 931
918 enum TypeChecks { NORMAL, EXTRA }; 932 enum TypeChecks { NORMAL, EXTRA };
919 933
920 934
921 #define OpcodeToBitNumber(opcode) \ 935 static constexpr uint64_t kOpcodeImmediateTypeMask =
922 (1ULL << (static_cast<uint32_t>(opcode) >> kOpcodeShift))
923
924 static const uint64_t kOpcodeImmediateTypeMask =
925 OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) | 936 OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) |
926 OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) | 937 OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) |
927 OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) | 938 OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) |
928 OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) | 939 OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) |
929 OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) | 940 OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) |
930 OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) | 941 OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) |
931 OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) | 942 OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) |
932 OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) | 943 OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) |
933 OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) | 944 OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) |
934 OpcodeToBitNumber(BGTZL) | OpcodeToBitNumber(POP66) | 945 OpcodeToBitNumber(BGTZL) | OpcodeToBitNumber(POP66) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 return FunctionValue(); 1115 return FunctionValue();
1105 case COP1: 1116 case COP1:
1106 return RsValue(); 1117 return RsValue();
1107 case REGIMM: 1118 case REGIMM:
1108 return RtValue(); 1119 return RtValue();
1109 default: 1120 default:
1110 return NULLSF; 1121 return NULLSF;
1111 } 1122 }
1112 } 1123 }
1113 1124
1125 inline int32_t ImmValue(int bits) const {
1126 DCHECK(InstructionType() == kImmediateType);
1127 return Bits(bits - 1, 0);
1128 }
1129
1114 inline int32_t Imm16Value() const { 1130 inline int32_t Imm16Value() const {
1115 DCHECK(InstructionType() == kImmediateType); 1131 DCHECK(InstructionType() == kImmediateType);
1116 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); 1132 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift);
1117 } 1133 }
1118 1134
1119 inline int32_t Imm18Value() const { 1135 inline int32_t Imm18Value() const {
1120 DCHECK(InstructionType() == kImmediateType); 1136 DCHECK(InstructionType() == kImmediateType);
1121 return Bits(kImm18Shift + kImm18Bits - 1, kImm18Shift); 1137 return Bits(kImm18Shift + kImm18Bits - 1, kImm18Shift);
1122 } 1138 }
1123 1139
1124 inline int32_t Imm19Value() const { 1140 inline int32_t Imm19Value() const {
1125 DCHECK(InstructionType() == kImmediateType); 1141 DCHECK(InstructionType() == kImmediateType);
1126 return Bits(kImm19Shift + kImm19Bits - 1, kImm19Shift); 1142 return Bits(kImm19Shift + kImm19Bits - 1, kImm19Shift);
1127 } 1143 }
1128 1144
1129 inline int32_t Imm21Value() const { 1145 inline int32_t Imm21Value() const {
1130 DCHECK(InstructionType() == kImmediateType); 1146 DCHECK(InstructionType() == kImmediateType);
1131 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift); 1147 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift);
1132 } 1148 }
1133 1149
1134 inline int32_t Imm26Value() const { 1150 inline int32_t Imm26Value() const {
1135 DCHECK((InstructionType() == kJumpType) || 1151 DCHECK((InstructionType() == kJumpType) ||
1136 (InstructionType() == kImmediateType)); 1152 (InstructionType() == kImmediateType));
1137 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); 1153 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift);
1138 } 1154 }
1139 1155
1140 // Say if the instruction should not be used in a branch delay slot. 1156 static bool IsForbiddenAfterBranchInstr(Instr instr);
1141 bool IsForbiddenInBranchDelay() const; 1157
1158 // Say if the instruction should not be used in a branch delay slot or
1159 // immediately after a compact branch.
1160 inline bool IsForbiddenAfterBranch() const {
1161 return IsForbiddenAfterBranchInstr(InstructionBits());
1162 }
1163
1142 // Say if the instruction 'links'. e.g. jal, bal. 1164 // Say if the instruction 'links'. e.g. jal, bal.
1143 bool IsLinkingInstruction() const; 1165 bool IsLinkingInstruction() const;
1144 // Say if the instruction is a break or a trap. 1166 // Say if the instruction is a break or a trap.
1145 bool IsTrap() const; 1167 bool IsTrap() const;
1146 1168
1147 // Instructions are read of out a code stream. The only way to get a 1169 // Instructions are read of out a code stream. The only way to get a
1148 // reference to an instruction is to convert a pointer. There is no way 1170 // reference to an instruction is to convert a pointer. There is no way
1149 // to allocate or create instances of class Instruction. 1171 // to allocate or create instances of class Instruction.
1150 // Use the At(pc) function to create references to Instruction. 1172 // Use the At(pc) function to create references to Instruction.
1151 static Instruction* At(byte* pc) { 1173 static Instruction* At(byte* pc) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 } 1296 }
1275 return kUnsupported; 1297 return kUnsupported;
1276 } 1298 }
1277 1299
1278 #undef OpcodeToBitNumber 1300 #undef OpcodeToBitNumber
1279 #undef FunctionFieldToBitNumber 1301 #undef FunctionFieldToBitNumber
1280 } // namespace internal 1302 } // namespace internal
1281 } // namespace v8 1303 } // namespace v8
1282 1304
1283 #endif // #ifndef V8_MIPS_CONSTANTS_H_ 1305 #endif // #ifndef V8_MIPS_CONSTANTS_H_
OLDNEW
« no previous file with comments | « src/mips64/assembler-mips64-inl.h ('k') | src/mips64/constants-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698