OLD | NEW |
1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===// | 1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===// |
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 defines a few attributes of Subzero primitive types. | 10 // This file defines a few attributes of Subzero primitive types. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 Type getCompareResultType(Type Ty) { | 223 Type getCompareResultType(Type Ty) { |
224 size_t Index = static_cast<size_t>(Ty); | 224 size_t Index = static_cast<size_t>(Ty); |
225 if (Index < IceType_NUM) | 225 if (Index < IceType_NUM) |
226 return TypePropertiesTable[Index].CompareResultType; | 226 return TypePropertiesTable[Index].CompareResultType; |
227 llvm_unreachable("Invalid type for getCompareResultType"); | 227 llvm_unreachable("Invalid type for getCompareResultType"); |
228 return IceType_void; | 228 return IceType_void; |
229 } | 229 } |
230 | 230 |
| 231 SizeT getScalarIntBitWidth(Type Ty) { |
| 232 assert(isScalarIntegerType(Ty)); |
| 233 if (Ty == Ice::IceType_i1) |
| 234 return 1; |
| 235 return typeWidthInBytes(Ty) * CHAR_BIT; |
| 236 } |
| 237 |
231 // ======================== Dump routines ======================== // | 238 // ======================== Dump routines ======================== // |
232 | 239 |
233 const char *typeString(Type Ty) { | 240 const char *typeString(Type Ty) { |
234 size_t Index = static_cast<size_t>(Ty); | 241 size_t Index = static_cast<size_t>(Ty); |
235 if (Index < IceType_NUM) | 242 if (Index < IceType_NUM) |
236 return TypeAttributes[Index].DisplayString; | 243 return TypeAttributes[Index].DisplayString; |
237 llvm_unreachable("Invalid type for typeString"); | 244 llvm_unreachable("Invalid type for typeString"); |
238 return "???"; | 245 return "???"; |
239 } | 246 } |
240 | 247 |
241 } // end of namespace Ice | 248 } // end of namespace Ice |
OLD | NEW |