Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 bool isLoadStoreType(Type Ty); | 62 bool isLoadStoreType(Type Ty); |
| 63 | 63 |
| 64 /// Returns type generated by applying the compare instructions (icmp and fcmp) | 64 /// Returns type generated by applying the compare instructions (icmp and fcmp) |
| 65 /// to arguments of the given type. Returns IceType_void if compare is not | 65 /// to arguments of the given type. Returns IceType_void if compare is not |
| 66 /// allowed. | 66 /// allowed. |
| 67 Type getCompareResultType(Type Ty); | 67 Type getCompareResultType(Type Ty); |
| 68 | 68 |
| 69 /// Returns the number of bits in a scalar integer type. | 69 /// Returns the number of bits in a scalar integer type. |
| 70 SizeT getScalarIntBitWidth(Type Ty); | 70 SizeT getScalarIntBitWidth(Type Ty); |
| 71 | 71 |
| 72 // Check if a type is byte sized (slight optimization over typeWidthInBytes). | |
| 73 inline bool isByteSizedType(Type Ty) { | |
| 74 bool result = Ty == IceType_i8 || Ty == IceType_i1; | |
| 75 assert(result == (1 == typeWidthInBytes(Ty))); | |
| 76 return result; | |
| 77 } | |
| 78 | |
| 79 // Check if Ty is byte sized and specifically i8. Assert that it's not | |
| 80 // byte sized due to being an i1. | |
| 81 inline bool isByteSizedArithType(Type Ty) { | |
| 82 assert(Ty != IceType_i1); | |
| 83 return Ty == IceType_i8; | |
| 84 } | |
| 85 | |
| 86 // Assuming Ty is either i32 or i64, return true if Ty is i32. | |
| 87 inline bool isInt32Assuming32Or64(Type Ty) { | |
|
jvoung (off chromium)
2014/09/27 00:23:39
Hmm different name suggestions welcome
Jim Stichnoth
2014/09/27 00:38:22
I guess my suggestion would be
isI32AssumingI32O
jvoung (off chromium)
2014/09/29 16:10:51
Going with "Asserting" instead of "Assuming"
| |
| 88 bool result = Ty == IceType_i32; | |
| 89 assert(result || Ty == IceType_i64); | |
| 90 return result; | |
| 91 } | |
| 92 | |
| 93 // Assuming Ty is either f32 or f64, return true if Ty is f32. | |
| 94 inline bool isFloat32Assuming32Or64(Type Ty) { | |
| 95 bool result = Ty == IceType_f32; | |
| 96 assert(result || Ty == IceType_f64); | |
| 97 return result; | |
| 98 } | |
| 99 | |
| 72 template <typename StreamType> | 100 template <typename StreamType> |
| 73 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { | 101 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { |
| 74 Str << typeString(Ty); | 102 Str << typeString(Ty); |
| 75 return Str; | 103 return Str; |
| 76 } | 104 } |
| 77 | 105 |
| 78 } // end of namespace Ice | 106 } // end of namespace Ice |
| 79 | 107 |
| 80 #endif // SUBZERO_SRC_ICETYPES_H | 108 #endif // SUBZERO_SRC_ICETYPES_H |
| OLD | NEW |