| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/disassembler.h" | 5 #include "vm/disassembler.h" |
| 6 | 6 |
| 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 8 #if defined(TARGET_ARCH_MIPS) | 8 #if defined(TARGET_ARCH_MIPS) |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // the instruction. | 483 // the instruction. |
| 484 switch (instr->Cop1FunctionField()) { | 484 switch (instr->Cop1FunctionField()) { |
| 485 case COP1_ADD: { | 485 case COP1_ADD: { |
| 486 Format(instr, "add.'fmt 'fd, 'fs, 'ft"); | 486 Format(instr, "add.'fmt 'fd, 'fs, 'ft"); |
| 487 break; | 487 break; |
| 488 } | 488 } |
| 489 case COP1_MOV: { | 489 case COP1_MOV: { |
| 490 Format(instr, "mov.'fmt 'fd, 'fs"); | 490 Format(instr, "mov.'fmt 'fd, 'fs"); |
| 491 break; | 491 break; |
| 492 } | 492 } |
| 493 case COP1_C_F: { |
| 494 Format(instr, "c.f.'fmt 'fd, 'fs"); |
| 495 break; |
| 496 } |
| 497 case COP1_C_UN: { |
| 498 Format(instr, "c.un.'fmt 'fd, 'fs"); |
| 499 break; |
| 500 } |
| 501 case COP1_C_EQ: { |
| 502 Format(instr, "c.eq.'fmt 'fd, 'fs"); |
| 503 break; |
| 504 } |
| 505 case COP1_C_UEQ: { |
| 506 Format(instr, "c.ueq.'fmt 'fd, 'fs"); |
| 507 break; |
| 508 } |
| 509 case COP1_C_OLT: { |
| 510 Format(instr, "c.olt.'fmt 'fd, 'fs"); |
| 511 break; |
| 512 } |
| 513 case COP1_C_ULT: { |
| 514 Format(instr, "c.ult.'fmt 'fd, 'fs"); |
| 515 break; |
| 516 } |
| 517 case COP1_C_OLE: { |
| 518 Format(instr, "c.ole.'fmt 'fd, 'fs"); |
| 519 break; |
| 520 } |
| 521 case COP1_C_ULE: { |
| 522 Format(instr, "c.ule.'fmt 'fd, 'fs"); |
| 523 break; |
| 524 } |
| 493 default: { | 525 default: { |
| 494 Unknown(instr); | 526 Unknown(instr); |
| 495 break; | 527 break; |
| 496 } | 528 } |
| 497 } | 529 } |
| 498 } else { | 530 } else { |
| 499 // If the rs field isn't a valid format, then it must be a sub-opcode. | 531 // If the rs field isn't a valid format, then it must be a sub-opcode. |
| 500 switch (instr->Cop1SubField()) { | 532 switch (instr->Cop1SubField()) { |
| 501 case COP1_MF: { | 533 case COP1_MF: { |
| 502 if (instr->Bits(0, 11) != 0) { | 534 if (instr->Bits(0, 11) != 0) { |
| 503 Unknown(instr); | 535 Unknown(instr); |
| 504 } else { | 536 } else { |
| 505 Format(instr, "mfc1 'rt, 'fs"); | 537 Format(instr, "mfc1 'rt, 'fs"); |
| 506 } | 538 } |
| 507 break; | 539 break; |
| 508 } | 540 } |
| 509 case COP1_MT: { | 541 case COP1_MT: { |
| 510 if (instr->Bits(0, 11) != 0) { | 542 if (instr->Bits(0, 11) != 0) { |
| 511 Unknown(instr); | 543 Unknown(instr); |
| 512 } else { | 544 } else { |
| 513 Format(instr, "mtc1 'rt, 'fs"); | 545 Format(instr, "mtc1 'rt, 'fs"); |
| 514 } | 546 } |
| 515 break; | 547 break; |
| 516 } | 548 } |
| 549 case COP1_BC: { |
| 550 ASSERT(instr->Bit(17) == 0); |
| 551 if (instr->Bit(16) == 1) { // Branch on true. |
| 552 Format(instr, "bc1t 'dest"); |
| 553 } else { // Branch on false. |
| 554 Format(instr, "bc1f 'dest"); |
| 555 } |
| 556 break; |
| 557 } |
| 517 default: { | 558 default: { |
| 518 Unknown(instr); | 559 Unknown(instr); |
| 519 break; | 560 break; |
| 520 } | 561 } |
| 521 } | 562 } |
| 522 } | 563 } |
| 523 } | 564 } |
| 524 | 565 |
| 525 void MIPSDecoder::InstructionDecode(Instr* instr) { | 566 void MIPSDecoder::InstructionDecode(Instr* instr) { |
| 526 switch (instr->OpcodeField()) { | 567 switch (instr->OpcodeField()) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 pc); | 732 pc); |
| 692 pc += instruction_length; | 733 pc += instruction_length; |
| 693 } | 734 } |
| 694 | 735 |
| 695 return; | 736 return; |
| 696 } | 737 } |
| 697 | 738 |
| 698 } // namespace dart | 739 } // namespace dart |
| 699 | 740 |
| 700 #endif // defined TARGET_ARCH_MIPS | 741 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |