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