OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 // A Disassembler object is used to disassemble a block of code instruction by | 5 // A Disassembler object is used to disassemble a block of code instruction by |
6 // instruction. The default implementation of the NameConverter object can be | 6 // instruction. The default implementation of the NameConverter object can be |
7 // overriden to modify register names or to do symbol lookup on addresses. | 7 // overriden to modify register names or to do symbol lookup on addresses. |
8 // | 8 // |
9 // The example below will disassemble a block of code and print it to stdout. | 9 // The example below will disassemble a block of code and print it to stdout. |
10 // | 10 // |
(...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 (instr->Bit(4) == 1)) { | 2204 (instr->Bit(4) == 1)) { |
2205 // vmovl unsigned | 2205 // vmovl unsigned |
2206 if ((instr->VdValue() & 1) != 0) Unknown(instr); | 2206 if ((instr->VdValue() & 1) != 0) Unknown(instr); |
2207 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 2207 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
2208 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 2208 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
2209 int imm3 = instr->Bits(21, 19); | 2209 int imm3 = instr->Bits(21, 19); |
2210 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2210 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
2211 "vmovl.u%d q%d, d%d", imm3 * 8, Vd, Vm); | 2211 "vmovl.u%d q%d, d%d", imm3 * 8, Vd, Vm); |
2212 } else if (instr->Opc1Value() == 7 && instr->Bit(4) == 0) { | 2212 } else if (instr->Opc1Value() == 7 && instr->Bit(4) == 0) { |
2213 if (instr->Bits(11, 7) == 0x18) { | 2213 if (instr->Bits(11, 7) == 0x18) { |
2214 int Vd = instr->VFPDRegValue(kSimd128Precision); | |
2215 int Vm = instr->VFPMRegValue(kDoublePrecision); | 2214 int Vm = instr->VFPMRegValue(kDoublePrecision); |
2216 int index = instr->Bit(19); | 2215 int imm4 = instr->Bits(19, 16); |
2217 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2216 int size = 0, index = 0; |
2218 "vdup q%d, d%d[%d]", Vd, Vm, index); | 2217 if ((imm4 & 0x1) != 0) { |
| 2218 size = 8; |
| 2219 index = imm4 >> 1; |
| 2220 } else if ((imm4 & 0x2) != 0) { |
| 2221 size = 16; |
| 2222 index = imm4 >> 2; |
| 2223 } else { |
| 2224 size = 32; |
| 2225 index = imm4 >> 3; |
| 2226 } |
| 2227 if (instr->Bit(6) == 0) { |
| 2228 int Vd = instr->VFPDRegValue(kDoublePrecision); |
| 2229 out_buffer_pos_ += |
| 2230 SNPrintF(out_buffer_ + out_buffer_pos_, "vdup.%i d%d, d%d[%d]", |
| 2231 size, Vd, Vm, index); |
| 2232 } else { |
| 2233 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 2234 out_buffer_pos_ += |
| 2235 SNPrintF(out_buffer_ + out_buffer_pos_, "vdup.%i q%d, d%d[%d]", |
| 2236 size, Vd, Vm, index); |
| 2237 } |
2219 } else if (instr->Bits(11, 10) == 0x2) { | 2238 } else if (instr->Bits(11, 10) == 0x2) { |
2220 int Vd = instr->VFPDRegValue(kDoublePrecision); | 2239 int Vd = instr->VFPDRegValue(kDoublePrecision); |
2221 int Vn = instr->VFPNRegValue(kDoublePrecision); | 2240 int Vn = instr->VFPNRegValue(kDoublePrecision); |
2222 int Vm = instr->VFPMRegValue(kDoublePrecision); | 2241 int Vm = instr->VFPMRegValue(kDoublePrecision); |
2223 int len = instr->Bits(9, 8); | 2242 int len = instr->Bits(9, 8); |
2224 NeonListOperand list(DwVfpRegister::from_code(Vn), len + 1); | 2243 NeonListOperand list(DwVfpRegister::from_code(Vn), len + 1); |
2225 out_buffer_pos_ += | 2244 out_buffer_pos_ += |
2226 SNPrintF(out_buffer_ + out_buffer_pos_, "%s d%d, ", | 2245 SNPrintF(out_buffer_ + out_buffer_pos_, "%s d%d, ", |
2227 instr->Bit(6) == 0 ? "vtbl.8" : "vtbx.8", Vd); | 2246 instr->Bit(6) == 0 ? "vtbl.8" : "vtbx.8", Vd); |
2228 FormatNeonList(Vn, list.type()); | 2247 FormatNeonList(Vn, list.type()); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 } else if (instr->Bits(11, 7) == 0 && instr->Bit(4) == 1 && | 2358 } else if (instr->Bits(11, 7) == 0 && instr->Bit(4) == 1 && |
2340 instr->Bit(6) == 1) { | 2359 instr->Bit(6) == 1) { |
2341 // vshr.u<size> Qd, Qm, shift | 2360 // vshr.u<size> Qd, Qm, shift |
2342 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); | 2361 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); |
2343 int shift = 2 * size - instr->Bits(21, 16); | 2362 int shift = 2 * size - instr->Bits(21, 16); |
2344 int Vd = instr->VFPDRegValue(kSimd128Precision); | 2363 int Vd = instr->VFPDRegValue(kSimd128Precision); |
2345 int Vm = instr->VFPMRegValue(kSimd128Precision); | 2364 int Vm = instr->VFPMRegValue(kSimd128Precision); |
2346 out_buffer_pos_ += | 2365 out_buffer_pos_ += |
2347 SNPrintF(out_buffer_ + out_buffer_pos_, "vshr.u%d q%d, q%d, #%d", | 2366 SNPrintF(out_buffer_ + out_buffer_pos_, "vshr.u%d q%d, q%d, #%d", |
2348 size, Vd, Vm, shift); | 2367 size, Vd, Vm, shift); |
| 2368 } else if (instr->Bit(10) == 1 && instr->Bit(6) == 0 && |
| 2369 instr->Bit(4) == 1) { |
| 2370 // vsli.<size> Dd, Dm, shift |
| 2371 // vsri.<size> Dd, Dm, shift |
| 2372 int imm7 = instr->Bits(21, 16); |
| 2373 if (instr->Bit(7) != 0) imm7 += 64; |
| 2374 int size = base::bits::RoundDownToPowerOfTwo32(imm7); |
| 2375 int shift; |
| 2376 char direction; |
| 2377 if (instr->Bit(8) == 1) { |
| 2378 shift = imm7 - size; |
| 2379 direction = 'l'; // vsli |
| 2380 } else { |
| 2381 shift = 2 * size - imm7; |
| 2382 direction = 'r'; // vsri |
| 2383 } |
| 2384 int Vd = instr->VFPDRegValue(kDoublePrecision); |
| 2385 int Vm = instr->VFPMRegValue(kDoublePrecision); |
| 2386 out_buffer_pos_ += |
| 2387 SNPrintF(out_buffer_ + out_buffer_pos_, "vs%ci.%d d%d, d%d, #%d", |
| 2388 direction, size, Vd, Vm, shift); |
2349 } else { | 2389 } else { |
2350 Unknown(instr); | 2390 Unknown(instr); |
2351 } | 2391 } |
2352 break; | 2392 break; |
2353 case 8: | 2393 case 8: |
2354 if (instr->Bits(21, 20) == 0) { | 2394 if (instr->Bits(21, 20) == 0) { |
2355 // vst1 | 2395 // vst1 |
2356 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); | 2396 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); |
2357 int Rn = instr->VnValue(); | 2397 int Rn = instr->VnValue(); |
2358 int type = instr->Bits(11, 8); | 2398 int type = instr->Bits(11, 8); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 pc += d.InstructionDecode(buffer, pc); | 2724 pc += d.InstructionDecode(buffer, pc); |
2685 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), | 2725 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), |
2686 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 2726 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
2687 } | 2727 } |
2688 } | 2728 } |
2689 | 2729 |
2690 | 2730 |
2691 } // namespace disasm | 2731 } // namespace disasm |
2692 | 2732 |
2693 #endif // V8_TARGET_ARCH_ARM | 2733 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |