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 // This file declares a few properties of the primitive types allowed | 10 // This file declares a few properties of the primitive types allowed |
(...skipping 22 matching lines...) Expand all Loading... |
33 #undef X | 33 #undef X |
34 TargetArch_NUM | 34 TargetArch_NUM |
35 }; | 35 }; |
36 | 36 |
37 const char *targetArchString(TargetArch Arch); | 37 const char *targetArchString(TargetArch Arch); |
38 | 38 |
39 inline Ostream &operator<<(Ostream &Stream, TargetArch Arch) { | 39 inline Ostream &operator<<(Ostream &Stream, TargetArch Arch) { |
40 return Stream << targetArchString(Arch); | 40 return Stream << targetArchString(Arch); |
41 } | 41 } |
42 | 42 |
43 enum OptLevel { | 43 enum OptLevel { Opt_m1, Opt_0, Opt_1, Opt_2 }; |
44 Opt_m1, | |
45 Opt_0, | |
46 Opt_1, | |
47 Opt_2 | |
48 }; | |
49 | 44 |
50 size_t typeWidthInBytes(Type Ty); | 45 size_t typeWidthInBytes(Type Ty); |
51 size_t typeAlignInBytes(Type Ty); | 46 size_t typeAlignInBytes(Type Ty); |
52 size_t typeNumElements(Type Ty); | 47 size_t typeNumElements(Type Ty); |
53 Type typeElementType(Type Ty); | 48 Type typeElementType(Type Ty); |
54 const char *typeString(Type Ty); | 49 const char *typeString(Type Ty); |
55 | 50 |
56 inline Type getPointerType() { return IceType_i32; } | 51 inline Type getPointerType() { return IceType_i32; } |
57 | 52 |
58 bool isVectorType(Type Ty); | 53 bool isVectorType(Type Ty); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 102 |
108 template <typename StreamType> | 103 template <typename StreamType> |
109 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { | 104 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { |
110 Str << typeString(Ty); | 105 Str << typeString(Ty); |
111 return Str; | 106 return Str; |
112 } | 107 } |
113 | 108 |
114 /// Models a type signature for a function. | 109 /// Models a type signature for a function. |
115 class FuncSigType { | 110 class FuncSigType { |
116 FuncSigType &operator=(const FuncSigType &Ty) = delete; | 111 FuncSigType &operator=(const FuncSigType &Ty) = delete; |
| 112 |
117 public: | 113 public: |
118 typedef std::vector<Type> ArgListType; | 114 typedef std::vector<Type> ArgListType; |
119 | 115 |
120 // Creates a function signature type with the given return type. | 116 // Creates a function signature type with the given return type. |
121 // Parameter types should be added using calls to appendArgType. | 117 // Parameter types should be added using calls to appendArgType. |
122 FuncSigType() : ReturnType(IceType_void) {} | 118 FuncSigType() : ReturnType(IceType_void) {} |
123 FuncSigType(const FuncSigType &Ty) = default; | 119 FuncSigType(const FuncSigType &Ty) = default; |
124 | 120 |
125 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } | 121 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } |
126 | 122 |
(...skipping 15 matching lines...) Expand all Loading... |
142 }; | 138 }; |
143 | 139 |
144 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { | 140 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { |
145 Sig.dump(Stream); | 141 Sig.dump(Stream); |
146 return Stream; | 142 return Stream; |
147 } | 143 } |
148 | 144 |
149 } // end of namespace Ice | 145 } // end of namespace Ice |
150 | 146 |
151 #endif // SUBZERO_SRC_ICETYPES_H | 147 #endif // SUBZERO_SRC_ICETYPES_H |
OLD | NEW |