| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 RegList regs, Condition cond = AL); | 406 RegList regs, Condition cond = AL); |
| 407 | 407 |
| 408 void ldrex(Register rd, Register rn, Condition cond = AL); | 408 void ldrex(Register rd, Register rn, Condition cond = AL); |
| 409 void strex(Register rd, Register rt, Register rn, Condition cond = AL); | 409 void strex(Register rd, Register rt, Register rn, Condition cond = AL); |
| 410 | 410 |
| 411 // Miscellaneous instructions. | 411 // Miscellaneous instructions. |
| 412 void clrex(); | 412 void clrex(); |
| 413 void nop(Condition cond = AL); | 413 void nop(Condition cond = AL); |
| 414 | 414 |
| 415 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. | 415 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. |
| 416 void bkpt(uint16_t imm16); | 416 void bkpt(uint16_t imm16, Condition cond = AL); |
| 417 void svc(uint32_t imm24); | 417 void svc(uint32_t imm24, Condition cond = AL); |
| 418 | 418 |
| 419 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). | 419 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). |
| 420 void vmovsr(SRegister sn, Register rt, Condition cond = AL); | 420 void vmovsr(SRegister sn, Register rt, Condition cond = AL); |
| 421 void vmovrs(Register rt, SRegister sn, Condition cond = AL); | 421 void vmovrs(Register rt, SRegister sn, Condition cond = AL); |
| 422 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); | 422 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); |
| 423 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); | 423 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); |
| 424 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL); | 424 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL); |
| 425 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL); | 425 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL); |
| 426 void vmovs(SRegister sd, SRegister sm, Condition cond = AL); | 426 void vmovs(SRegister sd, SRegister sm, Condition cond = AL); |
| 427 void vmovd(DRegister dd, DRegister dm, Condition cond = AL); | 427 void vmovd(DRegister dd, DRegister dm, Condition cond = AL); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 void vcmps(SRegister sd, SRegister sm, Condition cond = AL); | 469 void vcmps(SRegister sd, SRegister sm, Condition cond = AL); |
| 470 void vcmpd(DRegister dd, DRegister dm, Condition cond = AL); | 470 void vcmpd(DRegister dd, DRegister dm, Condition cond = AL); |
| 471 void vcmpsz(SRegister sd, Condition cond = AL); | 471 void vcmpsz(SRegister sd, Condition cond = AL); |
| 472 void vcmpdz(DRegister dd, Condition cond = AL); | 472 void vcmpdz(DRegister dd, Condition cond = AL); |
| 473 void vmstat(Condition cond = AL); // VMRS APSR_nzcv, FPSCR | 473 void vmstat(Condition cond = AL); // VMRS APSR_nzcv, FPSCR |
| 474 | 474 |
| 475 // Branch instructions. | 475 // Branch instructions. |
| 476 void b(Label* label, Condition cond = AL); | 476 void b(Label* label, Condition cond = AL); |
| 477 void bl(Label* label, Condition cond = AL); | 477 void bl(Label* label, Condition cond = AL); |
| 478 void bx(Register rm, Condition cond = AL); |
| 478 void blx(Register rm, Condition cond = AL); | 479 void blx(Register rm, Condition cond = AL); |
| 479 | 480 |
| 480 // Macros. | 481 // Macros. |
| 481 // Branch to an entry address. Call sequence is never patched. | 482 // Branch to an entry address. Call sequence is never patched. |
| 482 void Branch(const ExternalLabel* label); | 483 void Branch(const ExternalLabel* label, Condition cond = AL); |
| 483 | 484 |
| 484 // Branch and link to an entry address. Call sequence is never patched. | 485 // Branch and link to an entry address. Call sequence is never patched. |
| 485 void BranchLink(const ExternalLabel* label); | 486 void BranchLink(const ExternalLabel* label); |
| 486 | 487 |
| 487 // Branch and link to an entry address. Call sequence can be patched. | 488 // Branch and link to an entry address. Call sequence can be patched. |
| 488 void BranchLinkPatchable(const ExternalLabel* label); | 489 void BranchLinkPatchable(const ExternalLabel* label); |
| 489 | 490 |
| 490 // Branch and link to entry after storing return address at ad. | 491 // Branch and link to entry after storing return address at ad. |
| 491 // Call sequence is never patched. | 492 // Call sequence is never patched. |
| 492 void BranchLinkStore(const ExternalLabel* label, Address ad); | 493 void BranchLinkStore(const ExternalLabel* label, Address ad); |
| 493 | 494 |
| 494 // Branch and link to [base + offset]. Call sequence is never patched. | 495 // Branch and link to [base + offset]. Call sequence is never patched. |
| 495 void BranchLinkOffset(Register base, int offset); | 496 void BranchLinkOffset(Register base, int offset); |
| 496 | 497 |
| 497 // Add signed constant value to rd. May clobber IP. | 498 // Add signed immediate value to rd. May clobber IP. |
| 498 void AddConstant(Register rd, int32_t value, Condition cond = AL); | 499 void AddImmediate(Register rd, int32_t value, Condition cond = AL); |
| 499 void AddConstant(Register rd, Register rn, int32_t value, | 500 void AddImmediate(Register rd, Register rn, int32_t value, |
| 500 Condition cond = AL); | 501 Condition cond = AL); |
| 501 void AddConstantSetFlags(Register rd, Register rn, int32_t value, | 502 void AddImmediateSetFlags(Register rd, Register rn, int32_t value, |
| 502 Condition cond = AL); | |
| 503 void AddConstantWithCarry(Register rd, Register rn, int32_t value, | |
| 504 Condition cond = AL); | 503 Condition cond = AL); |
| 504 void AddImmediateWithCarry(Register rd, Register rn, int32_t value, |
| 505 Condition cond = AL); |
| 506 |
| 507 // Compare rn with signed immediate value. May clobber IP. |
| 508 void CompareImmediate(Register rn, int32_t value, Condition cond = AL); |
| 505 | 509 |
| 506 // Load and Store. May clobber IP. | 510 // Load and Store. May clobber IP. |
| 507 void LoadImmediate(Register rd, int32_t value, Condition cond = AL); | 511 void LoadImmediate(Register rd, int32_t value, Condition cond = AL); |
| 508 void LoadSImmediate(SRegister sd, float value, Condition cond = AL); | 512 void LoadSImmediate(SRegister sd, float value, Condition cond = AL); |
| 509 void LoadDImmediate(DRegister dd, double value, | 513 void LoadDImmediate(DRegister dd, double value, |
| 510 Register scratch, Condition cond = AL); | 514 Register scratch, Condition cond = AL); |
| 511 void MarkExceptionHandler(Label* label); | 515 void MarkExceptionHandler(Label* label); |
| 512 void LoadObject(Register rd, const Object& object); | 516 void LoadObject(Register rd, const Object& object); |
| 513 void LoadFromOffset(LoadOperandType type, | 517 void LoadFromOffset(LoadOperandType type, |
| 514 Register reg, | 518 Register reg, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 void Mov(Register rd, Register rm, Condition cond = AL); | 550 void Mov(Register rd, Register rm, Condition cond = AL); |
| 547 | 551 |
| 548 // Convenience shift instructions. Use mov instruction with shifter operand | 552 // Convenience shift instructions. Use mov instruction with shifter operand |
| 549 // for variants setting the status flags or using a register shift count. | 553 // for variants setting the status flags or using a register shift count. |
| 550 void Lsl(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 554 void Lsl(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 551 void Lsr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 555 void Lsr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 552 void Asr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 556 void Asr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 553 void Ror(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 557 void Ror(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
| 554 void Rrx(Register rd, Register rm, Condition cond = AL); | 558 void Rrx(Register rd, Register rm, Condition cond = AL); |
| 555 | 559 |
| 560 void SmiTag(Register reg, Condition cond = AL) { |
| 561 Lsl(reg, reg, kSmiTagSize, cond); |
| 562 } |
| 563 |
| 564 void SmiUntag(Register reg, Condition cond = AL) { |
| 565 Asr(reg, reg, kSmiTagSize, cond); |
| 566 } |
| 567 |
| 568 // Function frame setup and tear down. |
| 569 void EnterFrame(RegList regs, intptr_t frame_space); |
| 570 void LeaveFrame(RegList regs); |
| 571 void Ret(); |
| 572 void ReserveAlignedFrameSpace(intptr_t frame_space); |
| 573 |
| 556 // Emit data (e.g encoded instruction or immediate) in instruction stream. | 574 // Emit data (e.g encoded instruction or immediate) in instruction stream. |
| 557 void Emit(int32_t value); | 575 void Emit(int32_t value); |
| 558 | 576 |
| 559 private: | 577 private: |
| 560 AssemblerBuffer buffer_; // Contains position independent code. | 578 AssemblerBuffer buffer_; // Contains position independent code. |
| 561 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 579 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| 562 int32_t prologue_offset_; | 580 int32_t prologue_offset_; |
| 563 | 581 |
| 564 int32_t AddObject(const Object& obj); | 582 int32_t AddObject(const Object& obj); |
| 565 int32_t AddExternalLabel(const ExternalLabel* label); | 583 int32_t AddExternalLabel(const ExternalLabel* label); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 return *reg1 - *reg2; | 678 return *reg1 - *reg2; |
| 661 } | 679 } |
| 662 | 680 |
| 663 DISALLOW_ALLOCATION(); | 681 DISALLOW_ALLOCATION(); |
| 664 DISALLOW_COPY_AND_ASSIGN(Assembler); | 682 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 665 }; | 683 }; |
| 666 | 684 |
| 667 } // namespace dart | 685 } // namespace dart |
| 668 | 686 |
| 669 #endif // VM_ASSEMBLER_ARM_H_ | 687 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |