OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_X64_H_ | 5 #ifndef VM_ASSEMBLER_X64_H_ |
6 #define VM_ASSEMBLER_X64_H_ | 6 #define VM_ASSEMBLER_X64_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_x64.h directly; use assembler.h instead. | 9 #error Do not include assembler_x64.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 GrowableArray<CodeComment*> comments_; | 669 GrowableArray<CodeComment*> comments_; |
670 | 670 |
671 inline void EmitUint8(uint8_t value); | 671 inline void EmitUint8(uint8_t value); |
672 inline void EmitInt32(int32_t value); | 672 inline void EmitInt32(int32_t value); |
673 inline void EmitInt64(int64_t value); | 673 inline void EmitInt64(int64_t value); |
674 | 674 |
675 inline void EmitRegisterREX(Register reg, uint8_t rex); | 675 inline void EmitRegisterREX(Register reg, uint8_t rex); |
676 inline void EmitRegisterOperand(int rm, int reg); | 676 inline void EmitRegisterOperand(int rm, int reg); |
677 inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex); | 677 inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex); |
678 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); | 678 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); |
| 679 inline void EmitXmmRegisterREX(XmmRegister reg, uint8_t rex); |
679 inline void EmitFixup(AssemblerFixup* fixup); | 680 inline void EmitFixup(AssemblerFixup* fixup); |
680 inline void EmitOperandSizeOverride(); | 681 inline void EmitOperandSizeOverride(); |
681 | 682 |
682 void EmitOperand(int rm, const Operand& operand); | 683 void EmitOperand(int rm, const Operand& operand); |
683 void EmitImmediate(const Immediate& imm); | 684 void EmitImmediate(const Immediate& imm); |
684 void EmitComplex(int rm, const Operand& operand, const Immediate& immediate); | 685 void EmitComplex(int rm, const Operand& operand, const Immediate& immediate); |
685 void EmitLabel(Label* label, int instruction_size); | 686 void EmitLabel(Label* label, int instruction_size); |
686 void EmitLabelLink(Label* label); | 687 void EmitLabelLink(Label* label); |
687 void EmitNearLabelLink(Label* label); | 688 void EmitNearLabelLink(Label* label); |
688 | 689 |
(...skipping 22 matching lines...) Expand all Loading... |
711 } | 712 } |
712 | 713 |
713 | 714 |
714 inline void Assembler::EmitRegisterREX(Register reg, uint8_t rex) { | 715 inline void Assembler::EmitRegisterREX(Register reg, uint8_t rex) { |
715 ASSERT(reg != kNoRegister); | 716 ASSERT(reg != kNoRegister); |
716 rex |= (reg > 7 ? REX_B : REX_NONE); | 717 rex |= (reg > 7 ? REX_B : REX_NONE); |
717 if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); | 718 if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); |
718 } | 719 } |
719 | 720 |
720 | 721 |
| 722 inline void Assembler::EmitXmmRegisterREX(XmmRegister reg, uint8_t rex) { |
| 723 ASSERT(reg != kNoXmmRegister); |
| 724 rex |= (reg > 7 ? REX_R : REX_NONE); |
| 725 if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); |
| 726 } |
| 727 |
| 728 |
721 inline void Assembler::EmitOperandREX(int rm, | 729 inline void Assembler::EmitOperandREX(int rm, |
722 const Operand& operand, | 730 const Operand& operand, |
723 uint8_t rex) { | 731 uint8_t rex) { |
724 rex |= (rm > 7 ? REX_R : REX_NONE) | operand.rex(); | 732 rex |= (rm > 7 ? REX_R : REX_NONE) | operand.rex(); |
725 if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); | 733 if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); |
726 } | 734 } |
727 | 735 |
728 | 736 |
729 inline void Assembler::EmitFixup(AssemblerFixup* fixup) { | 737 inline void Assembler::EmitFixup(AssemblerFixup* fixup) { |
730 buffer_.EmitFixup(fixup); | 738 buffer_.EmitFixup(fixup); |
731 } | 739 } |
732 | 740 |
733 | 741 |
734 inline void Assembler::EmitOperandSizeOverride() { | 742 inline void Assembler::EmitOperandSizeOverride() { |
735 EmitUint8(0x66); | 743 EmitUint8(0x66); |
736 } | 744 } |
737 | 745 |
738 } // namespace dart | 746 } // namespace dart |
739 | 747 |
740 #endif // VM_ASSEMBLER_X64_H_ | 748 #endif // VM_ASSEMBLER_X64_H_ |
OLD | NEW |