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 // Modified by the Subzero authors. | 5 // Modified by the Subzero authors. |
6 // | 6 // |
7 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ----------------===// | 7 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ----------------===// |
8 // | 8 // |
9 // The Subzero Code Generator | 9 // The Subzero Code Generator |
10 // | 10 // |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 693 |
694 // Expose the buffer, for bringup... | 694 // Expose the buffer, for bringup... |
695 intptr_t GetPosition() const { return buffer_.GetPosition(); } | 695 intptr_t GetPosition() const { return buffer_.GetPosition(); } |
696 template <typename T> T LoadBuffer(intptr_t position) const { | 696 template <typename T> T LoadBuffer(intptr_t position) const { |
697 return buffer_.Load<T>(position); | 697 return buffer_.Load<T>(position); |
698 } | 698 } |
699 AssemblerFixup *GetLatestFixup() const { return buffer_.GetLatestFixup(); } | 699 AssemblerFixup *GetLatestFixup() const { return buffer_.GetLatestFixup(); } |
700 | 700 |
701 private: | 701 private: |
702 inline void EmitUint8(uint8_t value); | 702 inline void EmitUint8(uint8_t value); |
| 703 inline void EmitInt16(int16_t value); |
703 inline void EmitInt32(int32_t value); | 704 inline void EmitInt32(int32_t value); |
704 inline void EmitRegisterOperand(int rm, int reg); | 705 inline void EmitRegisterOperand(int rm, int reg); |
705 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); | 706 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); |
706 inline void EmitFixup(AssemblerFixup *fixup); | 707 inline void EmitFixup(AssemblerFixup *fixup); |
707 inline void EmitOperandSizeOverride(); | 708 inline void EmitOperandSizeOverride(); |
708 | 709 |
709 void EmitOperand(int rm, const Operand &operand); | 710 void EmitOperand(int rm, const Operand &operand); |
710 void EmitImmediate(const Immediate &imm); | 711 void EmitImmediate(Type ty, const Immediate &imm); |
711 void EmitComplexI8(int rm, const Operand &operand, | 712 void EmitComplexI8(int rm, const Operand &operand, |
712 const Immediate &immediate); | 713 const Immediate &immediate); |
713 void EmitComplex(int rm, const Operand &operand, const Immediate &immediate); | 714 void EmitComplex(Type Ty, int rm, const Operand &operand, |
| 715 const Immediate &immediate); |
714 void EmitLabel(Label *label, intptr_t instruction_size); | 716 void EmitLabel(Label *label, intptr_t instruction_size); |
715 void EmitLabelLink(Label *label); | 717 void EmitLabelLink(Label *label); |
716 void EmitNearLabelLink(Label *label); | 718 void EmitNearLabelLink(Label *label); |
717 | 719 |
718 void EmitGenericShift(int rm, GPRRegister reg, const Immediate &imm); | 720 void EmitGenericShift(int rm, GPRRegister reg, const Immediate &imm); |
719 void EmitGenericShift(int rm, const Operand &operand, GPRRegister shifter); | 721 void EmitGenericShift(int rm, const Operand &operand, GPRRegister shifter); |
720 | 722 |
721 AssemblerBuffer buffer_; | 723 AssemblerBuffer buffer_; |
722 | 724 |
723 AssemblerX86(const AssemblerX86 &) LLVM_DELETED_FUNCTION; | 725 AssemblerX86(const AssemblerX86 &) LLVM_DELETED_FUNCTION; |
724 AssemblerX86 &operator=(const AssemblerX86 &) LLVM_DELETED_FUNCTION; | 726 AssemblerX86 &operator=(const AssemblerX86 &) LLVM_DELETED_FUNCTION; |
725 }; | 727 }; |
726 | 728 |
727 inline void AssemblerX86::EmitUint8(uint8_t value) { | 729 inline void AssemblerX86::EmitUint8(uint8_t value) { |
728 buffer_.Emit<uint8_t>(value); | 730 buffer_.Emit<uint8_t>(value); |
729 } | 731 } |
730 | 732 |
| 733 inline void AssemblerX86::EmitInt16(int16_t value) { |
| 734 buffer_.Emit<int16_t>(value); |
| 735 } |
| 736 |
731 inline void AssemblerX86::EmitInt32(int32_t value) { | 737 inline void AssemblerX86::EmitInt32(int32_t value) { |
732 buffer_.Emit<int32_t>(value); | 738 buffer_.Emit<int32_t>(value); |
733 } | 739 } |
734 | 740 |
735 inline void AssemblerX86::EmitRegisterOperand(int rm, int reg) { | 741 inline void AssemblerX86::EmitRegisterOperand(int rm, int reg) { |
736 assert(rm >= 0 && rm < 8); | 742 assert(rm >= 0 && rm < 8); |
737 buffer_.Emit<uint8_t>(0xC0 + (rm << 3) + reg); | 743 buffer_.Emit<uint8_t>(0xC0 + (rm << 3) + reg); |
738 } | 744 } |
739 | 745 |
740 inline void AssemblerX86::EmitXmmRegisterOperand(int rm, XmmRegister reg) { | 746 inline void AssemblerX86::EmitXmmRegisterOperand(int rm, XmmRegister reg) { |
741 EmitRegisterOperand(rm, static_cast<GPRRegister>(reg)); | 747 EmitRegisterOperand(rm, static_cast<GPRRegister>(reg)); |
742 } | 748 } |
743 | 749 |
744 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { | 750 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { |
745 buffer_.EmitFixup(fixup); | 751 buffer_.EmitFixup(fixup); |
746 } | 752 } |
747 | 753 |
748 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } | 754 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } |
749 | 755 |
750 } // end of namespace x86 | 756 } // end of namespace x86 |
751 } // end of namespace Ice | 757 } // end of namespace Ice |
752 | 758 |
753 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ | 759 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ |
OLD | NEW |