| 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 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 RegList regs, Condition cond = AL); | 384 RegList regs, Condition cond = AL); |
| 385 | 385 |
| 386 void ldrex(Register rd, Register rn, Condition cond = AL); | 386 void ldrex(Register rd, Register rn, Condition cond = AL); |
| 387 void strex(Register rd, Register rt, Register rn, Condition cond = AL); | 387 void strex(Register rd, Register rt, Register rn, Condition cond = AL); |
| 388 | 388 |
| 389 // Miscellaneous instructions. | 389 // Miscellaneous instructions. |
| 390 void clrex(); | 390 void clrex(); |
| 391 void nop(Condition cond = AL); | 391 void nop(Condition cond = AL); |
| 392 | 392 |
| 393 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. | 393 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. |
| 394 void bkpt(uint16_t imm16); | 394 void bkpt(uint16_t imm16, Condition cond = AL); |
| 395 void svc(uint32_t imm24); | 395 void svc(uint32_t imm24, Condition cond = AL); |
| 396 | 396 |
| 397 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). | 397 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). |
| 398 void vmovsr(SRegister sn, Register rt, Condition cond = AL); | 398 void vmovsr(SRegister sn, Register rt, Condition cond = AL); |
| 399 void vmovrs(Register rt, SRegister sn, Condition cond = AL); | 399 void vmovrs(Register rt, SRegister sn, Condition cond = AL); |
| 400 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); | 400 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); |
| 401 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); | 401 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); |
| 402 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL); | 402 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL); |
| 403 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL); | 403 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL); |
| 404 void vmovs(SRegister sd, SRegister sm, Condition cond = AL); | 404 void vmovs(SRegister sd, SRegister sm, Condition cond = AL); |
| 405 void vmovd(DRegister dd, DRegister dm, Condition cond = AL); | 405 void vmovd(DRegister dd, DRegister dm, Condition cond = AL); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 void vcmps(SRegister sd, SRegister sm, Condition cond = AL); | 447 void vcmps(SRegister sd, SRegister sm, Condition cond = AL); |
| 448 void vcmpd(DRegister dd, DRegister dm, Condition cond = AL); | 448 void vcmpd(DRegister dd, DRegister dm, Condition cond = AL); |
| 449 void vcmpsz(SRegister sd, Condition cond = AL); | 449 void vcmpsz(SRegister sd, Condition cond = AL); |
| 450 void vcmpdz(DRegister dd, Condition cond = AL); | 450 void vcmpdz(DRegister dd, Condition cond = AL); |
| 451 void vmstat(Condition cond = AL); // VMRS APSR_nzcv, FPSCR | 451 void vmstat(Condition cond = AL); // VMRS APSR_nzcv, FPSCR |
| 452 | 452 |
| 453 // Branch instructions. | 453 // Branch instructions. |
| 454 void b(Label* label, Condition cond = AL); | 454 void b(Label* label, Condition cond = AL); |
| 455 void bl(Label* label, Condition cond = AL); | 455 void bl(Label* label, Condition cond = AL); |
| 456 void bx(Register rm, Condition cond = AL); |
| 456 void blx(Register rm, Condition cond = AL); | 457 void blx(Register rm, Condition cond = AL); |
| 457 | 458 |
| 458 // Macros. | 459 // Macros. |
| 459 // Branch to an entry address. Call sequence is never patched. | 460 // Branch to an entry address. Call sequence is never patched. |
| 460 void Branch(const ExternalLabel* label); | 461 void Branch(const ExternalLabel* label, Condition cond = AL); |
| 461 | 462 |
| 462 // Branch and link to an entry address. Call sequence is never patched. | 463 // Branch and link to an entry address. Call sequence is never patched. |
| 463 void BranchLink(const ExternalLabel* label); | 464 void BranchLink(const ExternalLabel* label); |
| 464 | 465 |
| 465 // Branch and link to an entry address. Call sequence can be patched. | 466 // Branch and link to an entry address. Call sequence can be patched. |
| 466 void BranchLinkPatchable(const ExternalLabel* label); | 467 void BranchLinkPatchable(const ExternalLabel* label); |
| 467 | 468 |
| 468 // Branch and link to entry after storing return address at ad. | 469 // Branch and link to entry after storing return address at ad. |
| 469 // Call sequence is never patched. | 470 // Call sequence is never patched. |
| 470 void BranchLinkStore(const ExternalLabel* label, Address ad); | 471 void BranchLinkStore(const ExternalLabel* label, Address ad); |
| 471 | 472 |
| 472 // Branch and link to [base + offset]. Call sequence is never patched. | 473 // Branch and link to [base + offset]. Call sequence is never patched. |
| 473 void BranchLinkOffset(Register base, int offset); | 474 void BranchLinkOffset(Register base, int offset); |
| 474 | 475 |
| 475 // Add signed constant value to rd. May clobber IP. | 476 // Add signed immediate value to rd. May clobber IP. |
| 476 void AddConstant(Register rd, int32_t value, Condition cond = AL); | 477 void AddImmediate(Register rd, int32_t value, Condition cond = AL); |
| 477 void AddConstant(Register rd, Register rn, int32_t value, | 478 void AddImmediate(Register rd, Register rn, int32_t value, |
| 478 Condition cond = AL); | 479 Condition cond = AL); |
| 479 void AddConstantSetFlags(Register rd, Register rn, int32_t value, | 480 void AddImmediateSetFlags(Register rd, Register rn, int32_t value, |
| 480 Condition cond = AL); | |
| 481 void AddConstantWithCarry(Register rd, Register rn, int32_t value, | |
| 482 Condition cond = AL); | 481 Condition cond = AL); |
| 482 void AddImmediateWithCarry(Register rd, Register rn, int32_t value, |
| 483 Condition cond = AL); |
| 484 |
| 485 // Compare rn with signed immediate value. May clobber IP. |
| 486 void CompareImmediate(Register rn, int32_t value, Condition cond = AL); |
| 483 | 487 |
| 484 // Load and Store. May clobber IP. | 488 // Load and Store. May clobber IP. |
| 485 void LoadImmediate(Register rd, int32_t value, Condition cond = AL); | 489 void LoadImmediate(Register rd, int32_t value, Condition cond = AL); |
| 486 void LoadSImmediate(SRegister sd, float value, Condition cond = AL); | 490 void LoadSImmediate(SRegister sd, float value, Condition cond = AL); |
| 487 void LoadDImmediate(DRegister dd, double value, | 491 void LoadDImmediate(DRegister dd, double value, |
| 488 Register scratch, Condition cond = AL); | 492 Register scratch, Condition cond = AL); |
| 489 void MarkExceptionHandler(Label* label); | 493 void MarkExceptionHandler(Label* label); |
| 490 void LoadObject(Register rd, const Object& object); | 494 void LoadObject(Register rd, const Object& object); |
| 491 void LoadFromOffset(LoadOperandType type, | 495 void LoadFromOffset(LoadOperandType type, |
| 492 Register reg, | 496 Register reg, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 void Mov(Register rd, Register rm, Condition cond = AL); | 528 void Mov(Register rd, Register rm, Condition cond = AL); |
| 525 | 529 |
| 526 // Convenience shift instructions. Use mov instruction with shifter operand | 530 // Convenience shift instructions. Use mov instruction with shifter operand |
| 527 // for variants setting the status flags or using a register shift count. | 531 // for variants setting the status flags or using a register shift count. |
| 528 void Lsl(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 532 void Lsl(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 529 void Lsr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 533 void Lsr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 530 void Asr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 534 void Asr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 531 void Ror(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 535 void Ror(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 532 void Rrx(Register rd, Register rm, Condition cond = AL); | 536 void Rrx(Register rd, Register rm, Condition cond = AL); |
| 533 | 537 |
| 538 void SmiTag(Register reg, Condition cond = AL) { |
| 539 Lsl(reg, reg, kSmiTagSize, cond); |
| 540 } |
| 541 |
| 542 void SmiUntag(Register reg, Condition cond = AL) { |
| 543 Asr(reg, reg, kSmiTagSize, cond); |
| 544 } |
| 545 |
| 546 // Function frame setup and tear down. |
| 547 void EnterFrame(RegList regs, intptr_t frame_space); |
| 548 void LeaveFrame(RegList regs); |
| 549 void Ret(); |
| 550 void ReserveAlignedFrameSpace(intptr_t frame_space); |
| 551 |
| 534 // Emit data (e.g encoded instruction or immediate) in instruction stream. | 552 // Emit data (e.g encoded instruction or immediate) in instruction stream. |
| 535 void Emit(int32_t value); | 553 void Emit(int32_t value); |
| 536 | 554 |
| 537 private: | 555 private: |
| 538 AssemblerBuffer buffer_; // Contains position independent code. | 556 AssemblerBuffer buffer_; // Contains position independent code. |
| 539 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 557 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| 540 int32_t prologue_offset_; | 558 int32_t prologue_offset_; |
| 541 | 559 |
| 542 int32_t AddObject(const Object& obj); | 560 int32_t AddObject(const Object& obj); |
| 543 int32_t AddExternalLabel(const ExternalLabel* label); | 561 int32_t AddExternalLabel(const ExternalLabel* label); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 return *reg1 - *reg2; | 656 return *reg1 - *reg2; |
| 639 } | 657 } |
| 640 | 658 |
| 641 DISALLOW_ALLOCATION(); | 659 DISALLOW_ALLOCATION(); |
| 642 DISALLOW_COPY_AND_ASSIGN(Assembler); | 660 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 643 }; | 661 }; |
| 644 | 662 |
| 645 } // namespace dart | 663 } // namespace dart |
| 646 | 664 |
| 647 #endif // VM_ASSEMBLER_ARM_H_ | 665 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |