| 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 23 matching lines...) Expand all Loading... |
| 34 sizeof(TypeAttributes) / sizeof(*TypeAttributes); | 34 sizeof(TypeAttributes) / sizeof(*TypeAttributes); |
| 35 | 35 |
| 36 } // end anonymous namespace | 36 } // end anonymous namespace |
| 37 | 37 |
| 38 size_t typeWidthInBytes(Type Ty) { | 38 size_t typeWidthInBytes(Type Ty) { |
| 39 size_t Width = 0; | 39 size_t Width = 0; |
| 40 size_t Index = static_cast<size_t>(Ty); | 40 size_t Index = static_cast<size_t>(Ty); |
| 41 if (Index < TypeAttributesSize) { | 41 if (Index < TypeAttributesSize) { |
| 42 Width = TypeAttributes[Index].TypeWidthInBytes; | 42 Width = TypeAttributes[Index].TypeWidthInBytes; |
| 43 } else { | 43 } else { |
| 44 assert(0 && "Invalid type for typeWidthInBytes()"); | 44 llvm_unreachable("Invalid type for typeWidthInBytes()"); |
| 45 } | 45 } |
| 46 return Width; | 46 return Width; |
| 47 } | 47 } |
| 48 | 48 |
| 49 size_t typeAlignInBytes(Type Ty) { | 49 size_t typeAlignInBytes(Type Ty) { |
| 50 size_t Align = 0; | 50 size_t Align = 0; |
| 51 size_t Index = static_cast<size_t>(Ty); | 51 size_t Index = static_cast<size_t>(Ty); |
| 52 if (Index < TypeAttributesSize) { | 52 if (Index < TypeAttributesSize) { |
| 53 Align = TypeAttributes[Index].TypeAlignInBytes; | 53 Align = TypeAttributes[Index].TypeAlignInBytes; |
| 54 } else { | 54 } else { |
| 55 assert(0 && "Invalid type for typeAlignInBytes()"); | 55 llvm_unreachable("Invalid type for typeAlignInBytes()"); |
| 56 } | 56 } |
| 57 return Align; | 57 return Align; |
| 58 } | 58 } |
| 59 | 59 |
| 60 // ======================== Dump routines ======================== // | 60 // ======================== Dump routines ======================== // |
| 61 | 61 |
| 62 template <> Ostream &operator<<(Ostream &Str, const Type &Ty) { | 62 template <> Ostream &operator<<(Ostream &Str, const Type &Ty) { |
| 63 size_t Index = static_cast<size_t>(Ty); | 63 size_t Index = static_cast<size_t>(Ty); |
| 64 if (Index < TypeAttributesSize) { | 64 if (Index < TypeAttributesSize) { |
| 65 Str << TypeAttributes[Index].DisplayString; | 65 Str << TypeAttributes[Index].DisplayString; |
| 66 } else { | 66 } else { |
| 67 Str << "???"; | 67 Str << "???"; |
| 68 assert(0 && "Invalid type for printing"); | 68 llvm_unreachable("Invalid type for printing"); |
| 69 } | 69 } |
| 70 | 70 |
| 71 return Str; | 71 return Str; |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // end of namespace Ice | 74 } // end of namespace Ice |
| OLD | NEW |