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/globals.h" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
11 #include "vm/runtime_entry.h" | 11 #include "vm/runtime_entry.h" |
12 #include "vm/simulator.h" | 12 #include "vm/simulator.h" |
13 #include "vm/stack_frame.h" | 13 #include "vm/stack_frame.h" |
14 #include "vm/stub_code.h" | 14 #include "vm/stub_code.h" |
15 | 15 |
16 // An extra check since we are assuming the existence of /proc/cpuinfo below. | 16 // An extra check since we are assuming the existence of /proc/cpuinfo below. |
17 #if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) | 17 #if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) |
18 #error ARM cross-compile only supported on Linux | 18 #error ARM cross-compile only supported on Linux |
19 #endif | 19 #endif |
20 | 20 |
21 namespace dart { | 21 namespace dart { |
22 | 22 |
23 DECLARE_FLAG(bool, allow_absolute_addresses); | 23 DECLARE_FLAG(bool, allow_absolute_addresses); |
24 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 24 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
25 DECLARE_FLAG(bool, inline_alloc); | 25 DECLARE_FLAG(bool, inline_alloc); |
26 | 26 |
27 // Instruction encoding bits. | |
28 enum { | |
29 H = 1 << 5, // halfword (or byte) | |
30 L = 1 << 20, // load (or store) | |
31 S = 1 << 20, // set condition code (or leave unchanged) | |
32 W = 1 << 21, // writeback base register (or leave unchanged) | |
33 A = 1 << 21, // accumulate in multiply instruction (or not) | |
34 B = 1 << 22, // unsigned byte (or word) | |
35 D = 1 << 22, // high/lo bit of start of s/d register range | |
36 N = 1 << 22, // long (or short) | |
37 U = 1 << 23, // positive (or negative) offset/index | |
38 P = 1 << 24, // offset/pre-indexed addressing (or post-indexed addressing) | |
39 I = 1 << 25, // immediate shifter operand (or not) | |
40 | |
41 B0 = 1, | |
42 B1 = 1 << 1, | |
43 B2 = 1 << 2, | |
44 B3 = 1 << 3, | |
45 B4 = 1 << 4, | |
46 B5 = 1 << 5, | |
47 B6 = 1 << 6, | |
48 B7 = 1 << 7, | |
49 B8 = 1 << 8, | |
50 B9 = 1 << 9, | |
51 B10 = 1 << 10, | |
52 B11 = 1 << 11, | |
53 B12 = 1 << 12, | |
54 B16 = 1 << 16, | |
55 B17 = 1 << 17, | |
56 B18 = 1 << 18, | |
57 B19 = 1 << 19, | |
58 B20 = 1 << 20, | |
59 B21 = 1 << 21, | |
60 B22 = 1 << 22, | |
61 B23 = 1 << 23, | |
62 B24 = 1 << 24, | |
63 B25 = 1 << 25, | |
64 B26 = 1 << 26, | |
65 B27 = 1 << 27, | |
66 }; | |
67 | |
68 | |
69 uint32_t Address::encoding3() const { | 27 uint32_t Address::encoding3() const { |
70 if (kind_ == Immediate) { | 28 if (kind_ == Immediate) { |
71 uint32_t offset = encoding_ & kOffset12Mask; | 29 uint32_t offset = encoding_ & kOffset12Mask; |
72 ASSERT(offset < 256); | 30 ASSERT(offset < 256); |
73 return (encoding_ & ~kOffset12Mask) | B22 | | 31 return (encoding_ & ~kOffset12Mask) | B22 | |
74 ((offset & 0xf0) << 4) | (offset & 0xf); | 32 ((offset & 0xf0) << 4) | (offset & 0xf); |
75 } | 33 } |
76 ASSERT(kind_ == IndexRegister); | 34 ASSERT(kind_ == IndexRegister); |
77 return encoding_; | 35 return encoding_; |
78 } | 36 } |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 EmitSIMDqqq(B24 | B9 | B8, sz, qd, qn, qm); | 1423 EmitSIMDqqq(B24 | B9 | B8, sz, qd, qn, qm); |
1466 } | 1424 } |
1467 | 1425 |
1468 | 1426 |
1469 void Assembler::vcgtqs(QRegister qd, QRegister qn, QRegister qm) { | 1427 void Assembler::vcgtqs(QRegister qd, QRegister qn, QRegister qm) { |
1470 EmitSIMDqqq(B24 | B21 | B11 | B10 | B9, kSWord, qd, qn, qm); | 1428 EmitSIMDqqq(B24 | B21 | B11 | B10 | B9, kSWord, qd, qn, qm); |
1471 } | 1429 } |
1472 | 1430 |
1473 | 1431 |
1474 void Assembler::bkpt(uint16_t imm16) { | 1432 void Assembler::bkpt(uint16_t imm16) { |
1475 // bkpt requires that the cond field is AL. | 1433 Emit(BkptEncoding(imm16)); |
1476 int32_t encoding = (AL << kConditionShift) | B24 | B21 | | |
1477 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); | |
1478 Emit(encoding); | |
1479 } | 1434 } |
1480 | 1435 |
1481 | 1436 |
1482 void Assembler::b(Label* label, Condition cond) { | 1437 void Assembler::b(Label* label, Condition cond) { |
1483 EmitBranch(cond, label, false); | 1438 EmitBranch(cond, label, false); |
1484 } | 1439 } |
1485 | 1440 |
1486 | 1441 |
1487 void Assembler::bl(Label* label, Condition cond) { | 1442 void Assembler::bl(Label* label, Condition cond) { |
1488 EmitBranch(cond, label, true); | 1443 EmitBranch(cond, label, true); |
(...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3685 | 3640 |
3686 | 3641 |
3687 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3642 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3688 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3643 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
3689 return fpu_reg_names[reg]; | 3644 return fpu_reg_names[reg]; |
3690 } | 3645 } |
3691 | 3646 |
3692 } // namespace dart | 3647 } // namespace dart |
3693 | 3648 |
3694 #endif // defined TARGET_ARCH_ARM | 3649 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |