OLD | NEW |
1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===// | 1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===// |
2 // | 2 // |
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
4 // for details. All rights reserved. Use of this source code is governed by a | 4 // for details. All rights reserved. Use of this source code is governed by a |
5 // BSD-style license that can be found in the LICENSE file. | 5 // BSD-style license that can be found in the LICENSE file. |
6 // | 6 // |
7 // Modified by the Subzero authors. | 7 // Modified by the Subzero authors. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 // | 10 // |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 void cmp(Type Ty, const Address &address, const Immediate &imm); | 701 void cmp(Type Ty, const Address &address, const Immediate &imm); |
702 | 702 |
703 void test(Type Ty, GPRRegister reg0, GPRRegister reg1); | 703 void test(Type Ty, GPRRegister reg0, GPRRegister reg1); |
704 void test(Type Ty, GPRRegister reg, const Immediate &imm); | 704 void test(Type Ty, GPRRegister reg, const Immediate &imm); |
705 void test(Type Ty, const Address &address, GPRRegister reg); | 705 void test(Type Ty, const Address &address, GPRRegister reg); |
706 void test(Type Ty, const Address &address, const Immediate &imm); | 706 void test(Type Ty, const Address &address, const Immediate &imm); |
707 | 707 |
708 void And(Type Ty, GPRRegister dst, GPRRegister src); | 708 void And(Type Ty, GPRRegister dst, GPRRegister src); |
709 void And(Type Ty, GPRRegister dst, const Address &address); | 709 void And(Type Ty, GPRRegister dst, const Address &address); |
710 void And(Type Ty, GPRRegister dst, const Immediate &imm); | 710 void And(Type Ty, GPRRegister dst, const Immediate &imm); |
| 711 void And(Type Ty, const Address &address, GPRRegister reg); |
| 712 void And(Type Ty, const Address &address, const Immediate &imm); |
711 | 713 |
712 void Or(Type Ty, GPRRegister dst, GPRRegister src); | 714 void Or(Type Ty, GPRRegister dst, GPRRegister src); |
713 void Or(Type Ty, GPRRegister dst, const Address &address); | 715 void Or(Type Ty, GPRRegister dst, const Address &address); |
714 void Or(Type Ty, GPRRegister dst, const Immediate &imm); | 716 void Or(Type Ty, GPRRegister dst, const Immediate &imm); |
| 717 void Or(Type Ty, const Address &address, GPRRegister reg); |
| 718 void Or(Type Ty, const Address &address, const Immediate &imm); |
715 | 719 |
716 void Xor(Type Ty, GPRRegister dst, GPRRegister src); | 720 void Xor(Type Ty, GPRRegister dst, GPRRegister src); |
717 void Xor(Type Ty, GPRRegister dst, const Address &address); | 721 void Xor(Type Ty, GPRRegister dst, const Address &address); |
718 void Xor(Type Ty, GPRRegister dst, const Immediate &imm); | 722 void Xor(Type Ty, GPRRegister dst, const Immediate &imm); |
| 723 void Xor(Type Ty, const Address &address, GPRRegister reg); |
| 724 void Xor(Type Ty, const Address &address, const Immediate &imm); |
719 | 725 |
720 void add(Type Ty, GPRRegister dst, GPRRegister src); | 726 void add(Type Ty, GPRRegister dst, GPRRegister src); |
721 void add(Type Ty, GPRRegister reg, const Address &address); | 727 void add(Type Ty, GPRRegister reg, const Address &address); |
722 void add(Type Ty, GPRRegister reg, const Immediate &imm); | 728 void add(Type Ty, GPRRegister reg, const Immediate &imm); |
723 void add(Type Ty, const Address &address, GPRRegister reg); | 729 void add(Type Ty, const Address &address, GPRRegister reg); |
724 void add(Type Ty, const Address &address, const Immediate &imm); | 730 void add(Type Ty, const Address &address, const Immediate &imm); |
725 | 731 |
726 void adc(Type Ty, GPRRegister dst, GPRRegister src); | 732 void adc(Type Ty, GPRRegister dst, GPRRegister src); |
727 void adc(Type Ty, GPRRegister dst, const Address &address); | 733 void adc(Type Ty, GPRRegister dst, const Address &address); |
728 void adc(Type Ty, GPRRegister reg, const Immediate &imm); | 734 void adc(Type Ty, GPRRegister reg, const Immediate &imm); |
| 735 void adc(Type Ty, const Address &address, GPRRegister reg); |
| 736 void adc(Type Ty, const Address &address, const Immediate &imm); |
729 | 737 |
730 void sub(Type Ty, GPRRegister dst, GPRRegister src); | 738 void sub(Type Ty, GPRRegister dst, GPRRegister src); |
731 void sub(Type Ty, GPRRegister reg, const Address &address); | 739 void sub(Type Ty, GPRRegister reg, const Address &address); |
732 void sub(Type Ty, GPRRegister reg, const Immediate &imm); | 740 void sub(Type Ty, GPRRegister reg, const Immediate &imm); |
| 741 void sub(Type Ty, const Address &address, GPRRegister reg); |
| 742 void sub(Type Ty, const Address &address, const Immediate &imm); |
733 | 743 |
734 void sbb(Type Ty, GPRRegister dst, GPRRegister src); | 744 void sbb(Type Ty, GPRRegister dst, GPRRegister src); |
735 void sbb(Type Ty, GPRRegister reg, const Address &address); | 745 void sbb(Type Ty, GPRRegister reg, const Address &address); |
736 void sbb(Type Ty, GPRRegister reg, const Immediate &imm); | 746 void sbb(Type Ty, GPRRegister reg, const Immediate &imm); |
| 747 void sbb(Type Ty, const Address &address, GPRRegister reg); |
| 748 void sbb(Type Ty, const Address &address, const Immediate &imm); |
737 | 749 |
738 void cbw(); | 750 void cbw(); |
739 void cwd(); | 751 void cwd(); |
740 void cdq(); | 752 void cdq(); |
741 | 753 |
742 void div(Type Ty, GPRRegister reg); | 754 void div(Type Ty, GPRRegister reg); |
743 void div(Type Ty, const Address &address); | 755 void div(Type Ty, const Address &address); |
744 | 756 |
745 void idiv(Type Ty, GPRRegister reg); | 757 void idiv(Type Ty, GPRRegister reg); |
746 void idiv(Type Ty, const Address &address); | 758 void idiv(Type Ty, const Address &address); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 void emitGenericShift(int rm, Type Ty, const Operand &operand, | 864 void emitGenericShift(int rm, Type Ty, const Operand &operand, |
853 GPRRegister shifter); | 865 GPRRegister shifter); |
854 | 866 |
855 typedef std::vector<Label *> LabelVector; | 867 typedef std::vector<Label *> LabelVector; |
856 // A vector of pool-allocated x86 labels for CFG nodes. | 868 // A vector of pool-allocated x86 labels for CFG nodes. |
857 LabelVector CfgNodeLabels; | 869 LabelVector CfgNodeLabels; |
858 // A vector of pool-allocated x86 labels for Local labels. | 870 // A vector of pool-allocated x86 labels for Local labels. |
859 LabelVector LocalLabels; | 871 LabelVector LocalLabels; |
860 | 872 |
861 Label *GetOrCreateLabel(SizeT Number, LabelVector &Labels); | 873 Label *GetOrCreateLabel(SizeT Number, LabelVector &Labels); |
| 874 |
| 875 // The arith_int() methods factor out the commonality between the encodings of |
| 876 // add(), Or(), adc(), sbb(), And(), sub(), Xor(), and cmp(). The Tag |
| 877 // parameter is statically asserted to be less than 8. |
| 878 template <uint32_t Tag> |
| 879 void arith_int(Type Ty, GPRRegister reg, const Immediate &imm); |
| 880 |
| 881 template <uint32_t Tag> |
| 882 void arith_int(Type Ty, GPRRegister reg0, GPRRegister reg1); |
| 883 |
| 884 template <uint32_t Tag> |
| 885 void arith_int(Type Ty, GPRRegister reg, const Address &address); |
| 886 |
| 887 template <uint32_t Tag> |
| 888 void arith_int(Type Ty, const Address &address, GPRRegister reg); |
| 889 |
| 890 template <uint32_t Tag> |
| 891 void arith_int(Type Ty, const Address &address, const Immediate &imm); |
862 }; | 892 }; |
863 | 893 |
864 inline void AssemblerX8632::emitUint8(uint8_t value) { | 894 inline void AssemblerX8632::emitUint8(uint8_t value) { |
865 Buffer.emit<uint8_t>(value); | 895 Buffer.emit<uint8_t>(value); |
866 } | 896 } |
867 | 897 |
868 inline void AssemblerX8632::emitInt16(int16_t value) { | 898 inline void AssemblerX8632::emitInt16(int16_t value) { |
869 Buffer.emit<int16_t>(value); | 899 Buffer.emit<int16_t>(value); |
870 } | 900 } |
871 | 901 |
(...skipping 13 matching lines...) Expand all Loading... |
885 inline void AssemblerX8632::emitFixup(AssemblerFixup *fixup) { | 915 inline void AssemblerX8632::emitFixup(AssemblerFixup *fixup) { |
886 Buffer.emitFixup(fixup); | 916 Buffer.emitFixup(fixup); |
887 } | 917 } |
888 | 918 |
889 inline void AssemblerX8632::emitOperandSizeOverride() { emitUint8(0x66); } | 919 inline void AssemblerX8632::emitOperandSizeOverride() { emitUint8(0x66); } |
890 | 920 |
891 } // end of namespace X8632 | 921 } // end of namespace X8632 |
892 } // end of namespace Ice | 922 } // end of namespace Ice |
893 | 923 |
894 #endif // SUBZERO_SRC_ICEASSEMBLERX8632_H | 924 #endif // SUBZERO_SRC_ICEASSEMBLERX8632_H |
OLD | NEW |