OLD | NEW |
1 //===- subzero/src/IceTypes.h - Primitive ICE types -------------*- C++ -*-===// | 1 //===- subzero/src/IceTypes.h - Primitive ICE types -------------*- 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 |
11 /// \brief Declares a few properties of the primitive types allowed in Subzero. | 11 /// \brief Declares a few properties of the primitive types allowed in Subzero. |
12 /// Every Subzero source file is expected to include IceTypes.h. | 12 /// Every Subzero source file is expected to include IceTypes.h. |
13 /// | 13 /// |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICETYPES_H | 16 #ifndef SUBZERO_SRC_ICETYPES_H |
17 #define SUBZERO_SRC_ICETYPES_H | 17 #define SUBZERO_SRC_ICETYPES_H |
18 | 18 |
19 #include "IceDefs.h" | 19 #include "IceDefs.h" |
20 #include "IceTypes.def" | 20 #include "IceTypes.def" |
21 | 21 |
22 namespace Ice { | 22 namespace Ice { |
23 | 23 |
24 enum Type { | 24 enum Type { |
25 #define X(tag, sizeLog2, align, elts, elty, str) IceType_##tag, | 25 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) IceType_##tag, |
26 ICETYPE_TABLE | 26 ICETYPE_TABLE |
27 #undef X | 27 #undef X |
28 IceType_NUM | 28 IceType_NUM |
29 }; | 29 }; |
30 | 30 |
| 31 /// RegClass indicates the physical register class that a Variable may be |
| 32 /// register-allocated from. By default, a variable's register class is |
| 33 /// directly associated with its type. However, the target lowering may define |
| 34 /// additional target-specific register classes by extending the set of enum |
| 35 /// values. |
| 36 enum RegClass : uint8_t { |
| 37 // Define RC_void, RC_i1, RC_i8, etc. |
| 38 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \ |
| 39 RC_##tag = IceType_##tag, |
| 40 ICETYPE_TABLE |
| 41 #undef X |
| 42 RC_Target, |
| 43 // Leave plenty of space for target-specific values. |
| 44 RC_Max = std::numeric_limits<uint8_t>::max() |
| 45 }; |
| 46 static_assert(RC_Target == static_cast<RegClass>(IceType_NUM), |
| 47 "Expected RC_Target and IceType_NUM to be the same"); |
| 48 |
31 enum TargetArch { | 49 enum TargetArch { |
32 #define X(tag, str, is_elf64, e_machine, e_flags) tag, | 50 #define X(tag, str, is_elf64, e_machine, e_flags) tag, |
33 TARGETARCH_TABLE | 51 TARGETARCH_TABLE |
34 #undef X | 52 #undef X |
35 TargetArch_NUM | 53 TargetArch_NUM |
36 }; | 54 }; |
37 | 55 |
38 const char *targetArchString(TargetArch Arch); | 56 const char *targetArchString(TargetArch Arch); |
39 | 57 |
40 inline Ostream &operator<<(Ostream &Stream, TargetArch Arch) { | 58 inline Ostream &operator<<(Ostream &Stream, TargetArch Arch) { |
(...skipping 16 matching lines...) Expand all Loading... |
57 }; | 75 }; |
58 | 76 |
59 enum OptLevel { Opt_m1, Opt_0, Opt_1, Opt_2 }; | 77 enum OptLevel { Opt_m1, Opt_0, Opt_1, Opt_2 }; |
60 | 78 |
61 size_t typeWidthInBytes(Type Ty); | 79 size_t typeWidthInBytes(Type Ty); |
62 int8_t typeWidthInBytesLog2(Type Ty); | 80 int8_t typeWidthInBytesLog2(Type Ty); |
63 size_t typeAlignInBytes(Type Ty); | 81 size_t typeAlignInBytes(Type Ty); |
64 size_t typeNumElements(Type Ty); | 82 size_t typeNumElements(Type Ty); |
65 Type typeElementType(Type Ty); | 83 Type typeElementType(Type Ty); |
66 const char *typeString(Type Ty); | 84 const char *typeString(Type Ty); |
| 85 const char *regClassString(RegClass C); |
67 | 86 |
68 inline Type getPointerType() { return IceType_i32; } | 87 inline Type getPointerType() { return IceType_i32; } |
69 | 88 |
70 bool isVectorType(Type Ty); | 89 bool isVectorType(Type Ty); |
71 | 90 |
72 bool isIntegerType(Type Ty); // scalar or vector | 91 bool isIntegerType(Type Ty); // scalar or vector |
73 bool isScalarIntegerType(Type Ty); | 92 bool isScalarIntegerType(Type Ty); |
74 bool isVectorIntegerType(Type Ty); | 93 bool isVectorIntegerType(Type Ty); |
75 bool isIntegerArithmeticType(Type Ty); | 94 bool isIntegerArithmeticType(Type Ty); |
76 | 95 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 }; | 182 }; |
164 | 183 |
165 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { | 184 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { |
166 Sig.dump(Stream); | 185 Sig.dump(Stream); |
167 return Stream; | 186 return Stream; |
168 } | 187 } |
169 | 188 |
170 } // end of namespace Ice | 189 } // end of namespace Ice |
171 | 190 |
172 #endif // SUBZERO_SRC_ICETYPES_H | 191 #endif // SUBZERO_SRC_ICETYPES_H |
OLD | NEW |