OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8664Traits.h - x86-64 traits -*- C++ -*-=// | 1 //===- subzero/src/IceTargetLoweringX8664Traits.h - x86-64 traits -*- C++ -*-=// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "IceRegistersX8664.h" | 24 #include "IceRegistersX8664.h" |
25 #include "IceTargetLowering.h" | 25 #include "IceTargetLowering.h" |
26 #include "IceTargetLoweringX8664.def" | 26 #include "IceTargetLoweringX8664.def" |
27 #include "IceTargetLoweringX86RegClass.h" | 27 #include "IceTargetLoweringX86RegClass.h" |
28 | 28 |
29 #include <array> | 29 #include <array> |
30 #include <initializer_list> | 30 #include <initializer_list> |
31 | 31 |
32 namespace Ice { | 32 namespace Ice { |
33 | 33 |
| 34 namespace X8664 { |
| 35 using namespace ::Ice::X86; |
| 36 |
| 37 template <class TraitsType> class AssemblerX86Base; |
| 38 template <class TraitsType> struct Insts; |
| 39 template <class TraitsType> class TargetX86Base; |
| 40 |
34 class TargetX8664; | 41 class TargetX8664; |
35 | 42 |
36 namespace X8664 { | 43 struct TargetX8664Traits { |
37 class AssemblerX8664; | |
38 } // end of namespace X8664 | |
39 | |
40 namespace X86Internal { | |
41 | |
42 template <class Machine> struct Insts; | |
43 template <class Machine> struct MachineTraits; | |
44 template <class Machine> class TargetX86Base; | |
45 | |
46 template <> struct MachineTraits<TargetX8664> { | |
47 //---------------------------------------------------------------------------- | 44 //---------------------------------------------------------------------------- |
48 // ______ ______ __ __ | 45 // ______ ______ __ __ |
49 // /\ __ \/\ ___\/\ "-./ \ | 46 // /\ __ \/\ ___\/\ "-./ \ |
50 // \ \ __ \ \___ \ \ \-./\ \ | 47 // \ \ __ \ \___ \ \ \-./\ \ |
51 // \ \_\ \_\/\_____\ \_\ \ \_\ | 48 // \ \_\ \_\/\_____\ \_\ \ \_\ |
52 // \/_/\/_/\/_____/\/_/ \/_/ | 49 // \/_/\/_/\/_____/\/_/ \/_/ |
53 // | 50 // |
54 //---------------------------------------------------------------------------- | 51 //---------------------------------------------------------------------------- |
| 52 static constexpr ::Ice::Assembler::AssemblerKind AsmKind = |
| 53 ::Ice::Assembler::Asm_X8632; |
| 54 |
55 static constexpr bool Is64Bit = true; | 55 static constexpr bool Is64Bit = true; |
56 static constexpr bool HasPopa = false; | 56 static constexpr bool HasPopa = false; |
57 static constexpr bool HasPusha = false; | 57 static constexpr bool HasPusha = false; |
58 static constexpr bool UsesX87 = false; | 58 static constexpr bool UsesX87 = false; |
59 static constexpr ::Ice::RegX8664::GPRRegister Last8BitGPR = | 59 static constexpr ::Ice::RegX8664::GPRRegister Last8BitGPR = |
60 ::Ice::RegX8664::GPRRegister::Encoded_Reg_r15d; | 60 ::Ice::RegX8664::GPRRegister::Encoded_Reg_r15d; |
61 | 61 |
62 enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 }; | 62 enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 }; |
63 | 63 |
64 using GPRRegister = ::Ice::RegX8664::GPRRegister; | 64 using GPRRegister = ::Ice::RegX8664::GPRRegister; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 /// Returns whether or not this operand is really the given register in | 185 /// Returns whether or not this operand is really the given register in |
186 /// disguise. Used from the assembler to generate better encodings. | 186 /// disguise. Used from the assembler to generate better encodings. |
187 bool IsRegister(GPRRegister reg) const { | 187 bool IsRegister(GPRRegister reg) const { |
188 return ((encoding_[0] & 0xF8) == | 188 return ((encoding_[0] & 0xF8) == |
189 0xC0) // Addressing mode is register only. | 189 0xC0) // Addressing mode is register only. |
190 && | 190 && |
191 (rm() == reg); // Register codes match. | 191 (rm() == reg); // Register codes match. |
192 } | 192 } |
193 | 193 |
194 template <class> friend class AssemblerX86Base; | 194 friend class AssemblerX86Base<TargetX8664Traits>; |
195 }; | 195 }; |
196 | 196 |
197 class Address : public Operand { | 197 class Address : public Operand { |
198 Address() = delete; | 198 Address() = delete; |
199 | 199 |
200 public: | 200 public: |
201 Address(const Address &other) : Operand(other) {} | 201 Address(const Address &other) : Operand(other) {} |
202 | 202 |
203 Address &operator=(const Address &other) { | 203 Address &operator=(const Address &other) { |
204 Operand::operator=(other); | 204 Operand::operator=(other); |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 static const size_t TableTypeX8664AttributesSize; | 794 static const size_t TableTypeX8664AttributesSize; |
795 | 795 |
796 //---------------------------------------------------------------------------- | 796 //---------------------------------------------------------------------------- |
797 // __ __ __ ______ ______ | 797 // __ __ __ ______ ______ |
798 // /\ \/\ "-.\ \/\ ___\/\__ _\ | 798 // /\ \/\ "-.\ \/\ ___\/\__ _\ |
799 // \ \ \ \ \-. \ \___ \/_/\ \/ | 799 // \ \ \ \ \-. \ \___ \/_/\ \/ |
800 // \ \_\ \_\\"\_\/\_____\ \ \_\ | 800 // \ \_\ \_\\"\_\/\_____\ \ \_\ |
801 // \/_/\/_/ \/_/\/_____/ \/_/ | 801 // \/_/\/_/ \/_/\/_____/ \/_/ |
802 // | 802 // |
803 //---------------------------------------------------------------------------- | 803 //---------------------------------------------------------------------------- |
804 using Insts = ::Ice::X86Internal::Insts<TargetX8664>; | 804 using Traits = TargetX8664Traits; |
| 805 using Insts = ::Ice::X8664::Insts<Traits>; |
805 | 806 |
806 using TargetLowering = ::Ice::X86Internal::TargetX86Base<TargetX8664>; | 807 using TargetLowering = ::Ice::X8664::TargetX86Base<Traits>; |
807 using Assembler = X8664::AssemblerX8664; | 808 using ConcreteTarget = ::Ice::X8664::TargetX8664; |
| 809 using Assembler = ::Ice::X8664::AssemblerX86Base<Traits>; |
808 | 810 |
809 /// X86Operand extends the Operand hierarchy. Its subclasses are X86OperandMem | 811 /// X86Operand extends the Operand hierarchy. Its subclasses are X86OperandMem |
810 /// and VariableSplit. | 812 /// and VariableSplit. |
811 class X86Operand : public ::Ice::Operand { | 813 class X86Operand : public ::Ice::Operand { |
812 X86Operand() = delete; | 814 X86Operand() = delete; |
813 X86Operand(const X86Operand &) = delete; | 815 X86Operand(const X86Operand &) = delete; |
814 X86Operand &operator=(const X86Operand &) = delete; | 816 X86Operand &operator=(const X86Operand &) = delete; |
815 | 817 |
816 public: | 818 public: |
817 enum OperandKindX8664 { k__Start = ::Ice::Operand::kTarget, kMem, kSplit }; | 819 enum OperandKindX8664 { k__Start = ::Ice::Operand::kTarget, kMem, kSplit }; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 const char *CvtString; // i (integer), s (single FP), d (double FP) | 967 const char *CvtString; // i (integer), s (single FP), d (double FP) |
966 const char *SdSsString; // ss, sd, or <blank> | 968 const char *SdSsString; // ss, sd, or <blank> |
967 const char *PdPsString; // ps, pd, or <blank> | 969 const char *PdPsString; // ps, pd, or <blank> |
968 const char *SpSdString; // ss, sd, ps, pd, or <blank> | 970 const char *SpSdString; // ss, sd, ps, pd, or <blank> |
969 const char *PackString; // b, w, d, or <blank> | 971 const char *PackString; // b, w, d, or <blank> |
970 const char *WidthString; // b, w, l, q, or <blank> | 972 const char *WidthString; // b, w, l, q, or <blank> |
971 const char *FldString; // s, l, or <blank> | 973 const char *FldString; // s, l, or <blank> |
972 } TypeAttributes[]; | 974 } TypeAttributes[]; |
973 }; | 975 }; |
974 | 976 |
975 } // end of namespace X86Internal | 977 using Traits = ::Ice::X8664::TargetX8664Traits; |
976 | |
977 namespace X8664 { | |
978 using Traits = ::Ice::X86Internal::MachineTraits<TargetX8664>; | |
979 } // end of namespace X8664 | 978 } // end of namespace X8664 |
980 | 979 |
981 } // end of namespace Ice | 980 } // end of namespace Ice |
982 | 981 |
983 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664TRAITS_H | 982 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664TRAITS_H |
OLD | NEW |