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 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe | 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe |
6 // Please update the (git) revision if we merge changes from Dart. | 6 // Please update the (git) revision if we merge changes from Dart. |
7 // https://code.google.com/p/dart/wiki/GettingTheSource | 7 // https://code.google.com/p/dart/wiki/GettingTheSource |
8 | 8 |
9 #ifndef VM_ASSEMBLER_ARM_H_ | 9 #ifndef VM_ASSEMBLER_ARM_H_ |
10 #define VM_ASSEMBLER_ARM_H_ | 10 #define VM_ASSEMBLER_ARM_H_ |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 // Data-processing operands - Immediate. | 135 // Data-processing operands - Immediate. |
136 explicit Operand(uint32_t immediate) { | 136 explicit Operand(uint32_t immediate) { |
137 ASSERT(immediate < (1 << kImmed8Bits)); | 137 ASSERT(immediate < (1 << kImmed8Bits)); |
138 type_ = 1; | 138 type_ = 1; |
139 encoding_ = immediate; | 139 encoding_ = immediate; |
140 } | 140 } |
141 | 141 |
142 #if 0 | 142 #if 0 |
143 // Moved to decode in IceAssemblerARM32.cpp | 143 // Moved to decodeOperand() in IceAssemblerARM32.cpp |
144 // Data-processing operands - Rotated immediate. | 144 // Data-processing operands - Rotated immediate. |
145 Operand(uint32_t rotate, uint32_t immed8) { | 145 Operand(uint32_t rotate, uint32_t immed8) { |
146 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); | 146 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); |
147 type_ = 1; | 147 type_ = 1; |
148 encoding_ = (rotate << kRotateShift) | (immed8 << kImmed8Shift); | 148 encoding_ = (rotate << kRotateShift) | (immed8 << kImmed8Shift); |
149 } | 149 } |
150 #endif | 150 #endif |
151 | 151 |
152 #if 0 | 152 #if 0 |
153 // Moved to decode in IceAssemblerARM32.cpp | 153 // Moved to decodeOperand() in IceAssemblerARM32.cpp |
154 // Data-processing operands - Register. | 154 // Data-processing operands - Register. |
155 explicit Operand(Register rm) { | 155 explicit Operand(Register rm) { |
156 type_ = 0; | 156 type_ = 0; |
157 encoding_ = static_cast<uint32_t>(rm); | 157 encoding_ = static_cast<uint32_t>(rm); |
158 } | 158 } |
159 #endif | 159 #endif |
160 | 160 |
161 // Data-processing operands - Logical shift/rotate by immediate. | 161 // Data-processing operands - Logical shift/rotate by immediate. |
162 Operand(Register rm, Shift shift, uint32_t shift_imm) { | 162 Operand(Register rm, Shift shift, uint32_t shift_imm) { |
163 ASSERT(shift_imm < (1 << kShiftImmBits)); | 163 ASSERT(shift_imm < (1 << kShiftImmBits)); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 Address& operator=(const Address& other) { | 270 Address& operator=(const Address& other) { |
271 encoding_ = other.encoding_; | 271 encoding_ = other.encoding_; |
272 kind_ = other.kind_; | 272 kind_ = other.kind_; |
273 return *this; | 273 return *this; |
274 } | 274 } |
275 | 275 |
276 bool Equals(const Address& other) const { | 276 bool Equals(const Address& other) const { |
277 return (encoding_ == other.encoding_) && (kind_ == other.kind_); | 277 return (encoding_ == other.encoding_) && (kind_ == other.kind_); |
278 } | 278 } |
279 | 279 |
| 280 #if 0 |
| 281 // Moved to decodeImmRegOffset() in IceAssemblerARM32.cpp. |
| 282 // Used to model stack offsets. |
280 explicit Address(Register rn, int32_t offset = 0, Mode am = Offset) { | 283 explicit Address(Register rn, int32_t offset = 0, Mode am = Offset) { |
281 ASSERT(Utils::IsAbsoluteUint(12, offset)); | 284 ASSERT(Utils::IsAbsoluteUint(12, offset)); |
282 kind_ = Immediate; | 285 kind_ = Immediate; |
283 if (offset < 0) { | 286 if (offset < 0) { |
284 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign. | 287 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign. |
285 } else { | 288 } else { |
286 encoding_ = am | offset; | 289 encoding_ = am | offset; |
287 } | 290 } |
288 encoding_ |= static_cast<uint32_t>(rn) << kRnShift; | 291 encoding_ |= static_cast<uint32_t>(rn) << kRnShift; |
289 } | 292 } |
| 293 #endif |
290 | 294 |
291 // There is no register offset mode unless Mode is Offset, in which case the | 295 // There is no register offset mode unless Mode is Offset, in which case the |
292 // shifted register case below should be used. | 296 // shifted register case below should be used. |
293 Address(Register rn, Register r, Mode am); | 297 Address(Register rn, Register r, Mode am); |
294 | 298 |
295 Address(Register rn, Register rm, | 299 Address(Register rn, Register rm, |
296 Shift shift = LSL, uint32_t shift_imm = 0, Mode am = Offset) { | 300 Shift shift = LSL, uint32_t shift_imm = 0, Mode am = Offset) { |
297 Operand o(rm, shift, shift_imm); | 301 Operand o(rm, shift, shift_imm); |
298 | 302 |
299 if ((shift == LSL) && (shift_imm == 0)) { | 303 if ((shift == LSL) && (shift_imm == 0)) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 437 |
434 static const char* RegisterName(Register reg); | 438 static const char* RegisterName(Register reg); |
435 | 439 |
436 static const char* FpuRegisterName(FpuRegister reg); | 440 static const char* FpuRegisterName(FpuRegister reg); |
437 | 441 |
438 // Data-processing instructions. | 442 // Data-processing instructions. |
439 void and_(Register rd, Register rn, Operand o, Condition cond = AL); | 443 void and_(Register rd, Register rn, Operand o, Condition cond = AL); |
440 | 444 |
441 void eor(Register rd, Register rn, Operand o, Condition cond = AL); | 445 void eor(Register rd, Register rn, Operand o, Condition cond = AL); |
442 | 446 |
| 447 #if 0 |
| 448 // Moved to ARM32::AssemberARM32::sub() |
443 void sub(Register rd, Register rn, Operand o, Condition cond = AL); | 449 void sub(Register rd, Register rn, Operand o, Condition cond = AL); |
444 void subs(Register rd, Register rn, Operand o, Condition cond = AL); | 450 void subs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 451 #endif |
445 | 452 |
446 void rsb(Register rd, Register rn, Operand o, Condition cond = AL); | 453 void rsb(Register rd, Register rn, Operand o, Condition cond = AL); |
447 void rsbs(Register rd, Register rn, Operand o, Condition cond = AL); | 454 void rsbs(Register rd, Register rn, Operand o, Condition cond = AL); |
448 | 455 |
449 #if 0 | 456 #if 0 |
450 // Moved to IceAssemblerARM32::mov | 457 // Moved to ARM32::AssemblerARM32::add() |
451 void add(Register rd, Register rn, Operand o, Condition cond = AL); | 458 void add(Register rd, Register rn, Operand o, Condition cond = AL); |
452 | 459 |
453 void adds(Register rd, Register rn, Operand o, Condition cond = AL); | 460 void adds(Register rd, Register rn, Operand o, Condition cond = AL); |
454 #endif | 461 #endif |
455 | 462 |
456 void adc(Register rd, Register rn, Operand o, Condition cond = AL); | 463 void adc(Register rd, Register rn, Operand o, Condition cond = AL); |
457 | 464 |
458 void adcs(Register rd, Register rn, Operand o, Condition cond = AL); | 465 void adcs(Register rd, Register rn, Operand o, Condition cond = AL); |
459 | 466 |
460 void sbc(Register rd, Register rn, Operand o, Condition cond = AL); | 467 void sbc(Register rd, Register rn, Operand o, Condition cond = AL); |
461 | 468 |
462 void sbcs(Register rd, Register rn, Operand o, Condition cond = AL); | 469 void sbcs(Register rd, Register rn, Operand o, Condition cond = AL); |
463 | 470 |
464 void rsc(Register rd, Register rn, Operand o, Condition cond = AL); | 471 void rsc(Register rd, Register rn, Operand o, Condition cond = AL); |
465 | 472 |
466 void tst(Register rn, Operand o, Condition cond = AL); | 473 void tst(Register rn, Operand o, Condition cond = AL); |
467 | 474 |
468 void teq(Register rn, Operand o, Condition cond = AL); | 475 void teq(Register rn, Operand o, Condition cond = AL); |
469 | 476 |
470 void cmp(Register rn, Operand o, Condition cond = AL); | 477 void cmp(Register rn, Operand o, Condition cond = AL); |
471 | 478 |
472 void cmn(Register rn, Operand o, Condition cond = AL); | 479 void cmn(Register rn, Operand o, Condition cond = AL); |
473 | 480 |
474 void orr(Register rd, Register rn, Operand o, Condition cond = AL); | 481 void orr(Register rd, Register rn, Operand o, Condition cond = AL); |
475 void orrs(Register rd, Register rn, Operand o, Condition cond = AL); | 482 void orrs(Register rd, Register rn, Operand o, Condition cond = AL); |
476 | 483 |
477 #if 0 | 484 #if 0 |
478 // Moved to IceAssemblerARM32::mov | 485 // Moved to IceAssemblerARM32::mov() |
479 void mov(Register rd, Operand o, Condition cond = AL); | 486 void mov(Register rd, Operand o, Condition cond = AL); |
480 void movs(Register rd, Operand o, Condition cond = AL); | 487 void movs(Register rd, Operand o, Condition cond = AL); |
481 #endif | 488 #endif |
482 | 489 |
483 void bic(Register rd, Register rn, Operand o, Condition cond = AL); | 490 void bic(Register rd, Register rn, Operand o, Condition cond = AL); |
484 void bics(Register rd, Register rn, Operand o, Condition cond = AL); | 491 void bics(Register rd, Register rn, Operand o, Condition cond = AL); |
485 | 492 |
486 void mvn(Register rd, Operand o, Condition cond = AL); | 493 void mvn(Register rd, Operand o, Condition cond = AL); |
487 void mvns(Register rd, Operand o, Condition cond = AL); | 494 void mvns(Register rd, Operand o, Condition cond = AL); |
488 | 495 |
(...skipping 18 matching lines...) Expand all Loading... |
507 | 514 |
508 // Emulation of this instruction uses IP and the condition codes. Therefore, | 515 // Emulation of this instruction uses IP and the condition codes. Therefore, |
509 // none of the registers can be IP, and the instruction can only be used | 516 // none of the registers can be IP, and the instruction can only be used |
510 // unconditionally. | 517 // unconditionally. |
511 void umaal(Register rd_lo, Register rd_hi, Register rn, Register rm); | 518 void umaal(Register rd_lo, Register rd_hi, Register rn, Register rm); |
512 | 519 |
513 // Division instructions. | 520 // Division instructions. |
514 void sdiv(Register rd, Register rn, Register rm, Condition cond = AL); | 521 void sdiv(Register rd, Register rn, Register rm, Condition cond = AL); |
515 void udiv(Register rd, Register rn, Register rm, Condition cond = AL); | 522 void udiv(Register rd, Register rn, Register rm, Condition cond = AL); |
516 | 523 |
| 524 #if 0 |
| 525 // Moved to AssemblerARM32::ldr() |
517 // Load/store instructions. | 526 // Load/store instructions. |
518 void ldr(Register rd, Address ad, Condition cond = AL); | 527 void ldr(Register rd, Address ad, Condition cond = AL); |
| 528 // Moved to AssemblerARM32::str() |
519 void str(Register rd, Address ad, Condition cond = AL); | 529 void str(Register rd, Address ad, Condition cond = AL); |
520 | 530 |
| 531 // Moved to AssemblerARM32::ldr() |
521 void ldrb(Register rd, Address ad, Condition cond = AL); | 532 void ldrb(Register rd, Address ad, Condition cond = AL); |
| 533 // Moved to AssemblerARM32::str() |
522 void strb(Register rd, Address ad, Condition cond = AL); | 534 void strb(Register rd, Address ad, Condition cond = AL); |
| 535 #endif |
523 | 536 |
524 void ldrh(Register rd, Address ad, Condition cond = AL); | 537 void ldrh(Register rd, Address ad, Condition cond = AL); |
525 void strh(Register rd, Address ad, Condition cond = AL); | 538 void strh(Register rd, Address ad, Condition cond = AL); |
526 | 539 |
527 void ldrsb(Register rd, Address ad, Condition cond = AL); | 540 void ldrsb(Register rd, Address ad, Condition cond = AL); |
528 void ldrsh(Register rd, Address ad, Condition cond = AL); | 541 void ldrsh(Register rd, Address ad, Condition cond = AL); |
529 | 542 |
530 // ldrd and strd actually support the full range of addressing modes, but | 543 // ldrd and strd actually support the full range of addressing modes, but |
531 // we don't use them, and we need to split them up into two instructions for | 544 // we don't use them, and we need to split them up into two instructions for |
532 // ARMv5TE, so we only support the base + offset mode. | 545 // ARMv5TE, so we only support the base + offset mode. |
533 void ldrd(Register rd, Register rn, int32_t offset, Condition cond = AL); | 546 void ldrd(Register rd, Register rn, int32_t offset, Condition cond = AL); |
534 void strd(Register rd, Register rn, int32_t offset, Condition cond = AL); | 547 void strd(Register rd, Register rn, int32_t offset, Condition cond = AL); |
535 | 548 |
536 void ldm(BlockAddressMode am, Register base, | 549 void ldm(BlockAddressMode am, Register base, |
537 RegList regs, Condition cond = AL); | 550 RegList regs, Condition cond = AL); |
538 void stm(BlockAddressMode am, Register base, | 551 void stm(BlockAddressMode am, Register base, |
539 RegList regs, Condition cond = AL); | 552 RegList regs, Condition cond = AL); |
540 | 553 |
541 void ldrex(Register rd, Register rn, Condition cond = AL); | 554 void ldrex(Register rd, Register rn, Condition cond = AL); |
542 void strex(Register rd, Register rt, Register rn, Condition cond = AL); | 555 void strex(Register rd, Register rt, Register rn, Condition cond = AL); |
543 | 556 |
544 // Miscellaneous instructions. | 557 // Miscellaneous instructions. |
545 void clrex(); | 558 void clrex(); |
546 void nop(Condition cond = AL); | 559 void nop(Condition cond = AL); |
547 | 560 |
548 #if 0 | 561 #if 0 |
549 // Moved to: ARM32::AssemblerARM32. | 562 // Moved to: ARM32::AssemblerARM32::bkpt() |
550 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. | 563 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. |
551 void bkpt(uint16_t imm16); | 564 void bkpt(uint16_t imm16); |
552 | 565 |
553 static int32_t BkptEncoding(uint16_t imm16) { | 566 static int32_t BkptEncoding(uint16_t imm16) { |
554 // bkpt requires that the cond field is AL. | 567 // bkpt requires that the cond field is AL. |
555 return (AL << kConditionShift) | B24 | B21 | | 568 return (AL << kConditionShift) | B24 | B21 | |
556 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); | 569 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); |
557 } | 570 } |
558 #endif | 571 #endif |
559 | 572 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 void vtbl(DRegister dd, DRegister dn, int length, DRegister dm); | 683 void vtbl(DRegister dd, DRegister dn, int length, DRegister dm); |
671 | 684 |
672 // The words of qd and qm are interleaved with the low words of the result | 685 // The words of qd and qm are interleaved with the low words of the result |
673 // in qd and the high words in qm. | 686 // in qd and the high words in qm. |
674 void vzipqw(QRegister qd, QRegister qm); | 687 void vzipqw(QRegister qd, QRegister qm); |
675 | 688 |
676 // Branch instructions. | 689 // Branch instructions. |
677 void b(Label* label, Condition cond = AL); | 690 void b(Label* label, Condition cond = AL); |
678 void bl(Label* label, Condition cond = AL); | 691 void bl(Label* label, Condition cond = AL); |
679 #if 0 | 692 #if 0 |
680 // Moved to: ARM32::AssemblerARM32. | 693 // Moved to: ARM32::AssemblerARM32::bx() |
681 void bx(Register rm, Condition cond = AL); | 694 void bx(Register rm, Condition cond = AL); |
682 #endif | 695 #endif |
683 void blx(Register rm, Condition cond = AL); | 696 void blx(Register rm, Condition cond = AL); |
684 | 697 |
685 void Branch(const StubEntry& stub_entry, | 698 void Branch(const StubEntry& stub_entry, |
686 Patchability patchable = kNotPatchable, | 699 Patchability patchable = kNotPatchable, |
687 Register pp = PP, | 700 Register pp = PP, |
688 Condition cond = AL); | 701 Condition cond = AL); |
689 | 702 |
690 void BranchLink(const StubEntry& stub_entry, | 703 void BranchLink(const StubEntry& stub_entry, |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 | 1103 |
1091 bool constant_pool_allowed_; | 1104 bool constant_pool_allowed_; |
1092 | 1105 |
1093 void LoadObjectHelper(Register rd, | 1106 void LoadObjectHelper(Register rd, |
1094 const Object& object, | 1107 const Object& object, |
1095 Condition cond, | 1108 Condition cond, |
1096 bool is_unique, | 1109 bool is_unique, |
1097 Register pp); | 1110 Register pp); |
1098 | 1111 |
1099 #if 0 | 1112 #if 0 |
1100 // Moved to class AssemblerARM32. | 1113 // Moved to ARM32::AssemblerARM32::emitType01() |
1101 void EmitType01(Condition cond, | 1114 void EmitType01(Condition cond, |
1102 int type, | 1115 int type, |
1103 Opcode opcode, | 1116 Opcode opcode, |
1104 int set_cc, | 1117 int set_cc, |
1105 Register rn, | 1118 Register rn, |
1106 Register rd, | 1119 Register rd, |
1107 Operand o); | 1120 Operand o); |
1108 #endif | 1121 #endif |
1109 | 1122 |
1110 void EmitType5(Condition cond, int32_t offset, bool link); | 1123 void EmitType5(Condition cond, int32_t offset, bool link); |
1111 | 1124 |
| 1125 #if 0 |
| 1126 // Moved to ARM32::AssemberARM32::emitMemOp() |
1112 void EmitMemOp(Condition cond, | 1127 void EmitMemOp(Condition cond, |
1113 bool load, | 1128 bool load, |
1114 bool byte, | 1129 bool byte, |
1115 Register rd, | 1130 Register rd, |
1116 Address ad); | 1131 Address ad); |
| 1132 #endif |
1117 | 1133 |
1118 void EmitMemOpAddressMode3(Condition cond, | 1134 void EmitMemOpAddressMode3(Condition cond, |
1119 int32_t mode, | 1135 int32_t mode, |
1120 Register rd, | 1136 Register rd, |
1121 Address ad); | 1137 Address ad); |
1122 | 1138 |
1123 void EmitMultiMemOp(Condition cond, | 1139 void EmitMultiMemOp(Condition cond, |
1124 BlockAddressMode am, | 1140 BlockAddressMode am, |
1125 bool load, | 1141 bool load, |
1126 Register base, | 1142 Register base, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 Register new_value, | 1243 Register new_value, |
1228 FieldContent old_content); | 1244 FieldContent old_content); |
1229 | 1245 |
1230 DISALLOW_ALLOCATION(); | 1246 DISALLOW_ALLOCATION(); |
1231 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1247 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1232 }; | 1248 }; |
1233 | 1249 |
1234 } // namespace dart | 1250 } // namespace dart |
1235 | 1251 |
1236 #endif // VM_ASSEMBLER_ARM_H_ | 1252 #endif // VM_ASSEMBLER_ARM_H_ |
OLD | NEW |