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

Side by Side Diff: src/arm/disasm-arm.cc

Issue 148153010: Synchronize with r15701. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/arm/full-codegen-arm.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int FormatVFPinstruction(Instruction* instr, const char* format); 106 int FormatVFPinstruction(Instruction* instr, const char* format);
107 void PrintCondition(Instruction* instr); 107 void PrintCondition(Instruction* instr);
108 void PrintShiftRm(Instruction* instr); 108 void PrintShiftRm(Instruction* instr);
109 void PrintShiftImm(Instruction* instr); 109 void PrintShiftImm(Instruction* instr);
110 void PrintShiftSat(Instruction* instr); 110 void PrintShiftSat(Instruction* instr);
111 void PrintPU(Instruction* instr); 111 void PrintPU(Instruction* instr);
112 void PrintSoftwareInterrupt(SoftwareInterruptCodes svc); 112 void PrintSoftwareInterrupt(SoftwareInterruptCodes svc);
113 113
114 // Handle formatting of instructions and their options. 114 // Handle formatting of instructions and their options.
115 int FormatRegister(Instruction* instr, const char* option); 115 int FormatRegister(Instruction* instr, const char* option);
116 void FormatNeonList(int Vd, int type);
117 void FormatNeonMemory(int Rn, int align, int Rm);
116 int FormatOption(Instruction* instr, const char* option); 118 int FormatOption(Instruction* instr, const char* option);
117 void Format(Instruction* instr, const char* format); 119 void Format(Instruction* instr, const char* format);
118 void Unknown(Instruction* instr); 120 void Unknown(Instruction* instr);
119 121
120 // Each of these functions decodes one particular instruction type, a 3-bit 122 // Each of these functions decodes one particular instruction type, a 3-bit
121 // field in the instruction encoding. 123 // field in the instruction encoding.
122 // Types 0 and 1 are combined as they are largely the same except for the way 124 // Types 0 and 1 are combined as they are largely the same except for the way
123 // they interpret the shifter operand. 125 // they interpret the shifter operand.
124 void DecodeType01(Instruction* instr); 126 void DecodeType01(Instruction* instr);
125 void DecodeType2(Instruction* instr); 127 void DecodeType2(Instruction* instr);
126 void DecodeType3(Instruction* instr); 128 void DecodeType3(Instruction* instr);
127 void DecodeType4(Instruction* instr); 129 void DecodeType4(Instruction* instr);
128 void DecodeType5(Instruction* instr); 130 void DecodeType5(Instruction* instr);
129 void DecodeType6(Instruction* instr); 131 void DecodeType6(Instruction* instr);
130 // Type 7 includes special Debugger instructions. 132 // Type 7 includes special Debugger instructions.
131 int DecodeType7(Instruction* instr); 133 int DecodeType7(Instruction* instr);
132 // For VFP support. 134 // For VFP support.
133 void DecodeTypeVFP(Instruction* instr); 135 void DecodeTypeVFP(Instruction* instr);
134 void DecodeType6CoprocessorIns(Instruction* instr); 136 void DecodeType6CoprocessorIns(Instruction* instr);
135 137
138 void DecodeSpecialCondition(Instruction* instr);
139
136 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr); 140 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr);
137 void DecodeVCMP(Instruction* instr); 141 void DecodeVCMP(Instruction* instr);
138 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr); 142 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr);
139 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr); 143 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr);
140 144
141 const disasm::NameConverter& converter_; 145 const disasm::NameConverter& converter_;
142 Vector<char> out_buffer_; 146 Vector<char> out_buffer_;
143 int out_buffer_pos_; 147 int out_buffer_pos_;
144 148
145 DISALLOW_COPY_AND_ASSIGN(Decoder); 149 DISALLOW_COPY_AND_ASSIGN(Decoder);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 return retval; 416 return retval;
413 } 417 }
414 418
415 419
416 int Decoder::FormatVFPinstruction(Instruction* instr, const char* format) { 420 int Decoder::FormatVFPinstruction(Instruction* instr, const char* format) {
417 Print(format); 421 Print(format);
418 return 0; 422 return 0;
419 } 423 }
420 424
421 425
426 void Decoder::FormatNeonList(int Vd, int type) {
427 if (type == nlt_1) {
428 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
429 "{d%d}", Vd);
430 } else if (type == nlt_2) {
431 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
432 "{d%d, d%d}", Vd, Vd + 1);
433 } else if (type == nlt_3) {
434 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
435 "{d%d, d%d, d%d}", Vd, Vd + 1, Vd + 2);
436 } else if (type == nlt_4) {
437 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
438 "{d%d, d%d, d%d, d%d}", Vd, Vd + 1, Vd + 2, Vd + 3);
439 }
440 }
441
442
443 void Decoder::FormatNeonMemory(int Rn, int align, int Rm) {
444 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
445 "[r%d", Rn);
446 if (align != 0) {
447 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
448 ":%d", (1 << align) << 6);
449 }
450 if (Rm == 15) {
451 Print("]");
452 } else if (Rm == 13) {
453 Print("]!");
454 } else {
455 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
456 "], r%d", Rm);
457 }
458 }
459
460
422 // Print the movw or movt instruction. 461 // Print the movw or movt instruction.
423 void Decoder::PrintMovwMovt(Instruction* instr) { 462 void Decoder::PrintMovwMovt(Instruction* instr) {
424 int imm = instr->ImmedMovwMovtValue(); 463 int imm = instr->ImmedMovwMovtValue();
425 int rd = instr->RdValue(); 464 int rd = instr->RdValue();
426 PrintRegister(rd); 465 PrintRegister(rd);
427 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, 466 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
428 ", #%d", imm); 467 ", #%d", imm);
429 } 468 }
430 469
431 470
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 1014
976 1015
977 void Decoder::DecodeType3(Instruction* instr) { 1016 void Decoder::DecodeType3(Instruction* instr) {
978 switch (instr->PUField()) { 1017 switch (instr->PUField()) {
979 case da_x: { 1018 case da_x: {
980 VERIFY(!instr->HasW()); 1019 VERIFY(!instr->HasW());
981 Format(instr, "'memop'cond'b 'rd, ['rn], -'shift_rm"); 1020 Format(instr, "'memop'cond'b 'rd, ['rn], -'shift_rm");
982 break; 1021 break;
983 } 1022 }
984 case ia_x: { 1023 case ia_x: {
985 if (instr->HasW()) { 1024 if (instr->Bit(4) == 0) {
986 VERIFY(instr->Bits(5, 4) == 0x1); 1025 Format(instr, "'memop'cond'b 'rd, ['rn], +'shift_rm");
987 if (instr->Bit(22) == 0x1) { 1026 } else {
988 Format(instr, "usat 'rd, #'imm05@16, 'rm'shift_sat"); 1027 if (instr->Bit(5) == 0) {
1028 switch (instr->Bits(22, 21)) {
1029 case 0:
1030 if (instr->Bit(20) == 0) {
1031 if (instr->Bit(6) == 0) {
1032 Format(instr, "pkhbt'cond 'rd, 'rn, 'rm, lsl #'imm05@07");
1033 } else {
1034 if (instr->Bits(11, 7) == 0) {
1035 Format(instr, "pkhtb'cond 'rd, 'rn, 'rm, asr #32");
1036 } else {
1037 Format(instr, "pkhtb'cond 'rd, 'rn, 'rm, asr #'imm05@07");
1038 }
1039 }
1040 } else {
1041 UNREACHABLE();
1042 }
1043 break;
1044 case 1:
1045 UNREACHABLE();
1046 break;
1047 case 2:
1048 UNREACHABLE();
1049 break;
1050 case 3:
1051 Format(instr, "usat 'rd, #'imm05@16, 'rm'shift_sat");
1052 break;
1053 }
989 } else { 1054 } else {
990 UNREACHABLE(); // SSAT. 1055 switch (instr->Bits(22, 21)) {
1056 case 0:
1057 UNREACHABLE();
1058 break;
1059 case 1:
1060 UNREACHABLE();
1061 break;
1062 case 2:
1063 if ((instr->Bit(20) == 0) && (instr->Bits(9, 6) == 1)) {
1064 if (instr->Bits(19, 16) == 0xF) {
1065 switch (instr->Bits(11, 10)) {
1066 case 0:
1067 Format(instr, "uxtb16'cond 'rd, 'rm, ror #0");
1068 break;
1069 case 1:
1070 Format(instr, "uxtb16'cond 'rd, 'rm, ror #8");
1071 break;
1072 case 2:
1073 Format(instr, "uxtb16'cond 'rd, 'rm, ror #16");
1074 break;
1075 case 3:
1076 Format(instr, "uxtb16'cond 'rd, 'rm, ror #24");
1077 break;
1078 }
1079 } else {
1080 UNREACHABLE();
1081 }
1082 } else {
1083 UNREACHABLE();
1084 }
1085 break;
1086 case 3:
1087 if ((instr->Bit(20) == 0) && (instr->Bits(9, 6) == 1)) {
1088 if (instr->Bits(19, 16) == 0xF) {
1089 switch (instr->Bits(11, 10)) {
1090 case 0:
1091 Format(instr, "uxtb'cond 'rd, 'rm, ror #0");
1092 break;
1093 case 1:
1094 Format(instr, "uxtb'cond 'rd, 'rm, ror #8");
1095 break;
1096 case 2:
1097 Format(instr, "uxtb'cond 'rd, 'rm, ror #16");
1098 break;
1099 case 3:
1100 Format(instr, "uxtb'cond 'rd, 'rm, ror #24");
1101 break;
1102 }
1103 } else {
1104 switch (instr->Bits(11, 10)) {
1105 case 0:
1106 Format(instr, "uxtab'cond 'rd, 'rn, 'rm, ror #0");
1107 break;
1108 case 1:
1109 Format(instr, "uxtab'cond 'rd, 'rn, 'rm, ror #8");
1110 break;
1111 case 2:
1112 Format(instr, "uxtab'cond 'rd, 'rn, 'rm, ror #16");
1113 break;
1114 case 3:
1115 Format(instr, "uxtab'cond 'rd, 'rn, 'rm, ror #24");
1116 break;
1117 }
1118 }
1119 } else {
1120 UNREACHABLE();
1121 }
1122 break;
1123 }
991 } 1124 }
992 } else {
993 Format(instr, "'memop'cond'b 'rd, ['rn], +'shift_rm");
994 } 1125 }
995 break; 1126 break;
996 } 1127 }
997 case db_x: { 1128 case db_x: {
998 if (FLAG_enable_sudiv) { 1129 if (FLAG_enable_sudiv) {
999 if (!instr->HasW()) { 1130 if (!instr->HasW()) {
1000 if (instr->Bits(5, 4) == 0x1) { 1131 if (instr->Bits(5, 4) == 0x1) {
1001 if ((instr->Bit(22) == 0x0) && (instr->Bit(20) == 0x1)) { 1132 if ((instr->Bit(22) == 0x0) && (instr->Bit(20) == 0x1)) {
1002 // SDIV (in V8 notation matching ARM ISA format) rn = rm/rs 1133 // SDIV (in V8 notation matching ARM ISA format) rn = rm/rs
1003 Format(instr, "sdiv'cond'b 'rn, 'rm, 'rs"); 1134 Format(instr, "sdiv'cond'b 'rn, 'rm, 'rs");
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 break; 1547 break;
1417 } 1548 }
1418 default: 1549 default:
1419 Unknown(instr); // Not used by V8. 1550 Unknown(instr); // Not used by V8.
1420 } 1551 }
1421 } else { 1552 } else {
1422 Unknown(instr); // Not used by V8. 1553 Unknown(instr); // Not used by V8.
1423 } 1554 }
1424 } 1555 }
1425 1556
1557
1558 void Decoder::DecodeSpecialCondition(Instruction* instr) {
1559 switch (instr->SpecialValue()) {
1560 case 5:
1561 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) &&
1562 (instr->Bit(4) == 1)) {
1563 // vmovl signed
1564 int Vd = (instr->Bit(22) << 4) | instr->VdValue();
1565 int Vm = (instr->Bit(5) << 4) | instr->VmValue();
1566 int imm3 = instr->Bits(21, 19);
1567 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1568 "vmovl.s%d q%d, d%d", imm3*8, Vd, Vm);
1569 } else {
1570 Unknown(instr);
1571 }
1572 break;
1573 case 7:
1574 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) &&
1575 (instr->Bit(4) == 1)) {
1576 // vmovl unsigned
1577 int Vd = (instr->Bit(22) << 4) | instr->VdValue();
1578 int Vm = (instr->Bit(5) << 4) | instr->VmValue();
1579 int imm3 = instr->Bits(21, 19);
1580 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1581 "vmovl.u%d q%d, d%d", imm3*8, Vd, Vm);
1582 } else {
1583 Unknown(instr);
1584 }
1585 break;
1586 case 8:
1587 if (instr->Bits(21, 20) == 0) {
1588 // vst1
1589 int Vd = (instr->Bit(22) << 4) | instr->VdValue();
1590 int Rn = instr->VnValue();
1591 int type = instr->Bits(11, 8);
1592 int size = instr->Bits(7, 6);
1593 int align = instr->Bits(5, 4);
1594 int Rm = instr->VmValue();
1595 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1596 "vst1.%d ", (1 << size) << 3);
1597 FormatNeonList(Vd, type);
1598 Print(", ");
1599 FormatNeonMemory(Rn, align, Rm);
1600 } else if (instr->Bits(21, 20) == 2) {
1601 // vld1
1602 int Vd = (instr->Bit(22) << 4) | instr->VdValue();
1603 int Rn = instr->VnValue();
1604 int type = instr->Bits(11, 8);
1605 int size = instr->Bits(7, 6);
1606 int align = instr->Bits(5, 4);
1607 int Rm = instr->VmValue();
1608 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1609 "vld1.%d ", (1 << size) << 3);
1610 FormatNeonList(Vd, type);
1611 Print(", ");
1612 FormatNeonMemory(Rn, align, Rm);
1613 } else {
1614 Unknown(instr);
1615 }
1616 break;
1617 case 0xA:
1618 case 0xB:
1619 if ((instr->Bits(22, 20) == 5) && (instr->Bits(15, 12) == 0xf)) {
1620 int Rn = instr->Bits(19, 16);
1621 int offset = instr->Bits(11, 0);
1622 if (offset == 0) {
1623 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1624 "pld [r%d]", Rn);
1625 } else if (instr->Bit(23) == 0) {
1626 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1627 "pld [r%d, #-%d]", Rn, offset);
1628 } else {
1629 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1630 "pld [r%d, #+%d]", Rn, offset);
1631 }
1632 } else {
1633 Unknown(instr);
1634 }
1635 break;
1636 default:
1637 Unknown(instr);
1638 break;
1639 }
1640 }
1641
1426 #undef VERIFIY 1642 #undef VERIFIY
1427 1643
1428 bool Decoder::IsConstantPoolAt(byte* instr_ptr) { 1644 bool Decoder::IsConstantPoolAt(byte* instr_ptr) {
1429 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); 1645 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr));
1430 return (instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker; 1646 return (instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker;
1431 } 1647 }
1432 1648
1433 1649
1434 int Decoder::ConstantPoolSizeAt(byte* instr_ptr) { 1650 int Decoder::ConstantPoolSizeAt(byte* instr_ptr) {
1435 if (IsConstantPoolAt(instr_ptr)) { 1651 if (IsConstantPoolAt(instr_ptr)) {
1436 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); 1652 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr));
1437 return DecodeConstantPoolLength(instruction_bits); 1653 return DecodeConstantPoolLength(instruction_bits);
1438 } else { 1654 } else {
1439 return -1; 1655 return -1;
1440 } 1656 }
1441 } 1657 }
1442 1658
1443 1659
1444 // Disassemble the instruction at *instr_ptr into the output buffer. 1660 // Disassemble the instruction at *instr_ptr into the output buffer.
1445 int Decoder::InstructionDecode(byte* instr_ptr) { 1661 int Decoder::InstructionDecode(byte* instr_ptr) {
1446 Instruction* instr = Instruction::At(instr_ptr); 1662 Instruction* instr = Instruction::At(instr_ptr);
1447 // Print raw instruction bytes. 1663 // Print raw instruction bytes.
1448 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, 1664 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1449 "%08x ", 1665 "%08x ",
1450 instr->InstructionBits()); 1666 instr->InstructionBits());
1451 if (instr->ConditionField() == kSpecialCondition) { 1667 if (instr->ConditionField() == kSpecialCondition) {
1452 Unknown(instr); 1668 DecodeSpecialCondition(instr);
1453 return Instruction::kInstrSize; 1669 return Instruction::kInstrSize;
1454 } 1670 }
1455 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); 1671 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr));
1456 if ((instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker) { 1672 if ((instruction_bits & kConstantPoolMarkerMask) == kConstantPoolMarker) {
1457 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, 1673 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1458 "constant pool begin (length %d)", 1674 "constant pool begin (length %d)",
1459 DecodeConstantPoolLength(instruction_bits)); 1675 DecodeConstantPoolLength(instruction_bits));
1460 return Instruction::kInstrSize; 1676 return Instruction::kInstrSize;
1461 } 1677 }
1462 switch (instr->TypeValue()) { 1678 switch (instr->TypeValue()) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 v8::internal::PrintF( 1790 v8::internal::PrintF(
1575 f, "%p %08x %s\n", 1791 f, "%p %08x %s\n",
1576 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 1792 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1577 } 1793 }
1578 } 1794 }
1579 1795
1580 1796
1581 } // namespace disasm 1797 } // namespace disasm
1582 1798
1583 #endif // V8_TARGET_ARCH_ARM 1799 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698