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 #ifndef VM_ASSEMBLER_ARM_H_ | 5 #ifndef VM_ASSEMBLER_ARM_H_ |
6 #define VM_ASSEMBLER_ARM_H_ | 6 #define VM_ASSEMBLER_ARM_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_arm.h directly; use assembler.h instead. | 9 #error Do not include assembler_arm.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
11 | 11 |
12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
14 #include "vm/constants_arm.h" | 14 #include "vm/constants_arm.h" |
15 #include "vm/cpu.h" | 15 #include "vm/cpu.h" |
16 #include "vm/hash_map.h" | 16 #include "vm/hash_map.h" |
17 #include "vm/object.h" | 17 #include "vm/object.h" |
18 #include "vm/simulator.h" | 18 #include "vm/simulator.h" |
19 | 19 |
20 namespace dart { | 20 namespace dart { |
21 | 21 |
22 // Forward declarations. | 22 // Forward declarations. |
23 class RuntimeEntry; | 23 class RuntimeEntry; |
24 class StubEntry; | 24 class StubEntry; |
25 | 25 |
| 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 |
26 class Label : public ValueObject { | 69 class Label : public ValueObject { |
27 public: | 70 public: |
28 Label() : position_(0) { } | 71 Label() : position_(0) { } |
29 | 72 |
30 ~Label() { | 73 ~Label() { |
31 // Assert if label is being destroyed with unresolved branches pending. | 74 // Assert if label is being destroyed with unresolved branches pending. |
32 ASSERT(!IsLinked()); | 75 ASSERT(!IsLinked()); |
33 } | 76 } |
34 | 77 |
35 // Returns the position for bound and linked labels. Cannot be used | 78 // Returns the position for bound and linked labels. Cannot be used |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 void ldrex(Register rd, Register rn, Condition cond = AL); | 524 void ldrex(Register rd, Register rn, Condition cond = AL); |
482 void strex(Register rd, Register rt, Register rn, Condition cond = AL); | 525 void strex(Register rd, Register rt, Register rn, Condition cond = AL); |
483 | 526 |
484 // Miscellaneous instructions. | 527 // Miscellaneous instructions. |
485 void clrex(); | 528 void clrex(); |
486 void nop(Condition cond = AL); | 529 void nop(Condition cond = AL); |
487 | 530 |
488 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. | 531 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. |
489 void bkpt(uint16_t imm16); | 532 void bkpt(uint16_t imm16); |
490 | 533 |
| 534 static int32_t BkptEncoding(uint16_t imm16) { |
| 535 // bkpt requires that the cond field is AL. |
| 536 return (AL << kConditionShift) | B24 | B21 | |
| 537 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); |
| 538 } |
| 539 |
| 540 static uword GetBreakInstructionFiller() { |
| 541 return BkptEncoding(0); |
| 542 } |
| 543 |
491 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). | 544 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). |
492 void vmovsr(SRegister sn, Register rt, Condition cond = AL); | 545 void vmovsr(SRegister sn, Register rt, Condition cond = AL); |
493 void vmovrs(Register rt, SRegister sn, Condition cond = AL); | 546 void vmovrs(Register rt, SRegister sn, Condition cond = AL); |
494 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); | 547 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); |
495 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); | 548 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); |
496 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL); | 549 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL); |
497 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL); | 550 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL); |
498 void vmovdr(DRegister dd, int i, Register rt, Condition cond = AL); | 551 void vmovdr(DRegister dd, int i, Register rt, Condition cond = AL); |
499 void vmovs(SRegister sd, SRegister sm, Condition cond = AL); | 552 void vmovs(SRegister sd, SRegister sm, Condition cond = AL); |
500 void vmovd(DRegister dd, DRegister dm, Condition cond = AL); | 553 void vmovd(DRegister dd, DRegister dm, Condition cond = AL); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 Register new_value, | 1201 Register new_value, |
1149 FieldContent old_content); | 1202 FieldContent old_content); |
1150 | 1203 |
1151 DISALLOW_ALLOCATION(); | 1204 DISALLOW_ALLOCATION(); |
1152 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1205 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1153 }; | 1206 }; |
1154 | 1207 |
1155 } // namespace dart | 1208 } // namespace dart |
1156 | 1209 |
1157 #endif // VM_ASSEMBLER_ARM_H_ | 1210 #endif // VM_ASSEMBLER_ARM_H_ |
OLD | NEW |